Difference between revisions of "PHP/ReflectionClass/getParentClass"

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
< PHP
Jump to navigation Jump to search
(Created page with "{{fmt/title|ReflectionClass::getParentClass()}} As of 2023-04-14 [https://www.php.net/manual/en/reflectionclass.getparentclass.php the official documentation] says {{fmt/quote...")
 
 
Line 2: Line 2:
 
As of 2023-04-14 [https://www.php.net/manual/en/reflectionclass.getparentclass.php the official documentation] says {{fmt/quote|This function is currently not documented; only its argument list is available.}}, so we have to kind of reverse-engineer how it actually behaves.
 
As of 2023-04-14 [https://www.php.net/manual/en/reflectionclass.getparentclass.php the official documentation] says {{fmt/quote|This function is currently not documented; only its argument list is available.}}, so we have to kind of reverse-engineer how it actually behaves.
 
==Trait Objects==
 
==Trait Objects==
Tentatively, a trait used by another trait is not counted as a "parent class"; you have to look at <code>$oTrait->getTraits()</code>.
+
Tentatively, a trait used by another trait is not counted as a "parent class"; you have to look at [https://www.php.net/manual/en/reflectionclass.gettraits.php <tt>$oTrait->getTraits()</tt>]. This makes sense since [https://www.php.net/manual/en/reflectionclass.getparentclass.php <tt>getParentClass()</tt>] returns only one item, whereas a trait may [[PHP/trait/use|use]] more than one "parent" trait.

Latest revision as of 16:41, 14 April 2023

ReflectionClass::getParentClass()

As of 2023-04-14 the official documentation says «This function is currently not documented; only its argument list is available.», so we have to kind of reverse-engineer how it actually behaves.

Trait Objects

Tentatively, a trait used by another trait is not counted as a "parent class"; you have to look at $oTrait->getTraits(). This makes sense since getParentClass() returns only one item, whereas a trait may use more than one "parent" trait.