1919use RuntimeException ;
2020
2121/**
22- * FileMatcher attempts to emulate the behavior of PHP's glob function on file
23- * paths based on POSIX.2.
22+ * FileMatcher ultimately attempts to emulate the behavior `php-file-iterator`
23+ * which *mostly* comes down to emulating PHP's glob function on file paths
24+ * based on POSIX.2 but
2425 *
2526 * - https://en.wikipedia.org/wiki/Glob_(programming)
2627 * - https://man7.org/linux/man-pages/man7/glob.7.html
@@ -189,6 +190,8 @@ private static function processTokens(array $tokens): array
189190 continue ;
190191 }
191192
193+ // two consecutive ** which are not surrounded by `/` are invalid and
194+ // we interpret them as literals.
192195 if ($ type === self ::T_ASTERIX && ($ tokens [$ offset + 1 ][0 ] ?? null ) === self ::T_ASTERIX ) {
193196 $ resolved [] = [self ::T_CHAR , $ char ];
194197 $ resolved [] = [self ::T_CHAR , $ char ];
@@ -249,7 +252,6 @@ private static function processTokens(array $tokens): array
249252 $ resolved [] = [self ::T_CHAR , ': ' . $ class ];
250253 }
251254
252-
253255 // if bracket is already open and we have another open bracket
254256 // interpret it as a literal
255257 if ($ bracketOpen === true && $ type === self ::T_BRACKET_OPEN ) {
@@ -273,7 +275,6 @@ private static function processTokens(array $tokens): array
273275 //
274276 // TODO: $bracketOpen === true below is not tested
275277 if ($ bracketOpen === true && $ type === self ::T_BRACKET_CLOSE ) {
276-
277278 // TODO: this is not tested
278279 $ bracketOpen = false ;
279280
0 commit comments