diff --git a/lib/PhpParser/Node/Stmt/StaticVar.php b/lib/PhpParser/Node/Stmt/StaticVar.php index acb830c..09b8315 100644 --- a/lib/PhpParser/Node/Stmt/StaticVar.php +++ b/lib/PhpParser/Node/Stmt/StaticVar.php @@ -7,27 +7,27 @@ use PhpParser\Node\Expr; class StaticVar extends Node\Stmt { - /** @var Expr\Variable Name */ - public $name; + /** @var Expr\Variable Variable */ + public $var; /** @var null|Node\Expr Default value */ public $default; /** * Constructs a static variable node. * - * @param Expr\Variable $name Name + * @param Expr\Variable $var Name * @param null|Node\Expr $default Default value * @param array $attributes Additional attributes */ public function __construct( - Expr\Variable $name, Node\Expr $default = null, array $attributes = array() + Expr\Variable $var, Node\Expr $default = null, array $attributes = array() ) { parent::__construct($attributes); - $this->name = $name; + $this->var = $var; $this->default = $default; } public function getSubNodeNames() { - return array('name', 'default'); + return array('var', 'default'); } } diff --git a/lib/PhpParser/PrettyPrinter/Standard.php b/lib/PhpParser/PrettyPrinter/Standard.php index 9175f5b..3f2120e 100644 --- a/lib/PhpParser/PrettyPrinter/Standard.php +++ b/lib/PhpParser/PrettyPrinter/Standard.php @@ -814,7 +814,7 @@ class Standard extends PrettyPrinterAbstract } protected function pStmt_StaticVar(Stmt\StaticVar $node) { - return $this->p($node->name) + return $this->p($node->var) . (null !== $node->default ? ' = ' . $this->p($node->default) : ''); } diff --git a/test/code/parser/consistentVarMode.test b/test/code/parser/consistentVarMode.test index b3442d9..4bf0fd1 100644 --- a/test/code/parser/consistentVarMode.test +++ b/test/code/parser/consistentVarMode.test @@ -42,13 +42,13 @@ array( 0: Stmt_Static( vars: array( 0: Stmt_StaticVar( - name: Expr_Variable( + var: Expr_Variable( name: foo ) default: null ) 1: Stmt_StaticVar( - name: Expr_Variable( + var: Expr_Variable( name: bar ) default: Scalar_LNumber( diff --git a/test/code/parser/stmt/function/specialVars.test b/test/code/parser/stmt/function/specialVars.test index cf2c36f..ef4d698 100644 --- a/test/code/parser/stmt/function/specialVars.test +++ b/test/code/parser/stmt/function/specialVars.test @@ -35,13 +35,13 @@ array( 1: Stmt_Static( vars: array( 0: Stmt_StaticVar( - name: Expr_Variable( + var: Expr_Variable( name: c ) default: null ) 1: Stmt_StaticVar( - name: Expr_Variable( + var: Expr_Variable( name: d ) default: Scalar_String(