diff --git a/lib/PhpParser/PrettyPrinter/Standard.php b/lib/PhpParser/PrettyPrinter/Standard.php index 1d26342..14da6b9 100644 --- a/lib/PhpParser/PrettyPrinter/Standard.php +++ b/lib/PhpParser/PrettyPrinter/Standard.php @@ -577,7 +577,7 @@ class Standard extends PrettyPrinterAbstract } protected function pExpr_ClassConstFetch(Expr\ClassConstFetch $node) { - return $this->p($node->class) . '::' . $this->p($node->name); + return $this->pDereferenceLhs($node->class) . '::' . $this->p($node->name); } protected function pExpr_PropertyFetch(Expr\PropertyFetch $node) { diff --git a/lib/PhpParser/PrettyPrinterAbstract.php b/lib/PhpParser/PrettyPrinterAbstract.php index 1dce399..22a1247 100644 --- a/lib/PhpParser/PrettyPrinterAbstract.php +++ b/lib/PhpParser/PrettyPrinterAbstract.php @@ -1157,6 +1157,9 @@ abstract class PrettyPrinterAbstract 'var' => self::FIXUP_DEREF_LHS, 'name' => self::FIXUP_BRACED_NAME, ], + Expr\ClassConstFetch::class => [ + 'var' => self::FIXUP_DEREF_LHS, + ], Scalar\Encapsed::class => [ 'parts' => self::FIXUP_ENCAPSED, ], diff --git a/test/code/prettyPrinter/expr/uvs.test b/test/code/prettyPrinter/expr/uvs.test index e336fb5..087e712 100644 --- a/test/code/prettyPrinter/expr/uvs.test +++ b/test/code/prettyPrinter/expr/uvs.test @@ -10,6 +10,7 @@ $A::{$b[$c]}(); A::$$b[$c](); ($a->b)(); (A::$b)(); +('a' . 'b')::X; ----- !!php7 (function () { @@ -21,3 +22,4 @@ $A::{$b[$c]}(); A::${$b}[$c](); ($a->b)(); (A::$b)(); +('a' . 'b')::X; \ No newline at end of file