Skip to content

Commit 5318269

Browse files
committed
simplify
1 parent a6ca5e8 commit 5318269

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

src/Type/Php/RegexArrayShapeMatcher.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ private function matchRegex(string $regex, ?int $flags, TrinaryLogic $wasMatched
116116
// regex could not be parsed by Hoa/Regex
117117
return null;
118118
}
119-
[$groupList, $alternationList, $markVerbs] = $parseResult;
119+
[$groupList, $markVerbs] = $parseResult;
120120

121121
$trailingOptionals = 0;
122122
foreach (array_reverse($groupList) as $captureGroup) {

src/Type/Php/RegexGroupParser.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function __construct(
4444
}
4545

4646
/**
47-
* @return array{array<int, RegexCapturingGroup>, list<RegexAlternation>, list<string>}|null
47+
* @return array{array<int, RegexCapturingGroup>, list<string>}|null
4848
*/
4949
public function parseGroups(string $regex): ?array
5050
{
@@ -88,14 +88,13 @@ public function parseGroups(string $regex): ?array
8888
null,
8989
$captureGroupId,
9090
$capturingGroups,
91-
$alternationList,
9291
$markVerbs,
9392
$captureOnlyNamed,
9493
false,
9594
$modifiers,
9695
);
9796

98-
return [$capturingGroups, $alternationList, $markVerbs];
97+
return [$capturingGroups, $markVerbs];
9998
}
10099

101100
/**
@@ -112,7 +111,6 @@ private function walkRegexAst(
112111
RegexCapturingGroup|RegexNonCapturingGroup|null $parentGroup,
113112
int &$captureGroupId,
114113
array &$capturingGroups,
115-
array &$alternationList,
116114
array &$markVerbs,
117115
bool $captureOnlyNamed,
118116
bool $repeatedMoreThanOnce,
@@ -183,7 +181,6 @@ private function walkRegexAst(
183181
if ($ast->getId() === '#alternation') {
184182
$alternationId++;
185183
$alternation = new RegexAlternation($alternationId);
186-
$alternationList[] = $alternation;
187184
}
188185

189186
if ($ast->getId() === '#mark') {
@@ -212,7 +209,6 @@ private function walkRegexAst(
212209
$parentGroup,
213210
$captureGroupId,
214211
$capturingGroups,
215-
$alternationList,
216212
$markVerbs,
217213
$captureOnlyNamed,
218214
$repeatedMoreThanOnce,

0 commit comments

Comments
 (0)