Skip to content

Commit 85f3521

Browse files
committed
Merge branch 'directory-exclude-pattern' of https://github.com/Solviq-forks/PHP_CodeSniffer
2 parents d2deedd + 367c60c commit 85f3521

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/Filters/Filter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ protected function shouldIgnorePath($path)
218218
// Need to check this pattern for dirs as well as individual file paths.
219219
$this->ignoreFilePatterns[$pattern] = $type;
220220

221-
$pattern = substr($pattern, 0, -2);
221+
$pattern = substr($pattern, 0, -2).'(?=/|$)';
222222
$this->ignoreDirPatterns[$pattern] = $type;
223223
} else {
224224
// This is a file-specific pattern, so only need to check this

tests/Core/Filters/Filter/AcceptTest.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,13 @@ public function dataExcludePatterns()
111111
'/path/to/src/Main.php',
112112
'/path/to/src/Something/Main.php',
113113
'/path/to/src/Somethingelse/Main.php',
114+
'/path/to/src/SomethingelseEvenLonger/Main.php',
114115
'/path/to/src/Other/Main.php',
115116
],
116-
['/path/to/src/Main.php'],
117+
[
118+
'/path/to/src/Main.php',
119+
'/path/to/src/SomethingelseEvenLonger/Main.php',
120+
],
117121
],
118122

119123
// Test ignoring standard/sniff specific exclude patterns.

0 commit comments

Comments
 (0)