@@ -286,6 +286,7 @@ public function getDefaults()
286
286
$ defaults ['errorSeverity ' ] = null ;
287
287
$ defaults ['warningSeverity ' ] = null ;
288
288
$ defaults ['stdin ' ] = null ;
289
+ $ defaults ['editorPath ' ] = null ;
289
290
290
291
$ reportFormat = PHP_CodeSniffer::getConfigData ('report_format ' );
291
292
if ($ reportFormat !== null ) {
@@ -722,6 +723,17 @@ public function processLongArgument($arg, $pos)
722
723
$ this ->values ['errorSeverity ' ] = (int ) substr ($ arg , 15 );
723
724
} else if (substr ($ arg , 0 , 17 ) === 'warning-severity= ' ) {
724
725
$ this ->values ['warningSeverity ' ] = (int ) substr ($ arg , 17 );
726
+ } else if (substr ($ arg , 0 , 12 ) === 'editor-path= ' ) {
727
+ $ value = substr ($ arg , 12 );
728
+ if (preg_match ('/^[ \'\"]/ ' , $ value , $ matches )) {
729
+ while (0 === preg_match ("/[ {$ matches [0 ]}]$/ " , $ value )) {
730
+ $ value .= ' ' .$ this ->_cliArgs [++$ pos ];
731
+ $ this ->_cliArgs [$ pos ] = '' ;
732
+ }
733
+ $ value = substr ($ value , 1 , -1 );
734
+ }
735
+
736
+ $ this ->values ['editorPath ' ] = $ value ;
725
737
} else if (substr ($ arg , 0 , 7 ) === 'ignore= ' ) {
726
738
// Split the ignore string on commas, unless the comma is escaped
727
739
// using 1 or 3 slashes (\, or \\\,).
@@ -865,6 +877,7 @@ public function process($values=array())
865
877
$ phpcs ->setTabWidth ($ values ['tabWidth ' ]);
866
878
$ phpcs ->setEncoding ($ values ['encoding ' ]);
867
879
$ phpcs ->setInteractive ($ values ['interactive ' ]);
880
+ $ phpcs ->setEditorPath ($ values ['editorPath ' ]);
868
881
869
882
// Set file extensions if they were specified. Otherwise,
870
883
// let PHP_CodeSniffer decide on the defaults.
@@ -1205,7 +1218,7 @@ public function printUsage()
1205
1218
*/
1206
1219
public function printPHPCSUsage ()
1207
1220
{
1208
- echo 'Usage: phpcs [-nwlsaepvi] [-d key[=value]] [--colors] [--no-colors] ' .PHP_EOL ;
1221
+ echo 'Usage: phpcs [-nwlsaepvi] [-d key[=value]] [--colors] [--no-colors] [--editor-path=<path>] ' .PHP_EOL ;
1209
1222
echo ' [--report=<report>] [--report-file=<reportFile>] [--report-<report>=<reportFile>] ... ' .PHP_EOL ;
1210
1223
echo ' [--report-width=<reportWidth>] [--generator=<generator>] [--tab-width=<tabWidth>] ' .PHP_EOL ;
1211
1224
echo ' [--severity=<severity>] [--error-severity=<severity>] [--warning-severity=<severity>] ' .PHP_EOL ;
0 commit comments