mirror of
https://github.com/pestphp/pest.git
synced 2026-03-07 00:07:22 +01:00
Small tweaks for PHP 8
This commit is contained in:
@ -73,9 +73,10 @@ final class TestCaseFactory
|
|||||||
{
|
{
|
||||||
$methodsUsingOnly = $this->methodsUsingOnly();
|
$methodsUsingOnly = $this->methodsUsingOnly();
|
||||||
|
|
||||||
$methods = array_values(array_filter($this->methods, function ($method) use ($methodsUsingOnly) {
|
$methods = array_values(array_filter(
|
||||||
return count($methodsUsingOnly) === 0 || in_array($method, $methodsUsingOnly, true);
|
$this->methods,
|
||||||
}));
|
fn ($method) => count($methodsUsingOnly) === 0 || in_array($method, $methodsUsingOnly, true)
|
||||||
|
));
|
||||||
|
|
||||||
if (count($methods) > 0) {
|
if (count($methods) > 0) {
|
||||||
$this->evaluate($this->filename, $methods);
|
$this->evaluate($this->filename, $methods);
|
||||||
|
|||||||
@ -17,6 +17,7 @@ use PHPUnit\Framework\TestCase;
|
|||||||
final class TestCaseMethodFactory
|
final class TestCaseMethodFactory
|
||||||
{
|
{
|
||||||
use HigherOrderable;
|
use HigherOrderable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines if the Test Case will be the "only" being run.
|
* Determines if the Test Case will be the "only" being run.
|
||||||
*/
|
*/
|
||||||
@ -51,11 +52,9 @@ final class TestCaseMethodFactory
|
|||||||
public ?string $description,
|
public ?string $description,
|
||||||
public ?Closure $closure,
|
public ?Closure $closure,
|
||||||
) {
|
) {
|
||||||
if ($this->closure === null) {
|
$this->closure ??= function () {
|
||||||
$this->closure = function () {
|
Assert::getCount() > 0 ?: self::markTestIncomplete(); // @phpstan-ignore-line
|
||||||
Assert::getCount() > 0 ?: self::markTestIncomplete(); // @phpstan-ignore-line
|
};
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->bootHigherOrderable();
|
$this->bootHigherOrderable();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user