Skip to content

Commit

Permalink
Fixed broken change. #56
Browse files Browse the repository at this point in the history
  • Loading branch information
overtrue committed Jan 4, 2019
1 parent 6fd4d10 commit dab0415
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions src/Linter.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,14 @@ 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) {
$file = array_shift($files);
$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,
Expand Down Expand Up @@ -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);
}
}

0 comments on commit dab0415

Please sign in to comment.