diff --git a/docs/class-reference.md b/docs/class-reference.md index 5b79dba4e..4b05601a3 100644 --- a/docs/class-reference.md +++ b/docs/class-reference.md @@ -1261,6 +1261,8 @@ $printed = GraphQL\Language\Printer::doPrint($ast); * Handles both executable definitions and schema definitions. * * @api + * + * @throws \JsonException */ static function doPrint(GraphQL\Language\AST\Node $ast): string ``` diff --git a/src/Language/Printer.php b/src/Language/Printer.php index e355a0a91..1302e817e 100644 --- a/src/Language/Printer.php +++ b/src/Language/Printer.php @@ -70,17 +70,14 @@ class Printer * Handles both executable definitions and schema definitions. * * @api + * + * @throws \JsonException */ public static function doPrint(Node $ast): string { - static $instance; - $instance ??= new static(); - - return $instance->printAST($ast); + return (new static())->printAST($ast); } - protected function __construct() {} - /** * Recursively traverse an AST depth-first and produce a pretty string. *