diff --git a/src/Util/TemplateLinter.php b/src/Util/TemplateLinter.php index e7b83287c..0c1a6348f 100644 --- a/src/Util/TemplateLinter.php +++ b/src/Util/TemplateLinter.php @@ -56,18 +56,21 @@ public function lintPhpTemplate(string|array $templateFilePath): void $templateFilePath = [$templateFilePath]; } - foreach ($templateFilePath as $filePath) { - $cmdPrefix = $this->needsPhpCmdPrefix ? 'php ' : ''; - - if (str_contains(strtolower(\PHP_OS), 'win')) { - $process = Process::fromShellCommandline(sprintf('set PHP_CS_FIXER_IGNORE_ENV=1&%s%s --config=%s --using-cache=no fix %s', $cmdPrefix, $this->phpCsFixerBinaryPath, $this->phpCsFixerConfigPath, $filePath)); - } else { - $process = Process::fromShellCommandline(sprintf('PHP_CS_FIXER_IGNORE_ENV=1 %s%s --config=%s --using-cache=no fix %s', $cmdPrefix, $this->phpCsFixerBinaryPath, $this->phpCsFixerConfigPath, $filePath)); - } + $ignoreEnv = str_contains(strtolower(\PHP_OS), 'win') ? 'set PHP_CS_FIXER_IGNORE_ENV=1&' : 'PHP_CS_FIXER_IGNORE_ENV=1 '; - $stat = $process->run(); + $cmdPrefix = $this->needsPhpCmdPrefix ? 'php ' : ''; - dd($stat, ['output' => $process->getOutput(), 'err' => $process->getErrorOutput(), 'exit' => $process->getExitCode()]); + foreach ($templateFilePath as $filePath) { + Process::fromShellCommandline(sprintf( + '%s%s%s --config=%s --using-cache=no fix %s', + $ignoreEnv, + $cmdPrefix, + $this->phpCsFixerBinaryPath, + $this->phpCsFixerConfigPath, + $filePath + )) + ->run() + ; } } @@ -87,15 +90,12 @@ public function writeLinterMessage(OutputInterface $output): void ; $output->writeln([$fixerMessage, '']); // Empty string so we have an empty line - - dump(['fixer message' => $fixerMessage]); } private function setBinary(): void { // Use Bundled PHP-CS-Fixer if (null === $this->phpCsFixerBinaryPath) { - dump(['php-cs-fixer path' => $this->phpCsFixerBinaryPath]); $this->phpCsFixerBinaryPath = \dirname(__DIR__).'/Resources/bin/php-cs-fixer-v3.13.0.phar'; return; @@ -103,10 +103,6 @@ private function setBinary(): void // Path to PHP-CS-Fixer provided if (is_file($this->phpCsFixerBinaryPath)) { - dump(['is_file' => is_file($this->phpCsFixerBinaryPath), - 'is_executable' => (is_file($this->phpCsFixerBinaryPath) && is_executable($this->phpCsFixerBinaryPath)), - 'is_readable' => $this->phpCsFixerBinaryPath] - ); $this->usingBundledPhpCsFixer = false; return; @@ -115,7 +111,6 @@ private function setBinary(): void // PHP-CS-Fixer in the system path? if (null !== $path = (new ExecutableFinder())->find($this->phpCsFixerBinaryPath)) { $this->phpCsFixerBinaryPath = $path; - dump(['is in system path' => $this->phpCsFixerBinaryPath]); $this->needsPhpCmdPrefix = false; $this->usingBundledPhpCsFixer = false;