Skip to content

Commit

Permalink
Add support for UnaryMinus and UnaryPlus expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
marcovtwout committed Jul 11, 2024
1 parent 911b608 commit ea4074d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Resolver/NodeExpressionResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,16 @@ protected function resolveExprBinaryOpLogicalXor(Expr\BinaryOp\LogicalXor $node)
return $this->resolve($node->left) xor $this->resolve($node->right);
}

protected function resolveExprUnaryMinus(Expr\UnaryMinus $node): int|float
{
return -$this->resolve($node->expr);
}

protected function resolveExprUnaryPlus(Expr\UnaryPlus $node): int|float
{
return $this->resolve($node->expr);
}

private function getDispatchMethodFor(Node $node): string
{
$nodeType = $node->getType();
Expand Down

0 comments on commit ea4074d

Please sign in to comment.