/** * @param \PhpParser\Node\Expr\Closure $expr * @param Context $context * @return mixed */ protected function compile($expr, Context $context) { $closure = new ClosureDefinition($expr); $closure->setFilepath($context->getFilepath()); $closure->preCompile(clone $context); return new CompiledExpression(CompiledExpression::CALLABLE_TYPE, $closure); }