Skip to content

Commit

Permalink
Merge pull request #52 from funivan/patch-1
Browse files Browse the repository at this point in the history
Use relative file path as the cache key
  • Loading branch information
overtrue authored Nov 12, 2018
2 parents 5c22aec + ae451d2 commit c91bfe0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Linter.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,16 @@ public function lint($files = [], $cache = true)
for ($i = count($running); !empty($files) && $i < $this->processLimit; ++$i) {
$file = array_shift($files);
$filename = $file->getRealPath();

if (!isset($this->cache[$filename]) || $this->cache[$filename] !== md5_file($filename)) {
$key = $file->getRelativePathname();
if (!isset($this->cache[$key]) || $this->cache[$key] !== md5_file($filename)) {
$lint = new Lint(escapeshellcmd($phpbin).' -d error_reporting=E_ALL -d display_errors=On -l '.escapeshellarg($filename));
$running[$filename] = [
$running[$key] = [
'process' => $lint,
'file' => $file,
];
$lint->start();
} else {
$newCache[$filename] = $this->cache[$filename];
$newCache[$key] = $this->cache[$key];
}
}

Expand Down

0 comments on commit c91bfe0

Please sign in to comment.