Skip to content

Commit

Permalink
[Php55] Skip StringClassNameToClassConstantRector on case insensitive (
Browse files Browse the repository at this point in the history
…#2896)

* [Php55] Skip StringClassNameToClassConstantRector on case insensitive

* Fixed 🎉
  • Loading branch information
samsonasik committed Sep 2, 2022
1 parent 5a9cb50 commit e9bcacc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace Rector\Tests\Php55\Rector\String_\StringClassNameToClassConstantRector\Fixture;

final class SkipClassNameCaseInsensitive
{
public function run()
{
return 'STDCLASS';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,11 @@ private function shouldSkip(string $classLikeName, String_ $string): bool
return true;
}

$classReflection = $this->reflectionProvider->getClass($classLikeName);
if ($classReflection->getName() !== $classLikeName) {
return true;
}

// possibly string
if (ctype_lower($classLikeName[0])) {
return true;
Expand Down

0 comments on commit e9bcacc

Please sign in to comment.