Skip to content

Commit 77c8c95

Browse files
committed
remove double negation
1 parent d857b72 commit 77c8c95

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

src/Type/Php/RegexGroupParser.php

+3-8
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ private function walkGroupAst(
378378
$meaningfulTokens = 0;
379379
foreach ($children as $child) {
380380
$nonFalsy = false;
381-
if (!$this->isNonEmptyNode($child, $patternModifiers, $nonFalsy)) {
381+
if ($this->isEmptyNode($child, $patternModifiers, $nonFalsy)) {
382382
continue;
383383
}
384384

@@ -426,11 +426,6 @@ private function walkGroupAst(
426426
}
427427
}
428428
$onlyLiterals = $newLiterals;
429-
430-
if (!$inOptionalQuantification) {
431-
$isNonEmpty = TrinaryLogic::createYes();
432-
}
433-
434429
} elseif ($ast->getId() === 'token') {
435430
$literalValue = $this->getLiteralValue($ast, $onlyLiterals, !$inClass, $patternModifiers);
436431
if ($literalValue !== null) {
@@ -476,7 +471,7 @@ private function walkGroupAst(
476471
}
477472
}
478473

479-
private function isNonEmptyNode(TreeNode $node, string $patternModifiers, bool &$isNonFalsy): bool
474+
private function isEmptyNode(TreeNode $node, string $patternModifiers, bool &$isNonFalsy): bool
480475
{
481476
if ($node->getId() === '#quantification') {
482477
[$min] = $this->getQuantificationRange($node);
@@ -499,7 +494,7 @@ private function isNonEmptyNode(TreeNode $node, string $patternModifiers, bool &
499494
}
500495

501496
foreach ($node->getChildren() as $child) {
502-
if ($this->isNonEmptyNode($child, $patternModifiers, $isNonFalsy)) {
497+
if ($this->isEmptyNode($child, $patternModifiers, $isNonFalsy)) {
503498
return true;
504499
}
505500
}

0 commit comments

Comments
 (0)