Skip to content

Commit 9c9bee0

Browse files
authored
Merge pull request #141 from marcovtwout/support-unary-expr
Add support for UnaryMinus and UnaryPlus expressions
2 parents 911b608 + ea4074d commit 9c9bee0

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/Resolver/NodeExpressionResolver.php

+10
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)