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
102
102
RegexAstWalkResult::createEmpty (),
103
103
);
104
104
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
+
105
118
return $ astWalkResult ;
106
119
}
107
120
@@ -260,12 +273,6 @@ private function walkRegexAst(
260
273
$ astWalkResult ,
261
274
);
262
275
263
- if ($ alternation === null && !$ inOptionalQuantification ) {
264
- $ astWalkResult = $ astWalkResult ->withSubjectBaseType (
265
- TypeCombinator::intersect (new StringType (), new AccessoryNonEmptyStringType ())
266
- );
267
- }
268
-
269
276
if ($ ast ->getId () !== '#alternation ' ) {
270
277
continue ;
271
278
}
You can’t perform that action at this time.
0 commit comments