@@ -154,7 +154,7 @@ private function matchRegex(string $regex, ?int $flags, TrinaryLogic $wasMatched
154
154
155
155
if (!$ this ->containsUnmatchedAsNull ($ flags ?? 0 , $ matchesAll )) {
156
156
$ combiType = TypeCombinator::union (
157
- new ConstantArrayType ([new ConstantIntegerType (0 )], [new StringType ( )], [0 ], [], true ),
157
+ new ConstantArrayType ([new ConstantIntegerType (0 )], [$ this -> createSubjectValueType ( $ flags , $ matchesAll )], [0 ], [], true ),
158
158
$ combiType ,
159
159
);
160
160
}
@@ -288,7 +288,7 @@ private function buildArrayType(
288
288
// first item in matches contains the overall match.
289
289
$ builder ->setOffsetValueType (
290
290
$ this ->getKeyType (0 ),
291
- $ this ->createSubjectValueType ($ wasMatched , $ flags , $ matchesAll ),
291
+ $ this ->createSubjectValueType ($ flags , $ matchesAll ),
292
292
$ this ->isSubjectOptional ($ wasMatched , $ matchesAll ),
293
293
);
294
294
@@ -351,7 +351,7 @@ private function isSubjectOptional(TrinaryLogic $wasMatched, bool $matchesAll):
351
351
return !$ wasMatched ->yes ();
352
352
}
353
353
354
- private function createSubjectValueType (TrinaryLogic $ wasMatched , int $ flags , bool $ matchesAll ): Type
354
+ private function createSubjectValueType (int $ flags , bool $ matchesAll ): Type
355
355
{
356
356
$ subjectValueType = TypeCombinator::removeNull ($ this ->getValueType (new StringType (), $ flags , $ matchesAll ));
357
357
0 commit comments