diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index 00421fd..1cc1ee2 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -7,7 +7,6 @@ jobs: phpstan: name: PHPStan runs-on: Ubuntu-20.04 - continue-on-error: true steps: - name: Checkout code @@ -40,7 +39,6 @@ jobs: php-cs-fixer: name: PHP-CS-Fixer runs-on: Ubuntu-20.04 - continue-on-error: true steps: - name: Checkout code @@ -73,7 +71,6 @@ jobs: psalm: name: Psalm runs-on: Ubuntu-20.04 - continue-on-error: true steps: - name: Checkout code @@ -106,7 +103,6 @@ jobs: composer-normalize: name: Composer Normalize runs-on: Ubuntu-20.04 - continue-on-error: true steps: - name: Set up PHP diff --git a/src/Issue/Issue.php b/src/Issue/Issue.php index fb59607..bdef6dc 100644 --- a/src/Issue/Issue.php +++ b/src/Issue/Issue.php @@ -77,7 +77,7 @@ public function getLocalLine(): int public function getErroredLine() { if (null === $this->erroredLine) { - $lines = explode(PHP_EOL, $this->node->getValue()); + $lines = explode("\n", $this->node->getValue()); // We do -1 because the $lines array is zero-index and the error message is 1-index $this->erroredLine = $lines[max(0, $this->localLine - 1)]; } diff --git a/src/Service/CodeNodeRunner.php b/src/Service/CodeNodeRunner.php index b69642c..ca9eb0f 100644 --- a/src/Service/CodeNodeRunner.php +++ b/src/Service/CodeNodeRunner.php @@ -70,12 +70,12 @@ private function warmupCache(CodeNode $node, IssueCollection $issues, string $ap return; } - $issues->addIssue(new Issue($node, trim($process->getErrorOutput()), 'Cache Warmup', $node->getEnvironment()->getCurrentFileName(), count(explode(PHP_EOL, $node->getValue())) - 1)); + $issues->addIssue(new Issue($node, trim($process->getErrorOutput()), 'Cache Warmup', $node->getEnvironment()->getCurrentFileName(), count(explode("\n", $node->getValue())) - 1)); } private function getFile(CodeNode $node): string { - $contents = explode(PHP_EOL, $node->getValue()); + $contents = explode("\n", $node->getValue()); $regex = match ($node->getLanguage()) { 'php' => '|^// ?([a-z1-9A-Z_\-/]+\.php)$|', 'yaml' => '|^# ?([a-z1-9A-Z_\-/]+\.yaml)$|', @@ -94,14 +94,14 @@ private function getNodeContents(CodeNode $node): string { $language = $node->getLanguage(); if ('php' === $language) { - return 'getValue(); + return 'getValue(); } if ('xml' === $language) { - $contents = explode(PHP_EOL, $node->getValue()); + $contents = explode("\n", $node->getValue()); unset($contents[0]); - return implode(PHP_EOL, $contents); + return implode("\n", $contents); } return $node->getValue(); diff --git a/src/Service/CodeValidator/PhpValidator.php b/src/Service/CodeValidator/PhpValidator.php index 159ec05..2855969 100644 --- a/src/Service/CodeValidator/PhpValidator.php +++ b/src/Service/CodeValidator/PhpValidator.php @@ -47,11 +47,11 @@ private function getContents(CodeNode $node, string $language): string } // Allow us to use "..." as a placeholder - $contents = str_replace('...', 'null', $contents); + $contents = str_replace(['...,', '...)', '...;'], ['null,', 'null)', 'null;'], $contents); - $lines = explode(PHP_EOL, $contents); + $lines = explode("\n", $contents); if (!str_contains($lines[0] ?? '', 'getCurrentDirectory(), $environment->getCurrentFileName()); - $contents = explode(PHP_EOL, file_get_contents($file)); - $codeBlock = explode(PHP_EOL, $node->getValue()); + $contents = explode("\n", file_get_contents($file)); + $codeBlock = explode("\n", $node->getValue()); foreach ($contents as $i => $line) { foreach ($codeBlock as $j => $needle) {