@@ -392,26 +392,13 @@ public function process()
392
392
} else if (substr ($ commentTextLower , 0 , 9 ) === 'phpcs:set '
393
393
|| substr ($ commentTextLower , 0 , 10 ) === '@phpcs:set '
394
394
) {
395
- // If the @phpcs: syntax is being used, strip the @ to make
396
- // comparisons easier.
397
- if ($ commentText [0 ] === '@ ' ) {
398
- $ commentText = substr ($ commentText , 1 );
399
- }
400
-
401
- // Need to maintain case here, to get the correct sniff code.
402
- $ parts = explode (' ' , substr ($ commentText , 10 ));
403
- if (count ($ parts ) >= 2 ) {
404
- $ sniffParts = explode ('. ' , $ parts [0 ]);
405
- if (count ($ sniffParts ) >= 3 ) {
406
- // If the sniff code is not known to us, it has not been registered in this run.
407
- // But don't throw an error as it could be there for a different standard to use.
408
- if (isset ($ this ->ruleset ->sniffCodes [$ parts [0 ]]) === true ) {
409
- $ listenerCode = array_shift ($ parts );
410
- $ propertyCode = array_shift ($ parts );
411
- $ propertyValue = rtrim (implode (' ' , $ parts ), " */ \r\n" );
412
- $ listenerClass = $ this ->ruleset ->sniffCodes [$ listenerCode ];
413
- $ this ->ruleset ->setSniffProperty ($ listenerClass , $ propertyCode , $ propertyValue );
414
- }
395
+ if (isset ($ token ['sniffCode ' ]) === true ) {
396
+ $ listenerCode = $ token ['sniffCode ' ];
397
+ if (isset ($ this ->ruleset ->sniffCodes [$ listenerCode ]) === true ) {
398
+ $ propertyCode = $ token ['sniffProperty ' ];
399
+ $ propertyValue = $ token ['sniffPropertyValue ' ];
400
+ $ listenerClass = $ this ->ruleset ->sniffCodes [$ listenerCode ];
401
+ $ this ->ruleset ->setSniffProperty ($ listenerClass , $ propertyCode , $ propertyValue );
415
402
}
416
403
}
417
404
}//end if
0 commit comments