diff --git a/src/Files/File.php b/src/Files/File.php index 14943f9082..6204ab9753 100644 --- a/src/Files/File.php +++ b/src/Files/File.php @@ -967,59 +967,63 @@ protected function addMessage($error, $message, $line, $column, $code, $data, $s // Make sure we are not ignoring this file. $included = null; - foreach ($checkCodes as $checkCode) { - $patterns = null; - - if (isset($this->configCache['includePatterns'][$checkCode]) === true) { - $patterns = $this->configCache['includePatterns'][$checkCode]; - $excluding = false; - } else if (isset($this->configCache['ignorePatterns'][$checkCode]) === true) { - $patterns = $this->configCache['ignorePatterns'][$checkCode]; - $excluding = true; - } - - if ($patterns === null) { - continue; - } - - foreach ($patterns as $pattern => $type) { - // While there is support for a type of each pattern - // (absolute or relative) we don't actually support it here. - $replacements = [ - '\\,' => ',', - '*' => '.*', - ]; - - // We assume a / directory separator, as do the exclude rules - // most developers write, so we need a special case for any system - // that is different. - if (DIRECTORY_SEPARATOR === '\\') { - $replacements['/'] = '\\\\'; + if (trim($this->path, '\'"') === 'STDIN') { + $included = true; + } else { + foreach ($checkCodes as $checkCode) { + $patterns = null; + + if (isset($this->configCache['includePatterns'][$checkCode]) === true) { + $patterns = $this->configCache['includePatterns'][$checkCode]; + $excluding = false; + } else if (isset($this->configCache['ignorePatterns'][$checkCode]) === true) { + $patterns = $this->configCache['ignorePatterns'][$checkCode]; + $excluding = true; } - $pattern = '`'.strtr($pattern, $replacements).'`i'; - $matched = preg_match($pattern, $this->path); + if ($patterns === null) { + continue; + } - if ($matched === 0) { - if ($excluding === false && $included === null) { - // This file path is not being included. - $included = false; + foreach ($patterns as $pattern => $type) { + // While there is support for a type of each pattern + // (absolute or relative) we don't actually support it here. + $replacements = [ + '\\,' => ',', + '*' => '.*', + ]; + + // We assume a / directory separator, as do the exclude rules + // most developers write, so we need a special case for any system + // that is different. + if (DIRECTORY_SEPARATOR === '\\') { + $replacements['/'] = '\\\\'; } - continue; - } + $pattern = '`'.strtr($pattern, $replacements).'`i'; + $matched = preg_match($pattern, $this->path); - if ($excluding === true) { - // This file path is being excluded. - $this->ignoredCodes[$checkCode] = true; - return false; - } + if ($matched === 0) { + if ($excluding === false && $included === null) { + // This file path is not being included. + $included = false; + } - // This file path is being included. - $included = true; - break; + continue; + } + + if ($excluding === true) { + // This file path is being excluded. + $this->ignoredCodes[$checkCode] = true; + return false; + } + + // This file path is being included. + $included = true; + break; + }//end foreach }//end foreach - }//end foreach + }//end if if ($included === false) { // There were include rules set, but this file