16
16
17
17
namespace PHP_CodeSniffer ;
18
18
19
+ use Composer \Autoload \ClassLoader ;
20
+ use Exception ;
21
+
19
22
if (class_exists ('PHP_CodeSniffer\Autoload ' , false ) === false ) {
20
23
class Autoload
21
24
{
@@ -77,7 +80,7 @@ public static function load($class)
77
80
&& @file_exists (__DIR__ .'/../../autoload.php ' ) === true
78
81
) {
79
82
self ::$ composerAutoloader = include __DIR__ .'/../../autoload.php ' ;
80
- if (self ::$ composerAutoloader instanceof \ Composer \ Autoload \ ClassLoader) {
83
+ if (self ::$ composerAutoloader instanceof ClassLoader) {
81
84
self ::$ composerAutoloader ->unregister ();
82
85
self ::$ composerAutoloader ->register ();
83
86
} else {
@@ -282,7 +285,7 @@ public static function getSearchPaths()
282
285
public static function getLoadedClassName ($ path )
283
286
{
284
287
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 " );
286
289
}
287
290
288
291
return self ::$ loadedClasses [$ path ];
@@ -301,7 +304,7 @@ public static function getLoadedClassName($path)
301
304
public static function getLoadedFileName ($ class )
302
305
{
303
306
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 " );
305
308
}
306
309
307
310
return self ::$ loadedFiles [$ class ];
0 commit comments