diff --git a/README.md b/README.md index cd3d339d..4b26d792 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ PHPLint ## Installation ```shell -$ composer require overtrue/phplint +$ composer require overtrue/phplint -vvv ``` ## Usage diff --git a/src/Linter.php b/src/Linter.php index 84eb7cc4..b5483a52 100644 --- a/src/Linter.php +++ b/src/Linter.php @@ -86,7 +86,7 @@ public function lint($files = []) $newCache = []; while (!empty($files) || !empty($running)) { - for ($i = count($running); $files && $i < $this->procLimit; ++$i) { + for ($i = count($running); !empty($files) && $i < $this->procLimit; ++$i) { $file = array_shift($files); $filename = $file->getRealpath(); @@ -139,18 +139,18 @@ public function setCache($cache = []) public function getFiles() { if (empty($this->files)) { - $this->files = new Finder(); - $this->files->files()->ignoreUnreadableDirs()->in(realpath($this->path)); + $finder = new Finder(); + $finder->files()->ignoreUnreadableDirs()->in(realpath($this->path)); foreach ($this->excludes as $exclude) { - $this->files->notPath($exclude); + $finder->notPath($exclude); } foreach ($this->extensions as $extension) { - $this->files->name('*.'.$extension); + $finder->name('*.'.$extension); } - $this->files = iterator_to_array($this->files); + $this->files = iterator_to_array($finder); } return $this->files;