trait_uses_recursive example


    function class_uses_recursive($class)
    {
        if (is_object($class)) {
            $class = get_class($class);
        }

        $results = [];

        foreach (array_reverse(class_parents($class)) + [$class => $class] as $class) {
            $results += trait_uses_recursive($class);
        }

        return array_unique($results);
    }
}

if (function_exists('trait_uses_recursive')) {
    /** * Returns all traits used by a trait and its traits. * * @param string $trait * * @return array * * @codeCoverageIgnore */
Home | Imprint | This part of the site doesn't use cookies.