@@ -442,30 +442,11 @@ public function process()
442442 continue ;
443443 }
444444
445- // If the file path matches one of our ignore patterns, skip it.
446- // While there is support for a type of each pattern
447- // (absolute or relative) we don't actually support it here.
448- foreach ($ listenerData ['ignore ' ] as $ pattern ) {
449- // We assume a / directory separator, as do the exclude rules
450- // most developers write, so we need a special case for any system
451- // that is different.
452- if (DIRECTORY_SEPARATOR === '\\' ) {
453- $ pattern = str_replace ('/ ' , '\\\\' , $ pattern );
454- }
455-
456- $ pattern = '` ' .$ pattern .'`i ' ;
457- if (preg_match ($ pattern , $ this ->path ) === 1 ) {
458- $ this ->ignoredListeners [$ class ] = true ;
459- continue (2 );
460- }
461- }
462-
463- // If the file path does not match one of our include patterns, skip it.
464- // While there is support for a type of each pattern
465- // (absolute or relative) we don't actually support it here.
466- if (empty ($ listenerData ['include ' ]) === false ) {
467- $ included = false ;
468- foreach ($ listenerData ['include ' ] as $ pattern ) {
445+ if (trim ($ this ->path , '\'" ' ) !== 'STDIN ' ) {
446+ // If the file path matches one of our ignore patterns, skip it.
447+ // While there is support for a type of each pattern
448+ // (absolute or relative) we don't actually support it here.
449+ foreach ($ listenerData ['ignore ' ] as $ pattern ) {
469450 // We assume a / directory separator, as do the exclude rules
470451 // most developers write, so we need a special case for any system
471452 // that is different.
@@ -475,15 +456,36 @@ public function process()
475456
476457 $ pattern = '` ' .$ pattern .'`i ' ;
477458 if (preg_match ($ pattern , $ this ->path ) === 1 ) {
478- $ included = true ;
479- break ;
459+ $ this -> ignoredListeners [ $ class ] = true ;
460+ continue ( 2 ) ;
480461 }
481462 }
482463
483- if ($ included === false ) {
484- $ this ->ignoredListeners [$ class ] = true ;
485- continue ;
486- }
464+ // If the file path does not match one of our include patterns, skip it.
465+ // While there is support for a type of each pattern
466+ // (absolute or relative) we don't actually support it here.
467+ if (empty ($ listenerData ['include ' ]) === false ) {
468+ $ included = false ;
469+ foreach ($ listenerData ['include ' ] as $ pattern ) {
470+ // We assume a / directory separator, as do the exclude rules
471+ // most developers write, so we need a special case for any system
472+ // that is different.
473+ if (DIRECTORY_SEPARATOR === '\\' ) {
474+ $ pattern = str_replace ('/ ' , '\\\\' , $ pattern );
475+ }
476+
477+ $ pattern = '` ' .$ pattern .'`i ' ;
478+ if (preg_match ($ pattern , $ this ->path ) === 1 ) {
479+ $ included = true ;
480+ break ;
481+ }
482+ }
483+
484+ if ($ included === false ) {
485+ $ this ->ignoredListeners [$ class ] = true ;
486+ continue ;
487+ }
488+ }//end if
487489 }//end if
488490
489491 $ this ->activeListener = $ class ;
@@ -965,59 +967,63 @@ protected function addMessage($error, $message, $line, $column, $code, $data, $s
965967
966968 // Make sure we are not ignoring this file.
967969 $ included = null ;
968- foreach ($ checkCodes as $ checkCode ) {
969- $ patterns = null ;
970-
971- if (isset ($ this ->configCache ['includePatterns ' ][$ checkCode ]) === true ) {
972- $ patterns = $ this ->configCache ['includePatterns ' ][$ checkCode ];
973- $ excluding = false ;
974- } else if (isset ($ this ->configCache ['ignorePatterns ' ][$ checkCode ]) === true ) {
975- $ patterns = $ this ->configCache ['ignorePatterns ' ][$ checkCode ];
976- $ excluding = true ;
977- }
978-
979- if ($ patterns === null ) {
980- continue ;
981- }
970+ if (trim ($ this ->path , '\'" ' ) === 'STDIN ' ) {
971+ $ included = true ;
972+ } else {
973+ foreach ($ checkCodes as $ checkCode ) {
974+ $ patterns = null ;
975+
976+ if (isset ($ this ->configCache ['includePatterns ' ][$ checkCode ]) === true ) {
977+ $ patterns = $ this ->configCache ['includePatterns ' ][$ checkCode ];
978+ $ excluding = false ;
979+ } else if (isset ($ this ->configCache ['ignorePatterns ' ][$ checkCode ]) === true ) {
980+ $ patterns = $ this ->configCache ['ignorePatterns ' ][$ checkCode ];
981+ $ excluding = true ;
982+ }
982983
983- foreach ($ patterns as $ pattern => $ type ) {
984- // While there is support for a type of each pattern
985- // (absolute or relative) we don't actually support it here.
986- $ replacements = [
987- '\\, ' => ', ' ,
988- '* ' => '.* ' ,
989- ];
990-
991- // We assume a / directory separator, as do the exclude rules
992- // most developers write, so we need a special case for any system
993- // that is different.
994- if (DIRECTORY_SEPARATOR === '\\' ) {
995- $ replacements ['/ ' ] = '\\\\' ;
984+ if ($ patterns === null ) {
985+ continue ;
996986 }
997987
998- $ pattern = '` ' .strtr ($ pattern , $ replacements ).'`i ' ;
999- $ matched = preg_match ($ pattern , $ this ->path );
988+ foreach ($ patterns as $ pattern => $ type ) {
989+ // While there is support for a type of each pattern
990+ // (absolute or relative) we don't actually support it here.
991+ $ replacements = [
992+ '\\, ' => ', ' ,
993+ '* ' => '.* ' ,
994+ ];
1000995
1001- if ($ matched === 0 ) {
1002- if ($ excluding === false && $ included === null ) {
1003- // This file path is not being included.
1004- $ included = false ;
996+ // We assume a / directory separator, as do the exclude rules
997+ // most developers write, so we need a special case for any system
998+ // that is different.
999+ if (DIRECTORY_SEPARATOR === '\\' ) {
1000+ $ replacements ['/ ' ] = '\\\\' ;
10051001 }
10061002
1007- continue ;
1008- }
1003+ $ pattern = ' ` ' . strtr ( $ pattern , $ replacements ). ' `i ' ;
1004+ $ matched = preg_match ( $ pattern , $ this -> path );
10091005
1010- if ($ excluding === true ) {
1011- // This file path is being excluded.
1012- $ this -> ignoredCodes [ $ checkCode ] = true ;
1013- return false ;
1014- }
1006+ if ($ matched === 0 ) {
1007+ if ( $ excluding === false && $ included === null ) {
1008+ // This file path is not being included.
1009+ $ included = false ;
1010+ }
10151011
1016- // This file path is being included.
1017- $ included = true ;
1018- break ;
1012+ continue ;
1013+ }
1014+
1015+ if ($ excluding === true ) {
1016+ // This file path is being excluded.
1017+ $ this ->ignoredCodes [$ checkCode ] = true ;
1018+ return false ;
1019+ }
1020+
1021+ // This file path is being included.
1022+ $ included = true ;
1023+ break ;
1024+ }//end foreach
10191025 }//end foreach
1020- }//end foreach
1026+ }//end if
10211027
10221028 if ($ included === false ) {
10231029 // There were include rules set, but this file
0 commit comments