mirror of
https://github.com/pestphp/pest.git
synced 2026-03-09 09:17:23 +01:00
upgrade to phpstan lvl 8
This commit is contained in:
@ -142,6 +142,10 @@ final class TestCaseFactory
|
||||
}
|
||||
|
||||
$methodsCode = implode('', array_map(static function (TestCaseMethodFactory $method): string {
|
||||
if ($method->description === null) {
|
||||
throw ShouldNotHappen::fromMessage('The test description may not be empty.');
|
||||
}
|
||||
|
||||
$methodName = Str::evaluable($method->description);
|
||||
|
||||
$datasetsCode = '';
|
||||
@ -224,6 +228,10 @@ EOF;
|
||||
}
|
||||
|
||||
if (!$method->receivesArguments()) {
|
||||
if ($method->closure === null) {
|
||||
throw ShouldNotHappen::fromMessage('The test closure may not be empty.');
|
||||
}
|
||||
|
||||
$arguments = Reflection::getFunctionArguments($method->closure);
|
||||
|
||||
if (count($arguments) > 0) {
|
||||
@ -240,6 +248,10 @@ EOF;
|
||||
public function getMethod(string $methodName): TestCaseMethodFactory
|
||||
{
|
||||
foreach ($this->methods as $method) {
|
||||
if ($method->description === null) {
|
||||
throw ShouldNotHappen::fromMessage('The test description may not be empty.');
|
||||
}
|
||||
|
||||
if (Str::evaluable($method->description) === $methodName) {
|
||||
return $method;
|
||||
}
|
||||
|
||||
@ -89,7 +89,7 @@ final class TestCaseMethodFactory
|
||||
$testCase->chains->chain($this);
|
||||
$method->chains->chain($this);
|
||||
|
||||
return call_user_func(Closure::bind($closure, $this, $this::class), ...func_get_args());
|
||||
return \Pest\Support\Closure::safeBind($closure, $this, $this::class)(...func_get_args());
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user