|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2013-06-03 16:27 UTC] laruence@php.net
-Status: Open
+Status: Feedback
[2013-06-03 16:27 UTC] laruence@php.net
[2013-06-03 17:26 UTC] alasdair at softhome dot net
[2013-06-27 08:46 UTC] david at mouf-php dot com
[2013-06-27 09:58 UTC] alasdair at softhome dot net
[2013-10-15 11:54 UTC] php-bugs at lists dot php dot net
[2013-10-15 13:05 UTC] alasdair at softhome dot net
[2013-10-15 17:14 UTC] nikic@php.net
-Status: No Feedback
+Status: Open
[2013-10-15 17:14 UTC] nikic@php.net
[2014-10-01 22:12 UTC] ocramius at gmail dot com
[2017-01-24 18:43 UTC] love at sickpeople dot se
[2017-01-24 18:44 UTC] love at sickpeople dot se
[2018-07-30 16:55 UTC] josef dot sabl at gmail dot com
[2020-03-02 12:26 UTC] nikic@php.net
-Type: Bug
+Type: Feature/Change Request
[2020-03-02 12:26 UTC] nikic@php.net
[2021-07-23 12:34 UTC] nikic@php.net
-Summary: ReflectionClass::getMethods does not identify traits
+Summary: Allow fetching trait a method is copied from in
ReflectionMethod
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 19:00:01 2025 UTC |
Description: ------------ Specific PHP version PHP 5.4.15-1~dotdeb.2 Executing ReflectionClass::getMethods on a class using traits does not differentiate between methods within the class or methods within the trait being used, whereas calling ReflectionMethod::getDeclaringClass on the class with the method identifies it as coming from the trait. Test script: --------------- <?php trait t { function f() { //do stuff } } Class c { use t; function f2() { //do stuff } } $class = new ReflectionClass('c'); print_r($class->getMethods()); ?> Expected result: ---------------- Array ( [0] => ReflectionMethod Object ( [name] => f2 [class] => c ) [1] => ReflectionMethod Object ( [name] => f [class] => t ) ) or Array ( [0] => ReflectionMethod Object ( [name] => f2 [class] => c ) [1] => ReflectionMethod Object ( [name] => f [trait] => t ) ) Actual result: -------------- Array ( [0] => ReflectionMethod Object ( [name] => f2 [class] => c ) [1] => ReflectionMethod Object ( [name] => f [class] => c ) )