BetterReflection\NodeCompiler\CompileNodeToValue::__invoke PHP Метод

__invoke() публичный Метод

Compile an expression from a node into a value.
public __invoke ( PhpParser\Node $node, BetterReflection\NodeCompiler\CompilerContext $context ) : mixed
$node PhpParser\Node
$context BetterReflection\NodeCompiler\CompilerContext
Результат mixed
    public function __invoke(Node $node, CompilerContext $context)
    {
        if ($node instanceof Node\Scalar\String_ || $node instanceof Node\Scalar\DNumber || $node instanceof Node\Scalar\LNumber) {
            return $node->value;
        }
        // common edge case - negative numbers
        if ($node instanceof Node\Expr\UnaryMinus) {
            return $this($node->expr, $context) * -1;
        }
        if ($node instanceof Node\Expr\Array_) {
            return $this->compileArray($node, $context);
        }
        if ($node instanceof Node\Expr\ConstFetch) {
            return $this->compileConstFetch($node);
        }
        if ($node instanceof Node\Expr\ClassConstFetch) {
            return $this->compileClassConstFetch($node, $context);
        }
        if ($node instanceof Node\Expr\BinaryOp) {
            return $this->compileBinaryOperator($node, $context);
        }
        throw new Exception\UnableToCompileNode('Unable to compile expression: ' . get_class($node));
    }