Skip to content

Commit

Permalink
Merge branch 'feature/caching-file-hash-minor-efficiency-tweak' of ht…
Browse files Browse the repository at this point in the history
  • Loading branch information
gsherwood committed Nov 2, 2020
2 parents 178d957 + 15ddd84 commit f117e81
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/Util/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,22 +95,25 @@ public static function load(Ruleset $ruleset, Config $config)
// hash. This ensures that core PHPCS changes will also invalidate the cache.
// Note that we ignore sniffs here, and any files that don't affect
// the outcome of the run.
$di = new \RecursiveDirectoryIterator($installDir);
$di = new \RecursiveDirectoryIterator(
$installDir,
(\FilesystemIterator::KEY_AS_PATHNAME | \FilesystemIterator::CURRENT_AS_FILEINFO | \FilesystemIterator::SKIP_DOTS)
);
$filter = new \RecursiveCallbackFilterIterator(
$di,
function ($file, $key, $iterator) {
// Skip hidden files.
// Skip non-php files.
$filename = $file->getFilename();
if (substr($filename, 0, 1) === '.') {
if ($file->isFile() === true && substr($filename, -4) !== '.php') {
return false;
}

$filePath = Common::realpath($file->getPathname());
$filePath = Common::realpath($key);
if ($filePath === false) {
return false;
}

if (is_dir($filePath) === true
if ($iterator->hasChildren() === true
&& ($filename === 'Standards'
|| $filename === 'Exceptions'
|| $filename === 'Reports'
Expand Down

0 comments on commit f117e81

Please sign in to comment.