Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/class-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
Expand Down
9 changes: 3 additions & 6 deletions src/Language/Printer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
Loading