File tree 1 file changed +12
-0
lines changed
1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -262,6 +262,13 @@ public static function autoload($className)
262
262
} else if (is_file (dirname (__FILE__ ).'/CodeSniffer/Standards/ ' .$ path ) === true ) {
263
263
// Check for included sniffs.
264
264
include dirname (__FILE__ ).'/CodeSniffer/Standards/ ' .$ path ;
265
+ } else if (!empty ($ GLOBALS ['phpcs ' ])
266
+ && ($ values = $ GLOBALS ['phpcs ' ]->getCommandLineValues ())
267
+ && !empty ($ values ['standard ' ])
268
+ && is_file (dirname ($ values ['standard ' ]).'/ ' .$ path ) === true
269
+ ) {
270
+ // Check if this is a CLI run and the standard dir parameter is set.
271
+ include dirname ($ values ['standard ' ]).'/ ' .$ path ;
265
272
} else {
266
273
// Everything else.
267
274
@include $ path ;
@@ -796,6 +803,11 @@ private function _expandRulesetReference($sniff)
796
803
797
804
$ path = $ parts [0 ].'/Sniffs/ ' .$ parts [1 ].'/ ' .$ parts [2 ].'Sniff.php ' ;
798
805
$ path = realpath (dirname (__FILE__ ).'/CodeSniffer/Standards/ ' .$ path );
806
+
807
+ // Check if the standardDir parameter is set.
808
+ if (!$ path && !empty ($ this ->standardDir )) {
809
+ $ path = realpath ($ this ->standardDir .'/Sniffs/ ' .$ parts [1 ].'/ ' .$ parts [2 ].'Sniff.php ' );
810
+ }
799
811
}
800
812
}//end if
801
813
You can’t perform that action at this time.
0 commit comments