diff --git a/src/Reflection/ReflectionClass.php b/src/Reflection/ReflectionClass.php index 1fccffbc2..6d6f693c8 100644 --- a/src/Reflection/ReflectionClass.php +++ b/src/Reflection/ReflectionClass.php @@ -1068,7 +1068,7 @@ private function methodHash(string $className, string $methodName): string return sprintf( '%s::%s', $className, - $methodName, + strtolower($methodName), ); } diff --git a/test/unit/Reflection/ReflectionClassTest.php b/test/unit/Reflection/ReflectionClassTest.php index fdb292153..4a0d093c0 100644 --- a/test/unit/Reflection/ReflectionClassTest.php +++ b/test/unit/Reflection/ReflectionClassTest.php @@ -1882,4 +1882,33 @@ class Foo self::assertCount(2, $constants); self::assertSame($expectedConstants, $constants); } + + public function testTraitRenamingMethodWithWrongCaseShouldStillWork(): void + { + $php = <<<'PHP' + myRenamedMethod(); + } + } + PHP; + + $reflection = (new ClassReflector(new StringSourceLocator($php, $this->astLocator)))->reflect('HelloWorld'); + self::assertTrue($reflection->hasMethod('myRenamedMethod')); + } }