Skip to content

Commit 888056e

Browse files
zonuexeondrejmirtes
authored andcommitted
Avoid duplicating the same strpos() function call
1 parent ad2bbeb commit 888056e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Rules/ClassForbiddenNameCheck.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,12 @@ public function checkClassNames(array $pairs): array
5959
$projectName = $project;
6060
$withoutPrefixClassName = substr($className, strlen($prefix));
6161

62-
if (strpos($withoutPrefixClassName, '\\') === false) {
62+
$pos = strpos($withoutPrefixClassName, '\\');
63+
if ($pos === false) {
6364
continue;
6465
}
6566

66-
$withoutPrefixClassName = substr($withoutPrefixClassName, strpos($withoutPrefixClassName, '\\'));
67+
$withoutPrefixClassName = substr($withoutPrefixClassName, $pos);
6768
}
6869

6970
if ($projectName === null) {

0 commit comments

Comments
 (0)