diff --git a/src/Rules/PHPUnit/TestMethodsHelper.php b/src/Rules/PHPUnit/TestMethodsHelper.php index f1efc97f..e07abb5d 100644 --- a/src/Rules/PHPUnit/TestMethodsHelper.php +++ b/src/Rules/PHPUnit/TestMethodsHelper.php @@ -10,7 +10,7 @@ use PHPStan\Type\FileTypeMapper; use PHPUnit\Framework\TestCase; use function array_key_exists; -use function str_starts_with; +use function strpos; use function strtolower; final class TestMethodsHelper @@ -62,7 +62,7 @@ public function getTestMethods(ClassReflection $classReflection, Scope $scope): continue; } - if (str_starts_with(strtolower($reflectionMethod->getName()), 'test')) { + if (strpos(strtolower($reflectionMethod->getName()), 'test') === 0) { $testMethods[] = $reflectionMethod; continue; } diff --git a/src/Type/PHPUnit/DynamicCallToAssertionIgnoreExtension.php b/src/Type/PHPUnit/DynamicCallToAssertionIgnoreExtension.php index ccf5b0f4..35a0e983 100644 --- a/src/Type/PHPUnit/DynamicCallToAssertionIgnoreExtension.php +++ b/src/Type/PHPUnit/DynamicCallToAssertionIgnoreExtension.php @@ -8,7 +8,7 @@ use PHPStan\Analyser\Scope; use PHPUnit\Framework\TestCase; use function is_string; -use function str_starts_with; +use function strpos; final class DynamicCallToAssertionIgnoreExtension implements IgnoreErrorExtension { @@ -33,7 +33,7 @@ public function shouldIgnore(Error $error, Node $node, Scope $scope): bool if ( !$node->name instanceof Node\Identifier - || !str_starts_with($node->name->name, 'assert') + || strpos($node->name->name, 'assert') !== 0 ) { return false; }