public function compilePreconditions(ExpressionCompiler $compiler, FunctionExpression $function) { if (!empty($function->args)) { throw new InvalidArgumentException(sprintf('The ' . $this->getName() . '() function does not accept any arguments, but got "%s".', var_export($function->args, true))); } $compiler->verifyItem('token', 'Symfony\\Component\\Security\\Core\\Authentication\\Token\\TokenInterface'); }
public function compilePreconditions(ExpressionCompiler $compiler, ExpressionInterface $parameter) { $compiler->verifyItem('object', 'CG\\Proxy\\MethodInvocation'); if (!isset($compiler->attributes['parameter_mapping_name'])) { $this->addParameterMapping($compiler); } $compiler->writeln("if (!isset(\${$compiler->attributes['parameter_mapping_name']}['{$parameter->name}'])) {")->indent()->write("throw new RuntimeException(sprintf('There is no parameter with name \"{$parameter->name}\" for method \"%s\".', ")->compileInternal(new VariableExpression('object'))->writeln("));")->outdent()->write("}\n\n"); }
public function compilePreconditions(ExpressionCompiler $compiler, FunctionExpression $function) { $compiler->verifyItem('token', 'Symfony\\Component\\Security\\Core\\Authentication\\Token\\TokenInterface'); }
public function compilePreconditions(ExpressionCompiler $compiler, ExpressionInterface $expr) { if (!$expr->allowNull && !$this->isKnown($expr->name)) { $compiler->verifyItem($expr->name); } }