Skip to content

Commit

Permalink
Revert "File::process(): don't apply include/exclude patterns to STDIN"
Browse files Browse the repository at this point in the history
This reverts commit 0d79723.
  • Loading branch information
gsherwood committed Oct 22, 2020
1 parent 4dbf1d5 commit a978246
Showing 1 changed file with 30 additions and 32 deletions.
62 changes: 30 additions & 32 deletions src/Files/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -442,11 +442,30 @@ public function process()
continue;
}

if (trim($this->path, '\'"') !== 'STDIN') {
// If the file path matches one of our ignore patterns, skip it.
// While there is support for a type of each pattern
// (absolute or relative) we don't actually support it here.
foreach ($listenerData['ignore'] as $pattern) {
// If the file path matches one of our ignore patterns, skip it.
// While there is support for a type of each pattern
// (absolute or relative) we don't actually support it here.
foreach ($listenerData['ignore'] as $pattern) {
// 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 === '\\') {
$pattern = str_replace('/', '\\\\', $pattern);
}

$pattern = '`'.$pattern.'`i';
if (preg_match($pattern, $this->path) === 1) {
$this->ignoredListeners[$class] = true;
continue(2);
}
}

// If the file path does not match one of our include patterns, skip it.
// While there is support for a type of each pattern
// (absolute or relative) we don't actually support it here.
if (empty($listenerData['include']) === false) {
$included = false;
foreach ($listenerData['include'] as $pattern) {
// 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.
Expand All @@ -456,36 +475,15 @@ public function process()

$pattern = '`'.$pattern.'`i';
if (preg_match($pattern, $this->path) === 1) {
$this->ignoredListeners[$class] = true;
continue(2);
$included = true;
break;
}
}

// If the file path does not match one of our include patterns, skip it.
// While there is support for a type of each pattern
// (absolute or relative) we don't actually support it here.
if (empty($listenerData['include']) === false) {
$included = false;
foreach ($listenerData['include'] as $pattern) {
// 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 === '\\') {
$pattern = str_replace('/', '\\\\', $pattern);
}

$pattern = '`'.$pattern.'`i';
if (preg_match($pattern, $this->path) === 1) {
$included = true;
break;
}
}

if ($included === false) {
$this->ignoredListeners[$class] = true;
continue;
}
}//end if
if ($included === false) {
$this->ignoredListeners[$class] = true;
continue;
}
}//end if

$this->activeListener = $class;
Expand Down

0 comments on commit a978246

Please sign in to comment.