Skip to content

Commit ff0ec10

Browse files
authored
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 ff0ec10

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

src/Language/Printer.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,9 @@ class Printer
7373
*/
7474
public static function doPrint(Node $ast): string
7575
{
76-
static $instance;
77-
$instance ??= new static();
78-
79-
return $instance->printAST($ast);
76+
return (new static())->printAST($ast);
8077
}
8178

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

0 commit comments

Comments
 (0)