Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@

namespace PHP_CodeSniffer;

use Composer\Autoload\ClassLoader;
use Exception;

if (class_exists('PHP_CodeSniffer\Autoload', false) === false) {
class Autoload
{
Expand Down Expand Up @@ -77,7 +80,7 @@ public static function load($class)
&& @file_exists(__DIR__.'/../../autoload.php') === true
) {
self::$composerAutoloader = include __DIR__.'/../../autoload.php';
if (self::$composerAutoloader instanceof \Composer\Autoload\ClassLoader) {
if (self::$composerAutoloader instanceof ClassLoader) {
self::$composerAutoloader->unregister();
self::$composerAutoloader->register();
} else {
Expand Down Expand Up @@ -282,7 +285,7 @@ public static function getSearchPaths()
public static function getLoadedClassName($path)
{
if (isset(self::$loadedClasses[$path]) === false) {
throw new \Exception("Cannot get class name for $path; file has not been included");
throw new Exception("Cannot get class name for $path; file has not been included");
}

return self::$loadedClasses[$path];
Expand All @@ -301,7 +304,7 @@ public static function getLoadedClassName($path)
public static function getLoadedFileName($class)
{
if (isset(self::$loadedFiles[$class]) === false) {
throw new \Exception("Cannot get file name for $class; class has not been included");
throw new Exception("Cannot get file name for $class; class has not been included");
}

return self::$loadedFiles[$class];
Expand Down
4 changes: 2 additions & 2 deletions scripts/build-phar.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ function stripWhitespaceAndComments($fullpath, $config)
$srcDir = realpath(__DIR__.'/../src');
$srcDirLen = strlen($srcDir);

$rdi = new \RecursiveDirectoryIterator($srcDir, \RecursiveDirectoryIterator::FOLLOW_SYMLINKS);
$di = new \RecursiveIteratorIterator($rdi, 0, \RecursiveIteratorIterator::CATCH_GET_CHILD);
$rdi = new RecursiveDirectoryIterator($srcDir, RecursiveDirectoryIterator::FOLLOW_SYMLINKS);
$di = new RecursiveIteratorIterator($rdi, 0, RecursiveIteratorIterator::CATCH_GET_CHILD);

$config = new Config();
$fileCount = 0;
Expand Down