diff --git a/src/HeroAutoload.php b/src/HeroAutoload.php index 1f55c62c..08bfed4c 100644 --- a/src/HeroAutoload.php +++ b/src/HeroAutoload.php @@ -8,26 +8,24 @@ class HeroAutoload { - public static function handle(string $class) + public static function handle(string $classOrTraitOrInterface) { - if (\class_exists($class, false)) { - return; - } - $debugBacktrace = \debug_backtrace(); if ( isset($debugBacktrace[1]['function'], $debugBacktrace[2]['function']) && $debugBacktrace[1]['function'] === 'spl_autoload_call' && ( - $debugBacktrace[2]['function'] === 'class_exists' || $debugBacktrace[2]['function'] === 'interface_exists' + $debugBacktrace[2]['function'] === 'class_exists' || + $debugBacktrace[2]['function'] === 'trait_exists' || + $debugBacktrace[2]['function'] === 'interface_exists' ) ) { return; } throw new RuntimeException(sprintf( - 'class %s not found', - $class + 'class or trait or interface %s not found', + $classOrTraitOrInterface )); } } \ No newline at end of file