1616
1717namespace PHP_CodeSniffer ;
1818
19+ use Composer \Autoload \ClassLoader ;
20+ use Exception ;
21+
1922if (class_exists ('PHP_CodeSniffer\Autoload ' , false ) === false ) {
2023 class Autoload
2124 {
@@ -77,7 +80,7 @@ public static function load($class)
7780 && @file_exists (__DIR__ .'/../../autoload.php ' ) === true
7881 ) {
7982 self ::$ composerAutoloader = include __DIR__ .'/../../autoload.php ' ;
80- if (self ::$ composerAutoloader instanceof \ Composer \ Autoload \ ClassLoader) {
83+ if (self ::$ composerAutoloader instanceof ClassLoader) {
8184 self ::$ composerAutoloader ->unregister ();
8285 self ::$ composerAutoloader ->register ();
8386 } else {
@@ -282,7 +285,7 @@ public static function getSearchPaths()
282285 public static function getLoadedClassName ($ path )
283286 {
284287 if (isset (self ::$ loadedClasses [$ path ]) === false ) {
285- throw new \ Exception ("Cannot get class name for $ path; file has not been included " );
288+ throw new Exception ("Cannot get class name for $ path; file has not been included " );
286289 }
287290
288291 return self ::$ loadedClasses [$ path ];
@@ -301,7 +304,7 @@ public static function getLoadedClassName($path)
301304 public static function getLoadedFileName ($ class )
302305 {
303306 if (isset (self ::$ loadedFiles [$ class ]) === false ) {
304- throw new \ Exception ("Cannot get file name for $ class; class has not been included " );
307+ throw new Exception ("Cannot get file name for $ class; class has not been included " );
305308 }
306309
307310 return self ::$ loadedFiles [$ class ];
0 commit comments