resolveDirectives($this->directives()); $arguments = $this->buildArguments($this->arguments()); return " \"\"\"{$this->description()}\"\"\" {$this->name}{$arguments}: {$this->getType()->__toString()} {$directives} "; } /** * The arguments of the mutation. * * @return string[] */ abstract public function arguments(): array; /** * The directives of the mutation. * * @return array * * @throws Exception */ public function directives(): array { $field = $this->resolveFieldAttribute(); if ($field === null) { throw new Exception("The mutation {$this->name} must implement an UseField attribute."); } return [ 'field' => [ 'resolver' => $field, ], ]; } /** * The type returned by the mutation. */ abstract public function getType(): Type; /** * The base return type of the mutation. */ abstract public function baseType(): Type; /** * The description of the mutation. */ abstract public function description(): string; }