Skip to content

Commit

Permalink
Store file information in the cache with correct
Browse files Browse the repository at this point in the history
  • Loading branch information
funivan committed Dec 6, 2018
1 parent 60b3dfa commit ced6710
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Linter.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,17 @@ public function lint($files = [], $cache = true)
for ($i = count($running); !empty($files) && $i < $this->processLimit; ++$i) {
$file = array_shift($files);
$filename = $file->getRealPath();
$key = $file->getRelativePathname();
if (!isset($this->cache[$key]) || $this->cache[$key] !== md5_file($filename)) {
$relativePathname = $file->getRelativePathname();
if (!isset($this->cache[$relativePathname]) || $this->cache[$relativePathname] !== md5_file($filename)) {
$lint = new Lint(escapeshellcmd($phpbin).' -d error_reporting=E_ALL -d display_errors=On -l '.escapeshellarg($filename));
$running[$filename] = [
'process' => $lint,
'file' => $file,
'relativePath' => $relativePathname,
];
$lint->start();
} else {
$newCache[$key] = $this->cache[$key];
$newCache[$relativePathname] = $this->cache[$relativePathname];
}
}

Expand All @@ -121,7 +122,7 @@ public function lint($files = [], $cache = true)
$processCallback('error', $item['file']);
$errors[$filename] = array_merge(['file' => $filename], $lint->getSyntaxError());
} else {
$newCache[$filename] = md5_file($filename);
$newCache[$item['relativePath']] = md5_file($filename);
$processCallback('ok', $item['file']);
}
}
Expand Down

0 comments on commit ced6710

Please sign in to comment.