Skip to content

Commit cfd2187

Browse files
committed
Remove private constructor for Printer
The Printer is not stateful. So enforcing a singleton serves no purpose (anymore?). We can easily use `new Printer()->printAST($node)`.
1 parent c7f84dd commit cfd2187

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/Language/Printer.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,17 +70,14 @@ class Printer
7070
* Handles both executable definitions and schema definitions.
7171
*
7272
* @api
73+
*
74+
* @throws \JsonException
7375
*/
7476
public static function doPrint(Node $ast): string
7577
{
76-
static $instance;
77-
$instance ??= new static();
78-
79-
return $instance->printAST($ast);
78+
return (new static())->printAST($ast);
8079
}
8180

82-
protected function __construct() {}
83-
8481
/**
8582
* Recursively traverse an AST depth-first and produce a pretty string.
8683
*

0 commit comments

Comments
 (0)