Skip to content

Commit 427232a

Browse files
committed
tests
1 parent dd24c4b commit 427232a

File tree

4 files changed

+191
-187
lines changed

4 files changed

+191
-187
lines changed

src/Type/Regex/RegexGroupParser.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,11 @@ public function parseGroups(string $regex): ?RegexAstWalkResult
109109
$modifiers,
110110
RegexGroupWalkResult::createEmpty(),
111111
);
112-
if ($subjectAsGroupResult->isNonEmpty()->yes()) {
112+
if ($subjectAsGroupResult->isNonFalsy()->yes() || $subjectAsGroupResult->isNumeric()->yes()) {
113+
$astWalkResult = $astWalkResult->withSubjectBaseType(
114+
TypeCombinator::intersect(new StringType(), new AccessoryNonFalsyStringType())
115+
);
116+
} elseif ($subjectAsGroupResult->isNonEmpty()->yes()) {
113117
$astWalkResult = $astWalkResult->withSubjectBaseType(
114118
TypeCombinator::intersect(new StringType(), new AccessoryNonEmptyStringType())
115119
);

0 commit comments

Comments
 (0)