@@ -286,6 +286,7 @@ public function getDefaults()
286
286
$ defaults ['errorSeverity ' ] = null ;
287
287
$ defaults ['warningSeverity ' ] = null ;
288
288
$ defaults ['stdin ' ] = null ;
289
+ $ defaults ['stdinPath ' ] = '' ;
289
290
290
291
$ reportFormat = PHP_CodeSniffer::getConfigData ('report_format ' );
291
292
if ($ reportFormat !== null ) {
@@ -640,6 +641,13 @@ public function processLongArgument($arg, $pos)
640
641
641
642
$ this ->values ['bootstrap ' ][] = $ path ;
642
643
}
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
+ }
643
651
} else if (substr ($ arg , 0 , 12 ) === 'report-file= ' ) {
644
652
$ this ->values ['reportFile ' ] = PHP_CodeSniffer::realpath (substr ($ arg , 12 ));
645
653
@@ -1205,7 +1213,7 @@ public function printUsage()
1205
1213
*/
1206
1214
public function printPHPCSUsage ()
1207
1215
{
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 ;
1209
1217
echo ' [--report=<report>] [--report-file=<reportFile>] [--report-<report>=<reportFile>] ... ' .PHP_EOL ;
1210
1218
echo ' [--report-width=<reportWidth>] [--generator=<generator>] [--tab-width=<tabWidth>] ' .PHP_EOL ;
1211
1219
echo ' [--severity=<severity>] [--error-severity=<severity>] [--warning-severity=<severity>] ' .PHP_EOL ;
@@ -1228,6 +1236,7 @@ public function printPHPCSUsage()
1228
1236
echo ' --colors Use colors in output ' .PHP_EOL ;
1229
1237
echo ' --no-colors Do not use colors in output (this is the default) ' .PHP_EOL ;
1230
1238
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 ;
1231
1240
echo ' <bootstrap> A comma separated list of files to run before processing starts ' .PHP_EOL ;
1232
1241
echo ' <encoding> The encoding of the files being checked (default is iso-8859-1) ' .PHP_EOL ;
1233
1242
echo ' <extensions> A comma separated list of file extensions to check ' .PHP_EOL ;
@@ -1260,7 +1269,7 @@ public function printPHPCSUsage()
1260
1269
*/
1261
1270
public function printPHPCBFUsage ()
1262
1271
{
1263
- echo 'Usage: phpcbf [-nwli] [-d key[=value]] ' .PHP_EOL ;
1272
+ echo 'Usage: phpcbf [-nwli] [-d key[=value]] [--stdin-path=<stdinPath>] ' .PHP_EOL ;
1264
1273
echo ' [--standard=<standard>] [--sniffs=<sniffs>] [--suffix=<suffix>] ' .PHP_EOL ;
1265
1274
echo ' [--severity=<severity>] [--error-severity=<severity>] [--warning-severity=<severity>] ' .PHP_EOL ;
1266
1275
echo ' [--tab-width=<tabWidth>] [--encoding=<encoding>] ' .PHP_EOL ;
@@ -1274,6 +1283,7 @@ public function printPHPCBFUsage()
1274
1283
echo ' --version Print version information ' .PHP_EOL ;
1275
1284
echo ' --no-patch Do not make use of the "diff" or "patch" programs ' .PHP_EOL ;
1276
1285
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 ;
1277
1287
echo ' <bootstrap> A comma separated list of files to run before processing starts ' .PHP_EOL ;
1278
1288
echo ' <encoding> The encoding of the files being fixed (default is iso-8859-1) ' .PHP_EOL ;
1279
1289
echo ' <extensions> A comma separated list of file extensions to fix ' .PHP_EOL ;
0 commit comments