Skip to content

Commit ddcf00f

Browse files
authored
Merge pull request #349 from PHPCSStandards/feature/cs-cleanup-more-class-use
CS: always import all used classes [3]
2 parents 68a8a34 + 0ae8561 commit ddcf00f

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

autoload.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616

1717
namespace PHP_CodeSniffer;
1818

19+
use Composer\Autoload\ClassLoader;
20+
use Exception;
21+
1922
if (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];

scripts/build-phar.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ function stripWhitespaceAndComments($fullpath, $config)
107107
$srcDir = realpath(__DIR__.'/../src');
108108
$srcDirLen = strlen($srcDir);
109109

110-
$rdi = new \RecursiveDirectoryIterator($srcDir, \RecursiveDirectoryIterator::FOLLOW_SYMLINKS);
111-
$di = new \RecursiveIteratorIterator($rdi, 0, \RecursiveIteratorIterator::CATCH_GET_CHILD);
110+
$rdi = new RecursiveDirectoryIterator($srcDir, RecursiveDirectoryIterator::FOLLOW_SYMLINKS);
111+
$di = new RecursiveIteratorIterator($rdi, 0, RecursiveIteratorIterator::CATCH_GET_CHILD);
112112

113113
$config = new Config();
114114
$fileCount = 0;

0 commit comments

Comments
 (0)