From d7f3c4f9d3279d49203f34554e9e4f4169fdb9c3 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 19 Jan 2017 23:38:40 +0100 Subject: [PATCH] Renamve Param::$name to Param::$var As it now contains a Variable node. --- lib/PhpParser/Node/Param.php | 12 ++++++------ lib/PhpParser/PrettyPrinter/Standard.php | 2 +- test/PhpParser/NodeAbstractTest.php | 4 ++-- test/PhpParser/Serializer/XMLTest.php | 8 ++++---- test/code/parser/consistentVarMode.test | 4 ++-- test/code/parser/expr/closure.test | 8 ++++---- test/code/parser/expr/uvs/indirectCall.test | 4 ++-- test/code/parser/identMode.test | 4 ++-- test/code/parser/stmt/class/simple.test | 2 +- .../stmt/function/builtinTypeDeclarations.test | 10 +++++----- test/code/parser/stmt/function/byRef.test | 4 ++-- .../parser/stmt/function/defaultValues.test | 18 +++++++++--------- .../parser/stmt/function/nullableTypes.test | 4 ++-- .../parser/stmt/function/typeDeclarations.test | 8 ++++---- test/code/parser/stmt/function/variadic.test | 16 ++++++++-------- .../stmt/function/variadicDefaultValue.test | 2 +- 16 files changed, 55 insertions(+), 55 deletions(-) diff --git a/lib/PhpParser/Node/Param.php b/lib/PhpParser/Node/Param.php index 49f6036..1b806c2 100644 --- a/lib/PhpParser/Node/Param.php +++ b/lib/PhpParser/Node/Param.php @@ -12,15 +12,15 @@ class Param extends NodeAbstract public $byRef; /** @var bool Whether this is a variadic argument */ public $variadic; - /** @var Expr\Variable Name */ - public $name; + /** @var Expr\Variable Parameter variable */ + public $var; /** @var null|Expr Default value */ public $default; /** * Constructs a parameter node. * - * @param Expr\Variable $name Name + * @param Expr\Variable $var Parameter variable * @param null|Expr $default Default value * @param null|string|Name|NullableType $type Typehint * @param bool $byRef Whether is passed by reference @@ -28,18 +28,18 @@ class Param extends NodeAbstract * @param array $attributes Additional attributes */ public function __construct( - Expr\Variable $name, Expr $default = null, $type = null, + Expr\Variable $var, Expr $default = null, $type = null, $byRef = false, $variadic = false, array $attributes = array() ) { parent::__construct($attributes); $this->type = $type; $this->byRef = $byRef; $this->variadic = $variadic; - $this->name = $name; + $this->var = $var; $this->default = $default; } public function getSubNodeNames() { - return array('type', 'byRef', 'variadic', 'name', 'default'); + return array('type', 'byRef', 'variadic', 'var', 'default'); } } diff --git a/lib/PhpParser/PrettyPrinter/Standard.php b/lib/PhpParser/PrettyPrinter/Standard.php index 3f2120e..3276d5c 100644 --- a/lib/PhpParser/PrettyPrinter/Standard.php +++ b/lib/PhpParser/PrettyPrinter/Standard.php @@ -21,7 +21,7 @@ class Standard extends PrettyPrinterAbstract return ($node->type ? $this->pType($node->type) . ' ' : '') . ($node->byRef ? '&' : '') . ($node->variadic ? '...' : '') - . $this->p($node->name) + . $this->p($node->var) . ($node->default ? ' = ' . $this->p($node->default) : ''); } diff --git a/test/PhpParser/NodeAbstractTest.php b/test/PhpParser/NodeAbstractTest.php index 497b2b5..38a23c3 100644 --- a/test/PhpParser/NodeAbstractTest.php +++ b/test/PhpParser/NodeAbstractTest.php @@ -188,7 +188,7 @@ PHP; "type": null, "byRef": true, "variadic": false, - "name": { + "var": { "nodeType": "Expr_Variable", "name": "a", "attributes": { @@ -215,7 +215,7 @@ PHP; "type": null, "byRef": false, "variadic": false, - "name": { + "var": { "nodeType": "Expr_Variable", "name": "b", "attributes": { diff --git a/test/PhpParser/Serializer/XMLTest.php b/test/PhpParser/Serializer/XMLTest.php index d37056a..40af41c 100644 --- a/test/PhpParser/Serializer/XMLTest.php +++ b/test/PhpParser/Serializer/XMLTest.php @@ -60,7 +60,7 @@ CODE; - + 4 @@ -72,7 +72,7 @@ CODE; a - + @@ -106,7 +106,7 @@ CODE; - + 4 @@ -118,7 +118,7 @@ CODE; b - + diff --git a/test/code/parser/consistentVarMode.test b/test/code/parser/consistentVarMode.test index 4bf0fd1..6a23960 100644 --- a/test/code/parser/consistentVarMode.test +++ b/test/code/parser/consistentVarMode.test @@ -20,7 +20,7 @@ array( type: null byRef: false variadic: false - name: Expr_Variable( + var: Expr_Variable( name: param1 ) default: null @@ -29,7 +29,7 @@ array( type: null byRef: false variadic: false - name: Expr_Variable( + var: Expr_Variable( name: param2 ) default: Scalar_LNumber( diff --git a/test/code/parser/expr/closure.test b/test/code/parser/expr/closure.test index bd04f40..aecf375 100644 --- a/test/code/parser/expr/closure.test +++ b/test/code/parser/expr/closure.test @@ -19,7 +19,7 @@ array( type: null byRef: false variadic: false - name: Expr_Variable( + var: Expr_Variable( name: a ) default: null @@ -46,7 +46,7 @@ array( type: null byRef: false variadic: false - name: Expr_Variable( + var: Expr_Variable( name: a ) default: null @@ -99,7 +99,7 @@ array( type: null byRef: false variadic: false - name: Expr_Variable( + var: Expr_Variable( name: a ) default: null @@ -134,7 +134,7 @@ array( type: null byRef: false variadic: false - name: Expr_Variable( + var: Expr_Variable( name: a ) default: null diff --git a/test/code/parser/expr/uvs/indirectCall.test b/test/code/parser/expr/uvs/indirectCall.test index 98c37e7..2f36cc7 100644 --- a/test/code/parser/expr/uvs/indirectCall.test +++ b/test/code/parser/expr/uvs/indirectCall.test @@ -199,7 +199,7 @@ array( type: null byRef: false variadic: false - name: Expr_Variable( + var: Expr_Variable( name: x ) default: null @@ -265,7 +265,7 @@ array( type: null byRef: false variadic: false - name: Expr_Variable( + var: Expr_Variable( name: x ) default: Expr_ConstFetch( diff --git a/test/code/parser/identMode.test b/test/code/parser/identMode.test index 59c67f9..3f1b523 100644 --- a/test/code/parser/identMode.test +++ b/test/code/parser/identMode.test @@ -178,7 +178,7 @@ array( ) byRef: false variadic: false - name: Expr_Variable( + var: Expr_Variable( name: x ) default: null @@ -336,7 +336,7 @@ array( ) byRef: false variadic: false - name: Expr_Variable( + var: Expr_Variable( name: bar ) default: null diff --git a/test/code/parser/stmt/class/simple.test b/test/code/parser/stmt/class/simple.test index ef0f61f..24dda7c 100644 --- a/test/code/parser/stmt/class/simple.test +++ b/test/code/parser/stmt/class/simple.test @@ -109,7 +109,7 @@ array( type: null byRef: false variadic: false - name: Expr_Variable( + var: Expr_Variable( name: a ) default: null diff --git a/test/code/parser/stmt/function/builtinTypeDeclarations.test b/test/code/parser/stmt/function/builtinTypeDeclarations.test index e5f914e..67e3d91 100644 --- a/test/code/parser/stmt/function/builtinTypeDeclarations.test +++ b/test/code/parser/stmt/function/builtinTypeDeclarations.test @@ -13,7 +13,7 @@ array( type: bool byRef: false variadic: false - name: Expr_Variable( + var: Expr_Variable( name: a ) default: null @@ -22,7 +22,7 @@ array( type: int byRef: false variadic: false - name: Expr_Variable( + var: Expr_Variable( name: b ) default: null @@ -31,7 +31,7 @@ array( type: float byRef: false variadic: false - name: Expr_Variable( + var: Expr_Variable( name: c ) default: null @@ -40,7 +40,7 @@ array( type: string byRef: false variadic: false - name: Expr_Variable( + var: Expr_Variable( name: d ) default: null @@ -49,7 +49,7 @@ array( type: iterable byRef: false variadic: false - name: Expr_Variable( + var: Expr_Variable( name: e ) default: null diff --git a/test/code/parser/stmt/function/byRef.test b/test/code/parser/stmt/function/byRef.test index 1b0b8da..c5835ac 100644 --- a/test/code/parser/stmt/function/byRef.test +++ b/test/code/parser/stmt/function/byRef.test @@ -14,7 +14,7 @@ array( type: null byRef: true variadic: false - name: Expr_Variable( + var: Expr_Variable( name: b ) default: null @@ -32,7 +32,7 @@ array( type: null byRef: false variadic: false - name: Expr_Variable( + var: Expr_Variable( name: b ) default: null diff --git a/test/code/parser/stmt/function/defaultValues.test b/test/code/parser/stmt/function/defaultValues.test index e2b91fb..4c2bdbe 100644 --- a/test/code/parser/stmt/function/defaultValues.test +++ b/test/code/parser/stmt/function/defaultValues.test @@ -23,7 +23,7 @@ array( type: null byRef: false variadic: false - name: Expr_Variable( + var: Expr_Variable( name: b ) default: Expr_ConstFetch( @@ -38,7 +38,7 @@ array( type: null byRef: false variadic: false - name: Expr_Variable( + var: Expr_Variable( name: c ) default: Scalar_String( @@ -49,7 +49,7 @@ array( type: null byRef: false variadic: false - name: Expr_Variable( + var: Expr_Variable( name: d ) default: Expr_ClassConstFetch( @@ -65,7 +65,7 @@ array( type: null byRef: false variadic: false - name: Expr_Variable( + var: Expr_Variable( name: f ) default: Expr_UnaryPlus( @@ -78,7 +78,7 @@ array( type: null byRef: false variadic: false - name: Expr_Variable( + var: Expr_Variable( name: g ) default: Expr_UnaryMinus( @@ -91,7 +91,7 @@ array( type: null byRef: false variadic: false - name: Expr_Variable( + var: Expr_Variable( name: h ) default: Expr_Array( @@ -103,7 +103,7 @@ array( type: null byRef: false variadic: false - name: Expr_Variable( + var: Expr_Variable( name: i ) default: Expr_Array( @@ -115,7 +115,7 @@ array( type: null byRef: false variadic: false - name: Expr_Variable( + var: Expr_Variable( name: j ) default: Expr_Array( @@ -134,7 +134,7 @@ array( type: null byRef: false variadic: false - name: Expr_Variable( + var: Expr_Variable( name: k ) default: Expr_Array( diff --git a/test/code/parser/stmt/function/nullableTypes.test b/test/code/parser/stmt/function/nullableTypes.test index 37da51b..10bbf5b 100644 --- a/test/code/parser/stmt/function/nullableTypes.test +++ b/test/code/parser/stmt/function/nullableTypes.test @@ -21,7 +21,7 @@ array( ) byRef: false variadic: false - name: Expr_Variable( + var: Expr_Variable( name: bar ) default: null @@ -32,7 +32,7 @@ array( ) byRef: false variadic: false - name: Expr_Variable( + var: Expr_Variable( name: foo ) default: null diff --git a/test/code/parser/stmt/function/typeDeclarations.test b/test/code/parser/stmt/function/typeDeclarations.test index 2b43126..71b26d3 100644 --- a/test/code/parser/stmt/function/typeDeclarations.test +++ b/test/code/parser/stmt/function/typeDeclarations.test @@ -13,7 +13,7 @@ array( type: null byRef: false variadic: false - name: Expr_Variable( + var: Expr_Variable( name: b ) default: null @@ -22,7 +22,7 @@ array( type: array byRef: false variadic: false - name: Expr_Variable( + var: Expr_Variable( name: c ) default: null @@ -31,7 +31,7 @@ array( type: callable byRef: false variadic: false - name: Expr_Variable( + var: Expr_Variable( name: d ) default: null @@ -44,7 +44,7 @@ array( ) byRef: false variadic: false - name: Expr_Variable( + var: Expr_Variable( name: f ) default: null diff --git a/test/code/parser/stmt/function/variadic.test b/test/code/parser/stmt/function/variadic.test index 7d1fa8a..1c66696 100644 --- a/test/code/parser/stmt/function/variadic.test +++ b/test/code/parser/stmt/function/variadic.test @@ -15,7 +15,7 @@ array( type: null byRef: false variadic: false - name: Expr_Variable( + var: Expr_Variable( name: a ) default: null @@ -24,7 +24,7 @@ array( type: null byRef: false variadic: true - name: Expr_Variable( + var: Expr_Variable( name: b ) default: null @@ -42,7 +42,7 @@ array( type: null byRef: false variadic: false - name: Expr_Variable( + var: Expr_Variable( name: a ) default: null @@ -51,7 +51,7 @@ array( type: null byRef: true variadic: true - name: Expr_Variable( + var: Expr_Variable( name: b ) default: null @@ -69,7 +69,7 @@ array( type: null byRef: false variadic: false - name: Expr_Variable( + var: Expr_Variable( name: a ) default: null @@ -82,7 +82,7 @@ array( ) byRef: false variadic: true - name: Expr_Variable( + var: Expr_Variable( name: b ) default: null @@ -100,7 +100,7 @@ array( type: null byRef: false variadic: false - name: Expr_Variable( + var: Expr_Variable( name: a ) default: null @@ -113,7 +113,7 @@ array( ) byRef: true variadic: true - name: Expr_Variable( + var: Expr_Variable( name: b ) default: null diff --git a/test/code/parser/stmt/function/variadicDefaultValue.test b/test/code/parser/stmt/function/variadicDefaultValue.test index 4e9175b..bae3261 100644 --- a/test/code/parser/stmt/function/variadicDefaultValue.test +++ b/test/code/parser/stmt/function/variadicDefaultValue.test @@ -13,7 +13,7 @@ array( type: null byRef: false variadic: true - name: Expr_Variable( + var: Expr_Variable( name: foo ) default: Expr_Array(