File tree Expand file tree Collapse file tree 1 file changed +4
-9
lines changed Expand file tree Collapse file tree 1 file changed +4
-9
lines changed Original file line number Diff line number Diff line change @@ -111,18 +111,13 @@ public function parseGroups(string $regex): ?RegexAstWalkResult
111111 );
112112
113113 // we could handle numeric-string, in case we know the regex is delimited by ^ and $
114- $ accessories = [];
115114 if ($ subjectAsGroupResult ->isNonFalsy ()->yes ()) {
116- $ accessories [] = new AccessoryNonFalsyStringType ();
115+ $ astWalkResult = $ astWalkResult ->withSubjectBaseType (
116+ TypeCombinator::intersect (new StringType (), new AccessoryNonFalsyStringType ()),
117+ );
117118 } elseif ($ subjectAsGroupResult ->isNonEmpty ()->yes ()) {
118- $ accessories [] = new AccessoryNonEmptyStringType ();
119- }
120-
121- if ($ accessories !== []) {
122- $ accessories [] = new StringType ();
123-
124119 $ astWalkResult = $ astWalkResult ->withSubjectBaseType (
125- TypeCombinator::intersect (... $ accessories ),
120+ TypeCombinator::intersect (new StringType (), new AccessoryNonEmptyStringType () ),
126121 );
127122 }
128123
You can’t perform that action at this time.
0 commit comments