Skip to content

Commit

Permalink
Update RegexArrayShapeMatcher.php
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm committed Jul 16, 2024
1 parent 1111067 commit a09a8f2
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/Type/Php/RegexArrayShapeMatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -556,14 +556,15 @@ private function createGroupType(TreeNode $group): Type
if ($accessories !== []) {
return new IntersectionType([
new StringType(),
...$accessories
...$accessories,
]);
}

return new StringType();
}

private function walkGroupAst(TreeNode $ast, TrinaryLogic &$isNonEmpty, TrinaryLogic &$isNumeric, bool &$inOptionalQuantification): void {
private function walkGroupAst(TreeNode $ast, TrinaryLogic &$isNonEmpty, TrinaryLogic &$isNumeric, bool &$inOptionalQuantification): void
{
$children = $ast->getChildren();

if (
Expand Down Expand Up @@ -592,7 +593,7 @@ private function walkGroupAst(TreeNode $ast, TrinaryLogic &$isNonEmpty, TrinaryL
}

if ($ast->getValueToken() === 'character_type') {
if ('\d' === $ast->getValueValue()) {
if ($ast->getValueValue() === '\d') {
if ($isNumeric->maybe()) {
$isNumeric = TrinaryLogic::createYes();
}
Expand All @@ -609,7 +610,7 @@ private function walkGroupAst(TreeNode $ast, TrinaryLogic &$isNonEmpty, TrinaryL
if ($ast->getId() === '#range') {
if ($isNumeric->maybe()) {
$allNumeric = true;
foreach($children as $child) {
foreach ($children as $child) {
$literalValue = $this->getLiteralValue($child);

if ($literalValue === null) {
Expand All @@ -632,12 +633,12 @@ private function walkGroupAst(TreeNode $ast, TrinaryLogic &$isNonEmpty, TrinaryL
}
}

foreach($children as $child) {
foreach ($children as $child) {
$this->walkGroupAst(
$child,
$isNonEmpty,
$isNumeric,
$inOptionalQuantification
$inOptionalQuantification,
);
}
}
Expand Down

0 comments on commit a09a8f2

Please sign in to comment.