|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2020-05-15 17:47 UTC] nikic@php.net
[2020-05-15 17:47 UTC] nikic@php.net
-Status: Open
+Status: Duplicate
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 06 10:00:01 2025 UTC |
Description: ------------ ReflectionMethod reports wrong name of aliased trait method used by a class. I'd expect the same name the ReflectionMethod was fetched as (parentFooMethod). Test script: --------------- <?php trait BazTrait { public function fooMethod(): void { } } trait BarTrait { use BazTrait { fooMethod as parentFooMethod; } public function fooMethod(): void { $this->fooMethod(); $this->parentFooMethod(); } } class Foo { use BarTrait; public function doFoo(): void { $this->fooMethod(); $this->parentFooMethod(); } } $bar = new \ReflectionClass(BarTrait::class); var_dump($bar->getMethod('parentFooMethod')->getName()); $foo = new \ReflectionClass(Foo::class); var_dump($foo->hasMethod('parentFooMethod')); var_dump($foo->getMethod('parentFooMethod')->getName()); Expected result: ---------------- string(15) "parentFooMethod" bool(true) string(9) "parentFooMethod" Actual result: -------------- string(15) "parentFooMethod" bool(true) string(9) "fooMethod"