mirror of
https://github.com/danog/PHP-Parser.git
synced 2024-11-26 20:04:48 +01:00
Wrap class const LHS in parens if necessary
This looks like a very old bug in the pretty printer that showed up in PHP 8 tests.
This commit is contained in:
parent
0cee2088ea
commit
feb6bf7a0c
@ -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) {
|
||||
|
@ -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,
|
||||
],
|
||||
|
@ -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;
|
Loading…
Reference in New Issue
Block a user