From 4943557dc8601fa875c32068e7466d8360c77c07 Mon Sep 17 00:00:00 2001 From: Sara Itani Date: Wed, 28 Dec 2016 12:10:54 -0500 Subject: [PATCH] extract ParameterDeclarationList class --- Node/DelimitedList/ParameterDeclarationList.php | 15 +++++++++++++++ NodeKind.php | 1 + parser.php | 9 ++++++++- tests/cases/parser/classMethods3.php.tree | 2 +- tests/cases/parser/classMethods4.php.tree | 2 +- tests/cases/parser/functions10.php.tree | 2 +- tests/cases/parser/functions11.php.tree | 2 +- tests/cases/parser/functions12.php.tree | 2 +- tests/cases/parser/functions13.php.tree | 2 +- tests/cases/parser/functions14.php.tree | 2 +- tests/cases/parser/functions15.php.tree | 2 +- tests/cases/parser/functions16.php.tree | 2 +- tests/cases/parser/functions3.php.tree | 2 +- tests/cases/parser/functions6.php.tree | 2 +- tests/cases/parser/functions7.php.tree | 2 +- tests/cases/parser/functions8.php.tree | 2 +- tests/cases/parser/functions9.php.tree | 2 +- .../cases/parser/interfaceDeclaration10.php.tree | 2 +- tests/cases/parser/interfaceDeclaration8.php.tree | 2 +- tests/cases/parser/interfaceDeclaration9.php.tree | 2 +- 20 files changed, 41 insertions(+), 18 deletions(-) create mode 100644 Node/DelimitedList/ParameterDeclarationList.php diff --git a/Node/DelimitedList/ParameterDeclarationList.php b/Node/DelimitedList/ParameterDeclarationList.php new file mode 100644 index 0000000..ebf9eb1 --- /dev/null +++ b/Node/DelimitedList/ParameterDeclarationList.php @@ -0,0 +1,15 @@ +openParen = $this->eat(TokenKind::OpenParenToken); - $functionDefinition->parameters = $this->parseDelimitedList(TokenKind::CommaToken, $this->isParameterStartFn(), $this->parseParameterFn(), $functionDefinition); + $functionDefinition->parameters = $this->parseDelimitedList( + TokenKind::CommaToken, + $this->isParameterStartFn(), + $this->parseParameterFn(), + $functionDefinition, + false, + ParameterDeclarationList::class); $functionDefinition->closeParen = $this->eat(TokenKind::CloseParenToken); if ($isAnonymous) { $functionDefinition->anonymousFunctionUseClause = $this->parseAnonymousFunctionUseClause($functionDefinition); diff --git a/tests/cases/parser/classMethods3.php.tree b/tests/cases/parser/classMethods3.php.tree index a6bc46f..a695491 100644 --- a/tests/cases/parser/classMethods3.php.tree +++ b/tests/cases/parser/classMethods3.php.tree @@ -53,7 +53,7 @@ "textLength": 1 }, "parameters": { - "DelimitedList": { + "ParameterDeclarationList": { "children": [ { "ParameterNode": { diff --git a/tests/cases/parser/classMethods4.php.tree b/tests/cases/parser/classMethods4.php.tree index 7f8a7ef..e09446c 100644 --- a/tests/cases/parser/classMethods4.php.tree +++ b/tests/cases/parser/classMethods4.php.tree @@ -53,7 +53,7 @@ "textLength": 1 }, "parameters": { - "DelimitedList": { + "ParameterDeclarationList": { "children": [ { "ParameterNode": { diff --git a/tests/cases/parser/functions10.php.tree b/tests/cases/parser/functions10.php.tree index 834e026..1dc0590 100644 --- a/tests/cases/parser/functions10.php.tree +++ b/tests/cases/parser/functions10.php.tree @@ -27,7 +27,7 @@ "textLength": 1 }, "parameters": { - "DelimitedList": { + "ParameterDeclarationList": { "children": [ { "ParameterNode": { diff --git a/tests/cases/parser/functions11.php.tree b/tests/cases/parser/functions11.php.tree index 7745b33..dceff7b 100644 --- a/tests/cases/parser/functions11.php.tree +++ b/tests/cases/parser/functions11.php.tree @@ -27,7 +27,7 @@ "textLength": 1 }, "parameters": { - "DelimitedList": { + "ParameterDeclarationList": { "children": [ { "ParameterNode": { diff --git a/tests/cases/parser/functions12.php.tree b/tests/cases/parser/functions12.php.tree index 1615a1a..dbe0c8f 100644 --- a/tests/cases/parser/functions12.php.tree +++ b/tests/cases/parser/functions12.php.tree @@ -27,7 +27,7 @@ "textLength": 1 }, "parameters": { - "DelimitedList": { + "ParameterDeclarationList": { "children": [ { "ParameterNode": { diff --git a/tests/cases/parser/functions13.php.tree b/tests/cases/parser/functions13.php.tree index cdb6492..ca9fbd0 100644 --- a/tests/cases/parser/functions13.php.tree +++ b/tests/cases/parser/functions13.php.tree @@ -27,7 +27,7 @@ "textLength": 1 }, "parameters": { - "DelimitedList": { + "ParameterDeclarationList": { "children": [ { "ParameterNode": { diff --git a/tests/cases/parser/functions14.php.tree b/tests/cases/parser/functions14.php.tree index 9724d8d..81b61e0 100644 --- a/tests/cases/parser/functions14.php.tree +++ b/tests/cases/parser/functions14.php.tree @@ -27,7 +27,7 @@ "textLength": 1 }, "parameters": { - "DelimitedList": { + "ParameterDeclarationList": { "children": [ { "ParameterNode": { diff --git a/tests/cases/parser/functions15.php.tree b/tests/cases/parser/functions15.php.tree index 99e5f05..a3e5477 100644 --- a/tests/cases/parser/functions15.php.tree +++ b/tests/cases/parser/functions15.php.tree @@ -27,7 +27,7 @@ "textLength": 1 }, "parameters": { - "DelimitedList": { + "ParameterDeclarationList": { "children": [ { "ParameterNode": { diff --git a/tests/cases/parser/functions16.php.tree b/tests/cases/parser/functions16.php.tree index b2d4be9..1904eea 100644 --- a/tests/cases/parser/functions16.php.tree +++ b/tests/cases/parser/functions16.php.tree @@ -27,7 +27,7 @@ "textLength": 1 }, "parameters": { - "DelimitedList": { + "ParameterDeclarationList": { "children": [ { "ParameterNode": { diff --git a/tests/cases/parser/functions3.php.tree b/tests/cases/parser/functions3.php.tree index fb5d46b..ca52911 100644 --- a/tests/cases/parser/functions3.php.tree +++ b/tests/cases/parser/functions3.php.tree @@ -27,7 +27,7 @@ "textLength": 1 }, "parameters": { - "DelimitedList": { + "ParameterDeclarationList": { "children": [ { "ParameterNode": { diff --git a/tests/cases/parser/functions6.php.tree b/tests/cases/parser/functions6.php.tree index dda9c9c..e88f52b 100644 --- a/tests/cases/parser/functions6.php.tree +++ b/tests/cases/parser/functions6.php.tree @@ -27,7 +27,7 @@ "textLength": 1 }, "parameters": { - "DelimitedList": { + "ParameterDeclarationList": { "children": [ { "ParameterNode": { diff --git a/tests/cases/parser/functions7.php.tree b/tests/cases/parser/functions7.php.tree index bb4511c..3df8b8f 100644 --- a/tests/cases/parser/functions7.php.tree +++ b/tests/cases/parser/functions7.php.tree @@ -27,7 +27,7 @@ "textLength": 1 }, "parameters": { - "DelimitedList": { + "ParameterDeclarationList": { "children": [ { "ParameterNode": { diff --git a/tests/cases/parser/functions8.php.tree b/tests/cases/parser/functions8.php.tree index 9627114..b5cef97 100644 --- a/tests/cases/parser/functions8.php.tree +++ b/tests/cases/parser/functions8.php.tree @@ -27,7 +27,7 @@ "textLength": 1 }, "parameters": { - "DelimitedList": { + "ParameterDeclarationList": { "children": [ { "ParameterNode": { diff --git a/tests/cases/parser/functions9.php.tree b/tests/cases/parser/functions9.php.tree index 996fa3c..bba2343 100644 --- a/tests/cases/parser/functions9.php.tree +++ b/tests/cases/parser/functions9.php.tree @@ -27,7 +27,7 @@ "textLength": 1 }, "parameters": { - "DelimitedList": { + "ParameterDeclarationList": { "children": [ { "ParameterNode": { diff --git a/tests/cases/parser/interfaceDeclaration10.php.tree b/tests/cases/parser/interfaceDeclaration10.php.tree index f79c748..e68e193 100644 --- a/tests/cases/parser/interfaceDeclaration10.php.tree +++ b/tests/cases/parser/interfaceDeclaration10.php.tree @@ -56,7 +56,7 @@ "textLength": 1 }, "parameters": { - "DelimitedList": { + "ParameterDeclarationList": { "children": [ { "ParameterNode": { diff --git a/tests/cases/parser/interfaceDeclaration8.php.tree b/tests/cases/parser/interfaceDeclaration8.php.tree index 0f07d99..9aea19c 100644 --- a/tests/cases/parser/interfaceDeclaration8.php.tree +++ b/tests/cases/parser/interfaceDeclaration8.php.tree @@ -56,7 +56,7 @@ "textLength": 1 }, "parameters": { - "DelimitedList": { + "ParameterDeclarationList": { "children": [ { "ParameterNode": { diff --git a/tests/cases/parser/interfaceDeclaration9.php.tree b/tests/cases/parser/interfaceDeclaration9.php.tree index 60cbae6..453f1ab 100644 --- a/tests/cases/parser/interfaceDeclaration9.php.tree +++ b/tests/cases/parser/interfaceDeclaration9.php.tree @@ -56,7 +56,7 @@ "textLength": 1 }, "parameters": { - "DelimitedList": { + "ParameterDeclarationList": { "children": [ { "ParameterNode": {