Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/File/FileExcluder.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
use function in_array;
use function is_dir;
use function is_file;
use function preg_match;
use function str_starts_with;
use function strlen;
use function strpbrk;
use function substr;
use const DIRECTORY_SEPARATOR;
use const FNM_CASEFOLD;
Expand Down Expand Up @@ -118,7 +118,7 @@ public static function isAbsolutePath(string $path): bool

public static function isFnmatchPattern(string $path): bool
{
return preg_match('~[*?[\]]~', $path) > 0;
return strpbrk($path, '*?[]') !== false;
}

}
4 changes: 2 additions & 2 deletions src/Type/Php/LtrimFunctionReturnTypeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
use PHPStan\Type\TypeCombinator;
use function count;
use function ltrim;
use function preg_match;
use function strpbrk;

#[AutowiredService]
final class LtrimFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension
Expand Down Expand Up @@ -72,7 +72,7 @@ public function getTypeFromFunctionCall(FunctionReflection $functionReflection,
}
} elseif ($trimConstantString->getValue() === '\\' && $string->isClassString()->yes()) {
$result[] = new ClassStringType();
} elseif (preg_match('/\d/', $trimConstantString->getValue()) === 0 && $string->isNumericString()->yes()) {
} elseif (strpbrk($trimConstantString->getValue(), '0123456789') === false && $string->isNumericString()->yes()) {
$result[] = new IntersectionType([new StringType(), new AccessoryNumericStringType()]);
} else {
return $defaultType;
Expand Down
4 changes: 2 additions & 2 deletions src/Type/Php/TrimFunctionDynamicReturnTypeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
use PHPStan\Type\TypeCombinator;
use function count;
use function in_array;
use function preg_match;
use function rtrim;
use function strpbrk;
use function trim;

#[AutowiredService]
Expand Down Expand Up @@ -77,7 +77,7 @@ public function getTypeFromFunctionCall(
true,
);
}
} elseif (preg_match('/\d/', $trimConstantString->getValue()) === 0 && $stringType->isNumericString()->yes()) {
} elseif (strpbrk($trimConstantString->getValue(), '0123456789') === false && $stringType->isNumericString()->yes()) {
$result[] = new IntersectionType([new StringType(), new AccessoryNumericStringType()]);
} else {
return $defaultType;
Expand Down
Loading