private function parseOperatorNode(Node\Expr $node)
{
$nodeType = str_replace('Expr_', '', $node->getType());
switch (true) {
case isset(self::$assignOperatorsMap[$nodeType]):
return Expression::assign($this->parseNode($node->var), self::$assignOperatorsMap[$nodeType], $this->parseNode($node->expr));
case $node instanceof Node\Expr\Instanceof_:
return Expression::binaryOperation($this->parseNode($node->expr), Operators\Binary::IS_INSTANCE_OF, $this->parseNameNode($node->class));
case isset(self::$binaryOperatorsMap[$nodeType]):
return Expression::binaryOperation($this->parseNode($node->left), self::$binaryOperatorsMap[$nodeType], $this->parseNode($node->right));
case isset(self::$unaryOperatorsMap[$nodeType]):
return Expression::unaryOperation(self::$unaryOperatorsMap[$nodeType], $this->parseNode(isset($node->expr) ? $node->expr : $node->var));
case isset(self::$castOperatorMap[$nodeType]):
return Expression::cast(self::$castOperatorMap[$nodeType], $this->parseNode($node->expr));
default:
return null;
}
}