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 a09a8f2 commit 76cbb7e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/Type/Php/RegexArrayShapeMatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ private function walkGroupAst(TreeNode $ast, TrinaryLogic &$isNonEmpty, TrinaryL

if ($ast->getId() === 'token') {
$literalValue = $this->getLiteralValue($ast);
if ($literalValue !== null && !Strings::match($literalValue, '/^\d+$/')) {
if ($literalValue !== null && Strings::match($literalValue, '/^\d+$/') === null) {
$isNumeric = TrinaryLogic::createNo();
}

Expand All @@ -609,21 +609,23 @@ private function walkGroupAst(TreeNode $ast, TrinaryLogic &$isNonEmpty, TrinaryL

if ($ast->getId() === '#range') {
if ($isNumeric->maybe()) {
$allNumeric = true;
$allNumeric = null;
foreach ($children as $child) {
$literalValue = $this->getLiteralValue($child);

if ($literalValue === null) {
break;
}

if (!Strings::match($literalValue, '/^\d+$/')) {
if (Strings::match($literalValue, '/^\d+$/') === null) {
$allNumeric = false;
break;
}

$allNumeric = true;
}

if ($allNumeric) {
if ($allNumeric === true) {
$isNumeric = TrinaryLogic::createYes();
}
}
Expand Down

0 comments on commit 76cbb7e

Please sign in to comment.