public static function classInheritance($object){

        $class = new ReflectionClass($object);
        $classNames = [$class->getName()];

        while($class = $class->getParentClass()){
            $classNames[] = $class->getName();
        }

        return $classNames;

    }
public static function classInheritance($object){

        $class = new ReflectionClass($object);
        $classNames = [$class->getName()];

        while($class = $class->getParentClass()){
            $classNames[] = $class->getName();
        }

        return $classNames;

    }
public static function classInheritance ( $ object ) { $ class = new ReflectionClass ( $ object ) ; $ classNames = [ $ class -> getName ( ) ] ; while ( $ class = $ class -> getParentClass ( ) ) { $ classNames [ ] = $ class -> getName ( ) ; } return $ classNames ; }
Returns an array of the classname and all parent class names of
the passed class or object

@param object|string $object
@return array
Returns an array of the classname and all parent class names of the passed class or object