Skip to content

Commit 90d7edd

Browse files
committed
Update ExprPrinter.php
1 parent 242f09a commit 90d7edd

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Node/Printer/ExprPrinter.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ public function __construct(private Printer $printer)
2020

2121
public function printExpr(Expr $expr): string
2222
{
23+
// perf optimize for the most common path
24+
if ($expr instanceof Expr\Variable && !$expr->name instanceof Expr) {
25+
return '$' . $expr->name;
26+
}
27+
2328
/** @var string|null $exprString */
2429
$exprString = $expr->getAttribute(self::ATTRIBUTE_CACHE_KEY);
2530
if ($exprString === null) {

0 commit comments

Comments
 (0)