From dab041512195a6bf52401a66b65dc5b19e4d09ea Mon Sep 17 00:00:00 2001 From: overtrue Date: Fri, 4 Jan 2019 20:59:53 +0800 Subject: [PATCH] Fixed broken change. #56 --- src/Linter.php | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/Linter.php b/src/Linter.php index 03044d0f..6397eea5 100644 --- a/src/Linter.php +++ b/src/Linter.php @@ -90,7 +90,6 @@ public function lint($files = [], $cache = true) $errors = []; $running = []; $newCache = []; - $phpbin = PHP_SAPI == 'cli' ? PHP_BINARY : PHP_BINDIR.'/php'; while (!empty($files) || !empty($running)) { for ($i = count($running); !empty($files) && $i < $this->processLimit; ++$i) { @@ -98,7 +97,7 @@ public function lint($files = [], $cache = true) $filename = $file->getRealPath(); $relativePathname = $file->getRelativePathname(); if (!isset($this->cache[$relativePathname]) || $this->cache[$relativePathname] !== md5_file($filename)) { - $lint = Lint::fromShellCommandline(escapeshellcmd($phpbin).' -d error_reporting=E_ALL -d display_errors=On -l '.escapeshellarg($filename)); + $lint = $this->createLintProcess($filename); $running[$filename] = [ 'process' => $lint, 'file' => $file, @@ -241,4 +240,21 @@ public function setProcessLimit($processLimit) return $this; } + + /** + * @param string $filename + * + * @return mixed + */ + protected function createLintProcess($filename) + { + $command = [ + PHP_SAPI == 'cli' ? PHP_BINARY : PHP_BINDIR.'/php', + '-d error_reporting=E_ALL', + '-d display_errors=On', + '-l', $filename, + ]; + + return new Lint($command); + } }