We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7140eda commit 95c0a75Copy full SHA for 95c0a75
src/Trait/ComparableTrait.php
@@ -92,6 +92,13 @@ final public static function hasComparableTrait(object $object): bool
92
$reflectionClass = $object instanceof \ReflectionClass ?
93
$object :
94
(new \ReflectionClass($object));
95
+ $traits = $reflectionClass->getTraits();
96
+
97
+ while ($ancestor = $reflectionClass->getParentClass()) {
98
+ $traits = array_merge($traits, $ancestor->getTraits());
99
+ }
100
101
+ $traits = array_unique($traits);
102
103
return isset($reflectionClass->getTraits()[ComparableTrait::class]);
104
}
0 commit comments