diff --git a/src/SourceLocator/Type/AnonymousClassObjectSourceLocator.php b/src/SourceLocator/Type/AnonymousClassObjectSourceLocator.php index 37b074d2b..3ec006321 100644 --- a/src/SourceLocator/Type/AnonymousClassObjectSourceLocator.php +++ b/src/SourceLocator/Type/AnonymousClassObjectSourceLocator.php @@ -29,7 +29,7 @@ use function array_filter; use function assert; use function file_get_contents; -use function strpos; +use function str_contains; /** @internal */ final class AnonymousClassObjectSourceLocator implements SourceLocator @@ -75,7 +75,7 @@ private function getReflectionClass(Reflector $reflector, IdentifierType $identi /** @phpstan-var non-empty-string $fileName */ $fileName = $this->coreClassReflection->getFileName(); - if (strpos($fileName, 'eval()\'d code') !== false) { + if (str_contains($fileName, 'eval()\'d code')) { throw EvaledAnonymousClassCannotBeLocated::create(); } diff --git a/src/SourceLocator/Type/ClosureSourceLocator.php b/src/SourceLocator/Type/ClosureSourceLocator.php index 869896c50..74cc006f1 100644 --- a/src/SourceLocator/Type/ClosureSourceLocator.php +++ b/src/SourceLocator/Type/ClosureSourceLocator.php @@ -29,7 +29,7 @@ use function array_filter; use function assert; use function file_get_contents; -use function strpos; +use function str_contains; /** @internal */ final class ClosureSourceLocator implements SourceLocator @@ -70,7 +70,7 @@ private function getReflectionFunction(Reflector $reflector, IdentifierType $ide /** @phpstan-var non-empty-string $fileName */ $fileName = $this->coreFunctionReflection->getFileName(); - if (strpos($fileName, 'eval()\'d code') !== false) { + if (str_contains($fileName, 'eval()\'d code')) { throw EvaledClosureCannotBeLocated::create(); }