From ba788aa98b9f20ebe2bfdbaec152eca69636943d Mon Sep 17 00:00:00 2001 From: PavelSPN <33983132+PavelSPN@users.noreply.github.com> Date: Fri, 19 May 2023 22:26:12 +0200 Subject: [PATCH] Remove redundant parameter Closes #920. --- grammar/php5.y | 2 +- grammar/php7.y | 2 +- lib/PhpParser/Parser/Php5.php | 2 +- lib/PhpParser/Parser/Php7.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/grammar/php5.y b/grammar/php5.y index 2920dead..77e4fb7e 100644 --- a/grammar/php5.y +++ b/grammar/php5.y @@ -1008,7 +1008,7 @@ array_pair: | expr { $$ = Expr\ArrayItem[$1, null, false]; } | expr T_DOUBLE_ARROW ampersand variable { $$ = Expr\ArrayItem[$4, $1, true]; } | ampersand variable { $$ = Expr\ArrayItem[$2, null, true]; } - | T_ELLIPSIS expr { $$ = Expr\ArrayItem[$2, null, false, attributes(), true]; } + | T_ELLIPSIS expr { $$ = new Expr\ArrayItem($2, null, false, attributes(), true); } ; encaps_list: diff --git a/grammar/php7.y b/grammar/php7.y index fc7862c3..2d65d484 100644 --- a/grammar/php7.y +++ b/grammar/php7.y @@ -1194,7 +1194,7 @@ array_pair: | expr T_DOUBLE_ARROW expr { $$ = Expr\ArrayItem[$3, $1, false]; } | expr T_DOUBLE_ARROW ampersand variable { $$ = Expr\ArrayItem[$4, $1, true]; } | expr T_DOUBLE_ARROW list_expr { $$ = Expr\ArrayItem[$3, $1, false]; } - | T_ELLIPSIS expr { $$ = Expr\ArrayItem[$2, null, false, attributes(), true]; } + | T_ELLIPSIS expr { $$ = new Expr\ArrayItem($2, null, false, attributes(), true); } | /* empty */ { $$ = null; } ; diff --git a/lib/PhpParser/Parser/Php5.php b/lib/PhpParser/Parser/Php5.php index 351db9ed..a4306710 100644 --- a/lib/PhpParser/Parser/Php5.php +++ b/lib/PhpParser/Parser/Php5.php @@ -2627,7 +2627,7 @@ class Php5 extends \PhpParser\ParserAbstract $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(2-2)], null, true, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); }, 552 => function ($stackPos) { - $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(2-2)], null, false, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes, true, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(2-2)], null, false, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes, true); }, 553 => function ($stackPos) { $this->semStack[$stackPos-(2-1)][] = $this->semStack[$stackPos-(2-2)]; $this->semValue = $this->semStack[$stackPos-(2-1)]; diff --git a/lib/PhpParser/Parser/Php7.php b/lib/PhpParser/Parser/Php7.php index c6b9abd0..cede4419 100644 --- a/lib/PhpParser/Parser/Php7.php +++ b/lib/PhpParser/Parser/Php7.php @@ -2818,7 +2818,7 @@ class Php7 extends \PhpParser\ParserAbstract $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(3-3)], $this->semStack[$stackPos-(3-1)], false, $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 592 => function ($stackPos) { - $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(2-2)], null, false, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes, true, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(2-2)], null, false, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes, true); }, 593 => function ($stackPos) { $this->semValue = null;