public function compilePreconditions(ExpressionCompiler $compiler, FunctionExpression $function) { if (0 === count($function->args)) { throw new RuntimeException('The function hasAnyRole() expects at least one argument, but got none.'); } $this->rolesExpr = $compiler->getRolesExpr(); }
public function compilePreconditions(ExpressionCompiler $compiler, FunctionExpression $function) { if (1 !== count($function->args)) { throw new RuntimeException(sprintf('The hasRole() function expects exactly one argument, but got "%s".', var_export($function->args, true))); } $this->rolesExpr = $compiler->getRolesExpr(); }