note 125620 added to reflectionmethod.getdeclaringclass

From: Date: Sun, 20 Dec 2020 13:08:58 +0000
Subject: note 125620 added to reflectionmethod.getdeclaringclass
Groups: php.notes 
Request: Send a blank email to php-notes+get-216010@lists.php.net to get a copy of this message
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(); ---- Server IP: 45.112.84.4 Probable Submitter: 45.91.159.165 (proxied: 94.143.198.29) ---- Manual Page -- http://php.net/manual/en/reflectionmethod.getdeclaringclass.php Edit -- https://master.php.net/note/edit/125620 Del: integrated -- https://master.php.net/note/delete/125620/integrated Del: useless -- https://master.php.net/note/delete/125620/useless Del: bad code -- https://master.php.net/note/delete/125620/bad+code Del: spam -- https://master.php.net/note/delete/125620/spam Del: non-english -- https://master.php.net/note/delete/125620/non-english Del: in docs -- https://master.php.net/note/delete/125620/in+docs Del: other reasons-- https://master.php.net/note/delete/125620 Reject -- https://master.php.net/note/reject/125620 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#216010) next »