@@ -286,6 +286,7 @@ public function getDefaults()
286286 $ defaults ['errorSeverity ' ] = null ;
287287 $ defaults ['warningSeverity ' ] = null ;
288288 $ defaults ['stdin ' ] = null ;
289+ $ defaults ['stdinPath ' ] = '' ;
289290
290291 $ reportFormat = PHP_CodeSniffer::getConfigData ('report_format ' );
291292 if ($ reportFormat !== null ) {
@@ -640,6 +641,13 @@ public function processLongArgument($arg, $pos)
640641
641642 $ this ->values ['bootstrap ' ][] = $ path ;
642643 }
644+ } else if (substr ($ arg , 0 , 11 ) === 'stdin-path= ' ) {
645+ $ this ->values ['stdinPath ' ] = PHP_CodeSniffer::realpath (substr ($ arg , 11 ));
646+
647+ // It may not exist and return false instead, so just use whatever they gave us.
648+ if ($ this ->values ['stdinPath ' ] === false ) {
649+ $ this ->values ['stdinPath ' ] = trim (substr ($ arg , 11 ));
650+ }
643651 } else if (substr ($ arg , 0 , 12 ) === 'report-file= ' ) {
644652 $ this ->values ['reportFile ' ] = PHP_CodeSniffer::realpath (substr ($ arg , 12 ));
645653
@@ -1205,7 +1213,7 @@ public function printUsage()
12051213 */
12061214 public function printPHPCSUsage ()
12071215 {
1208- echo 'Usage: phpcs [-nwlsaepvi] [-d key[=value]] [--colors] [--no-colors] ' .PHP_EOL ;
1216+ echo 'Usage: phpcs [-nwlsaepvi] [-d key[=value]] [--colors] [--no-colors] [--stdin-path=<stdinPath>] ' .PHP_EOL ;
12091217 echo ' [--report=<report>] [--report-file=<reportFile>] [--report-<report>=<reportFile>] ... ' .PHP_EOL ;
12101218 echo ' [--report-width=<reportWidth>] [--generator=<generator>] [--tab-width=<tabWidth>] ' .PHP_EOL ;
12111219 echo ' [--severity=<severity>] [--error-severity=<severity>] [--warning-severity=<severity>] ' .PHP_EOL ;
@@ -1228,6 +1236,7 @@ public function printPHPCSUsage()
12281236 echo ' --colors Use colors in output ' .PHP_EOL ;
12291237 echo ' --no-colors Do not use colors in output (this is the default) ' .PHP_EOL ;
12301238 echo ' <file> One or more files and/or directories to check ' .PHP_EOL ;
1239+ echo ' <stdinPath> If processing STDIN, the file path that STDIN will be processed as ' .PHP_EOL ;
12311240 echo ' <bootstrap> A comma separated list of files to run before processing starts ' .PHP_EOL ;
12321241 echo ' <encoding> The encoding of the files being checked (default is iso-8859-1) ' .PHP_EOL ;
12331242 echo ' <extensions> A comma separated list of file extensions to check ' .PHP_EOL ;
@@ -1260,7 +1269,7 @@ public function printPHPCSUsage()
12601269 */
12611270 public function printPHPCBFUsage ()
12621271 {
1263- echo 'Usage: phpcbf [-nwli] [-d key[=value]] ' .PHP_EOL ;
1272+ echo 'Usage: phpcbf [-nwli] [-d key[=value]] [--stdin-path=<stdinPath>] ' .PHP_EOL ;
12641273 echo ' [--standard=<standard>] [--sniffs=<sniffs>] [--suffix=<suffix>] ' .PHP_EOL ;
12651274 echo ' [--severity=<severity>] [--error-severity=<severity>] [--warning-severity=<severity>] ' .PHP_EOL ;
12661275 echo ' [--tab-width=<tabWidth>] [--encoding=<encoding>] ' .PHP_EOL ;
@@ -1274,6 +1283,7 @@ public function printPHPCBFUsage()
12741283 echo ' --version Print version information ' .PHP_EOL ;
12751284 echo ' --no-patch Do not make use of the "diff" or "patch" programs ' .PHP_EOL ;
12761285 echo ' <file> One or more files and/or directories to fix ' .PHP_EOL ;
1286+ echo ' <stdinPath> If processing STDIN, the file path that STDIN will be processed as ' .PHP_EOL ;
12771287 echo ' <bootstrap> A comma separated list of files to run before processing starts ' .PHP_EOL ;
12781288 echo ' <encoding> The encoding of the files being fixed (default is iso-8859-1) ' .PHP_EOL ;
12791289 echo ' <extensions> A comma separated list of file extensions to fix ' .PHP_EOL ;
0 commit comments