From ced67101283a77642dc67b857fcbc340f95a7140 Mon Sep 17 00:00:00 2001 From: Ivan Shcherbak Date: Thu, 6 Dec 2018 08:07:50 +0200 Subject: [PATCH] Store file information in the cache with correct --- src/Linter.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Linter.php b/src/Linter.php index 23cb96bd..6679d67b 100644 --- a/src/Linter.php +++ b/src/Linter.php @@ -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]; } } @@ -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']); } }