From 76cbb7eab5898389ad0b7077951d2423c2d8349c Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Tue, 16 Jul 2024 17:08:50 +0200 Subject: [PATCH] Update RegexArrayShapeMatcher.php --- src/Type/Php/RegexArrayShapeMatcher.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Type/Php/RegexArrayShapeMatcher.php b/src/Type/Php/RegexArrayShapeMatcher.php index dd000361db..6e3fb2905f 100644 --- a/src/Type/Php/RegexArrayShapeMatcher.php +++ b/src/Type/Php/RegexArrayShapeMatcher.php @@ -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(); } @@ -609,7 +609,7 @@ 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); @@ -617,13 +617,15 @@ private function walkGroupAst(TreeNode $ast, TrinaryLogic &$isNonEmpty, TrinaryL 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(); } }