Skip to content

Commit 13c2a9a

Browse files
committed
Better formatting for the two commands to check for syntax errors
1 parent 9a2f67d commit 13c2a9a

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/Standards/Generic/Sniffs/PHP/SyntaxSniff.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,19 @@ private function getPhpLintCommand(File $phpcsFile)
8484
{
8585
if ($phpcsFile->getFilename() === 'STDIN') {
8686
$content = $phpcsFile->getTokensAsString(0, $phpcsFile->numTokens);
87-
return "echo ".escapeshellarg($content)." | ".Common::escapeshellcmd($this->phpPath)." -l -d display_errors=1 -d error_prepend_string='' 2>&1";
87+
return sprintf(
88+
"echo %s | %s -l -d display_errors=1 -d error_prepend_string='' 2>&1",
89+
escapeshellarg($content),
90+
Common::escapeshellcmd($this->phpPath)
91+
);
8892
}
8993

9094
$fileName = escapeshellarg($phpcsFile->getFilename());
91-
return Common::escapeshellcmd($this->phpPath)." -l -d display_errors=1 -d error_prepend_string='' $fileName 2>&1";
95+
return sprintf(
96+
"%s -l -d display_errors=1 -d error_prepend_string='' %s 2>&1",
97+
Common::escapeshellcmd($this->phpPath),
98+
$fileName
99+
);
92100

93101
}//end getPhpLintCommand()
94102

0 commit comments

Comments
 (0)