Skip to content

Commit

Permalink
Use str_contains over strpos
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm committed Apr 22, 2024
1 parent 5b019ef commit d7575ff
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/SourceLocator/Type/AnonymousClassObjectSourceLocator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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();
}

Expand Down
4 changes: 2 additions & 2 deletions src/SourceLocator/Type/ClosureSourceLocator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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();
}

Expand Down

0 comments on commit d7575ff

Please sign in to comment.