diff --git a/src/Util/TemplateLinter.php b/src/Util/TemplateLinter.php index 74707ef07..92245d8ab 100644 --- a/src/Util/TemplateLinter.php +++ b/src/Util/TemplateLinter.php @@ -56,12 +56,21 @@ public function lintPhpTemplate(string|array $templateFilePath): void $templateFilePath = [$templateFilePath]; } - foreach ($templateFilePath as $filePath) { - $cmdPrefix = $this->needsPhpCmdPrefix ? 'php ' : ''; + $ignoreEnv = str_contains(strtolower(\PHP_OS), 'win') ? 'set PHP_CS_FIXER_IGNORE_ENV=1&' : 'PHP_CS_FIXER_IGNORE_ENV=1 '; - $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)); + $cmdPrefix = $this->needsPhpCmdPrefix ? 'php ' : ''; - $process->run(); + 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() + ; } }