Skip to content

Commit cb0b19c

Browse files
authored
Merge pull request #1427 from staabm/simple-contains
Use str_contains over strpos
2 parents 1cf5ee2 + d7575ff commit cb0b19c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/SourceLocator/Type/AnonymousClassObjectSourceLocator.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
use function array_filter;
3030
use function assert;
3131
use function file_get_contents;
32-
use function strpos;
32+
use function str_contains;
3333

3434
/** @internal */
3535
final class AnonymousClassObjectSourceLocator implements SourceLocator
@@ -75,7 +75,7 @@ private function getReflectionClass(Reflector $reflector, IdentifierType $identi
7575
/** @phpstan-var non-empty-string $fileName */
7676
$fileName = $this->coreClassReflection->getFileName();
7777

78-
if (strpos($fileName, 'eval()\'d code') !== false) {
78+
if (str_contains($fileName, 'eval()\'d code')) {
7979
throw EvaledAnonymousClassCannotBeLocated::create();
8080
}
8181

src/SourceLocator/Type/ClosureSourceLocator.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
use function array_filter;
3030
use function assert;
3131
use function file_get_contents;
32-
use function strpos;
32+
use function str_contains;
3333

3434
/** @internal */
3535
final class ClosureSourceLocator implements SourceLocator
@@ -70,7 +70,7 @@ private function getReflectionFunction(Reflector $reflector, IdentifierType $ide
7070
/** @phpstan-var non-empty-string $fileName */
7171
$fileName = $this->coreFunctionReflection->getFileName();
7272

73-
if (strpos($fileName, 'eval()\'d code') !== false) {
73+
if (str_contains($fileName, 'eval()\'d code')) {
7474
throw EvaledClosureCannotBeLocated::create();
7575
}
7676

0 commit comments

Comments
 (0)