Re: [IDEA for RFC] class_uses and optionally returning traits for parent classes
| From: | Claude Pache | Date: | Wed, 25 Mar 2026 11:13:03 +0000 |
| Subject: | Re: [IDEA for RFC] class_uses and optionally returning traits for parent classes | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-130447@lists.php.net to get a copy of this message | ||
> Le 25 mars 2026 à 08:37, Robert Humphries <contact@developer-rob.co.uk> a écrit :
>
> it isn't documented why it only returns traits on the current class
The reason is given here: https://bugs.php.net/bug.php?id=61554#1333085728
:
Traits are outside the inheritance system: the
parent class is effectively defined by the composition of its own
methods/properties and any traits it uses, so trait usage is not actually
inherited. Furthermore, it doesn't really make sense to reflect trait usage down
the class hierarchy because the same trait may be used more than once within a
class hierarchy.
—Claude