Skip to content

Commit 02c96c3

Browse files
committed
Fix complementation
1 parent 9e5b314 commit 02c96c3

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Util/FileMatcher.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,11 +176,16 @@ private static function processTokens(array $tokens): array
176176
}
177177

178178
// complementation - only parse BANG if it is at the start of a character group
179-
if ($type === self::T_BANG && isset($resolved[array_key_last($resolved) - 1]) && $resolved[array_key_last($resolved) - 1][0] === self::T_BRACKET_OPEN) {
179+
if ($type === self::T_BANG && isset($resolved[array_key_last($resolved)]) && $resolved[array_key_last($resolved)][0] === self::T_BRACKET_OPEN) {
180180
$resolved[] = [self::T_BANG, '!'];
181181
continue;
182182
}
183183

184+
if ($type === self::T_BANG) {
185+
$resolved[] = [self::T_CHAR, $char];
186+
continue;
187+
}
188+
184189
if ($type === self::T_BRACKET_OPEN) {
185190
$brackets[] = $offset;
186191
$resolved[] = [$type, $char];

0 commit comments

Comments
 (0)