Skip to content

Commit ea4074d

Browse files
committed
Add support for UnaryMinus and UnaryPlus expressions
1 parent 911b608 commit ea4074d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/Resolver/NodeExpressionResolver.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,16 @@ protected function resolveExprBinaryOpLogicalXor(Expr\BinaryOp\LogicalXor $node)
589589
return $this->resolve($node->left) xor $this->resolve($node->right);
590590
}
591591

592+
protected function resolveExprUnaryMinus(Expr\UnaryMinus $node): int|float
593+
{
594+
return -$this->resolve($node->expr);
595+
}
596+
597+
protected function resolveExprUnaryPlus(Expr\UnaryPlus $node): int|float
598+
{
599+
return $this->resolve($node->expr);
600+
}
601+
592602
private function getDispatchMethodFor(Node $node): string
593603
{
594604
$nodeType = $node->getType();

0 commit comments

Comments
 (0)