diff --git a/src/Rules/ClassForbiddenNameCheck.php b/src/Rules/ClassForbiddenNameCheck.php index 217c42443b..70249cc666 100644 --- a/src/Rules/ClassForbiddenNameCheck.php +++ b/src/Rules/ClassForbiddenNameCheck.php @@ -59,11 +59,12 @@ public function checkClassNames(array $pairs): array $projectName = $project; $withoutPrefixClassName = substr($className, strlen($prefix)); - if (strpos($withoutPrefixClassName, '\\') === false) { + $pos = strpos($withoutPrefixClassName, '\\'); + if ($pos === false) { continue; } - $withoutPrefixClassName = substr($withoutPrefixClassName, strpos($withoutPrefixClassName, '\\')); + $withoutPrefixClassName = substr($withoutPrefixClassName, $pos); } if ($projectName === null) { diff --git a/src/Testing/TypeInferenceTestCase.php b/src/Testing/TypeInferenceTestCase.php index 1793d7b1ec..4ff7d99a1a 100644 --- a/src/Testing/TypeInferenceTestCase.php +++ b/src/Testing/TypeInferenceTestCase.php @@ -41,8 +41,8 @@ use function is_string; use function preg_match; use function sprintf; +use function str_starts_with; use function stripos; -use function strpos; use function strtolower; use function version_compare; use const PHP_VERSION; @@ -424,7 +424,7 @@ private static function isFileLintSkipped(string $file): bool } // ignore shebang line - if (strpos($firstLine, '#!') === 0) { + if (str_starts_with($firstLine, '#!')) { $firstLine = fgets($f); if ($firstLine === false) { return false;