@@ -39,7 +39,7 @@ public function translatePatternFromGlob($path)
3939 protected function translateGroupsFromGlob ($ pattern )
4040 {
4141 preg_match_all ('~ \\\\\\{[^, \\}]+(?:,[^, \\}]*)* \\\\\\}~ ' , $ pattern , $ matches , PREG_OFFSET_CAPTURE );
42- for ($ index = count ($ matches [0 ]) - 1 ; $ index >= 0 ; $ index -= 1 ) {
42+ for ($ index = count ($ matches [0 ]) - 1 ; $ index >= 0 ; $ index-- ) {
4343 list ($ match , $ offset ) = $ matches [0 ][$ index ];
4444 $ replacement = substr_replace ($ match , '(?: ' , 0 , 2 );
4545 $ replacement = substr_replace ($ replacement , ') ' , -2 );
@@ -65,9 +65,9 @@ protected function translateGroupsFromGlob($pattern)
6565 protected function translateCharacterGroupsFromGlob ($ pattern )
6666 {
6767 preg_match_all ('~ \\\\\\[( \\\\\\!)?[^ \\]]+ \\\\\\]~i ' , $ pattern , $ matches , PREG_OFFSET_CAPTURE );
68- for ($ index = count ($ matches [0 ]) - 1 ; $ index >= 0 ; $ index -= 1 ) {
68+ for ($ index = count ($ matches [0 ]) - 1 ; $ index >= 0 ; $ index-- ) {
6969 list ($ match , $ offset ) = $ matches [0 ][$ index ];
70- $ exclude = !empty ($ matches [1 ][$ index ]);
70+ $ exclude = !( empty ($ matches [1 ][$ index ]) || empty ( $ matches [ 1 ][ $ index ][ 0 ]) );
7171 $ replacement = substr_replace ($ match , '[ ' . ($ exclude ? '^ ' : '' ), 0 , $ exclude ? 4 : 2 );
7272 $ replacement = substr_replace ($ replacement , '] ' , -2 );
7373 $ replacement = str_replace ('\\- ' , '- ' , $ replacement );
0 commit comments