diff --git a/bin/skip-linting.php b/bin/skip-linting.php index fb81737..50ba37c 100644 --- a/bin/skip-linting.php +++ b/bin/skip-linting.php @@ -9,6 +9,12 @@ $f = @fopen($file, 'r'); if ($f) { $firstLine = fgets($f); + + // ignore shebang line + if (strpos($firstLine, '#!') === 0) { + $firstLine = fgets($f); + } + @fclose($f); if (preg_match('~assertSame(0, count($result->getErrors())); } + public function testSkipShebang() + { + $parallelLint = new ParallelLint($this->getPhpExecutable()); + $result = $parallelLint->lint(array(PL_TESTROOT . '/fixtures/fixture-07/example.php')); + + $this->assertSame(0, $result->getCheckedFilesCount()); + $this->assertSame(0, $result->getFilesWithSyntaxErrorCount()); + $this->assertSame(1, $result->getSkippedFilesCount()); + } + public function testInvalidFile() { $parallelLint = new ParallelLint($this->getPhpExecutable()); diff --git a/tests/fixtures/fixture-07/example.php b/tests/fixtures/fixture-07/example.php new file mode 100644 index 0000000..a1f4e99 --- /dev/null +++ b/tests/fixtures/fixture-07/example.php @@ -0,0 +1,5 @@ +#!/usr/bin/php +