Skip to content

Commit

Permalink
[Php55] Check str_contains * before fnmatch() early on StringClassNam…
Browse files Browse the repository at this point in the history
…eToClassConstantRector (#4990)
  • Loading branch information
samsonasik committed Sep 11, 2023
1 parent bfb7590 commit 878f381
Showing 1 changed file with 7 additions and 3 deletions.
Expand Up @@ -176,11 +176,15 @@ private function shouldSkip(string $classLikeName): bool
}

foreach ($this->classesToSkip as $classToSkip) {
if ($this->nodeNameResolver->isStringName($classLikeName, $classToSkip)) {
return true;
if (str_contains($classToSkip, '*')) {
if (fnmatch($classToSkip, $classLikeName, FNM_NOESCAPE)) {
return true;
}

continue;
}

if (fnmatch($classToSkip, $classLikeName, FNM_NOESCAPE)) {
if ($this->nodeNameResolver->isStringName($classLikeName, $classToSkip)) {
return true;
}
}
Expand Down

0 comments on commit 878f381

Please sign in to comment.