Skip to content

Commit

Permalink
Merge pull request #141 from marcovtwout/support-unary-expr
Browse files Browse the repository at this point in the history
Add support for UnaryMinus and UnaryPlus expressions
  • Loading branch information
lisachenko authored Nov 25, 2024
2 parents 911b608 + ea4074d commit 9c9bee0
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 9c9bee0

Please sign in to comment.