File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed
Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -102,6 +102,19 @@ public function parseGroups(string $regex): ?RegexAstWalkResult
102102 RegexAstWalkResult::createEmpty (),
103103 );
104104
105+ $ subjectAsGroupResult = $ this ->walkGroupAst (
106+ $ ast ,
107+ false ,
108+ false ,
109+ $ modifiers ,
110+ RegexGroupWalkResult::createEmpty (),
111+ );
112+ if ($ subjectAsGroupResult ->isNonEmpty ()->yes ()) {
113+ $ astWalkResult = $ astWalkResult ->withSubjectBaseType (
114+ TypeCombinator::intersect (new StringType (), new AccessoryNonEmptyStringType ())
115+ );
116+ }
117+
105118 return $ astWalkResult ;
106119 }
107120
@@ -260,12 +273,6 @@ private function walkRegexAst(
260273 $ astWalkResult ,
261274 );
262275
263- if ($ alternation === null && !$ inOptionalQuantification ) {
264- $ astWalkResult = $ astWalkResult ->withSubjectBaseType (
265- TypeCombinator::intersect (new StringType (), new AccessoryNonEmptyStringType ())
266- );
267- }
268-
269276 if ($ ast ->getId () !== '#alternation ' ) {
270277 continue ;
271278 }
You can’t perform that action at this time.
0 commit comments