note 125620 deleted from reflectionmethod.getdeclaringclass by cmb

From: Date: Sun, 20 Dec 2020 14:01:57 +0000
Subject: note 125620 deleted from reflectionmethod.getdeclaringclass by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-216011@lists.php.net to get a copy of this message
Note Submitter: Vitalii ---- Method ->getDeclaringClass() works incorrectly for trait reflections. Example: trait ChildTrait { use ParentTrait; } trait ParentTrait { public function parentMethod() { return true; } } $r = new ReflectionClass('ChildTrait'); // displays "ChildTrait" instead of "ParentTrait" echo $r->getMethod('parentMethod')->getDeclaringClass()->getName();

« previous php.notes (#216011) next »