mirror of
https://github.com/nikic/PHP-Parser.git
synced 2025-01-17 07:08:14 +01:00
Rename ParserAbstract method checkPropertyHookList to checkEmptyPropertyHookList
This commit is contained in:
parent
b396e9e0d6
commit
62dee28027
@ -840,7 +840,7 @@ class_statement:
|
|||||||
#if PHP8
|
#if PHP8
|
||||||
| optional_attributes variable_modifiers optional_type_without_static property_declaration_list '{' property_hook_list '}'
|
| optional_attributes variable_modifiers optional_type_without_static property_declaration_list '{' property_hook_list '}'
|
||||||
{ $$ = new Stmt\Property($2, $4, attributes(), $3, $1, $6);
|
{ $$ = new Stmt\Property($2, $4, attributes(), $3, $1, $6);
|
||||||
$this->checkPropertyHookList($6, #5); }
|
$this->checkEmptyPropertyHookList($6, #5); }
|
||||||
#endif
|
#endif
|
||||||
| optional_attributes method_modifiers T_CONST class_const_list semi
|
| optional_attributes method_modifiers T_CONST class_const_list semi
|
||||||
{ $$ = new Stmt\ClassConst($4, $2, attributes(), $1);
|
{ $$ = new Stmt\ClassConst($4, $2, attributes(), $1);
|
||||||
@ -949,7 +949,7 @@ property_hook_list:
|
|||||||
optional_property_hook_list:
|
optional_property_hook_list:
|
||||||
/* empty */ { $$ = []; }
|
/* empty */ { $$ = []; }
|
||||||
#if PHP8
|
#if PHP8
|
||||||
| '{' property_hook_list '}' { $$ = $2; $this->checkPropertyHookList($2, #1); }
|
| '{' property_hook_list '}' { $$ = $2; $this->checkEmptyPropertyHookList($2, #1); }
|
||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -1993,7 +1993,7 @@ class Php8 extends \PhpParser\ParserAbstract
|
|||||||
},
|
},
|
||||||
348 => static function ($self, $stackPos) {
|
348 => static function ($self, $stackPos) {
|
||||||
$self->semValue = new Stmt\Property($self->semStack[$stackPos-(7-2)], $self->semStack[$stackPos-(7-4)], $self->getAttributes($self->tokenStartStack[$stackPos-(7-1)], $self->tokenEndStack[$stackPos]), $self->semStack[$stackPos-(7-3)], $self->semStack[$stackPos-(7-1)], $self->semStack[$stackPos-(7-6)]);
|
$self->semValue = new Stmt\Property($self->semStack[$stackPos-(7-2)], $self->semStack[$stackPos-(7-4)], $self->getAttributes($self->tokenStartStack[$stackPos-(7-1)], $self->tokenEndStack[$stackPos]), $self->semStack[$stackPos-(7-3)], $self->semStack[$stackPos-(7-1)], $self->semStack[$stackPos-(7-6)]);
|
||||||
$self->checkPropertyHookList($self->semStack[$stackPos-(7-6)], $stackPos-(7-5));
|
$self->checkEmptyPropertyHookList($self->semStack[$stackPos-(7-6)], $stackPos-(7-5));
|
||||||
},
|
},
|
||||||
349 => static function ($self, $stackPos) {
|
349 => static function ($self, $stackPos) {
|
||||||
$self->semValue = new Stmt\ClassConst($self->semStack[$stackPos-(5-4)], $self->semStack[$stackPos-(5-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(5-1)], $self->tokenEndStack[$stackPos]), $self->semStack[$stackPos-(5-1)]);
|
$self->semValue = new Stmt\ClassConst($self->semStack[$stackPos-(5-4)], $self->semStack[$stackPos-(5-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(5-1)], $self->tokenEndStack[$stackPos]), $self->semStack[$stackPos-(5-1)]);
|
||||||
@ -2122,7 +2122,7 @@ class Php8 extends \PhpParser\ParserAbstract
|
|||||||
$self->semValue = [];
|
$self->semValue = [];
|
||||||
},
|
},
|
||||||
394 => static function ($self, $stackPos) {
|
394 => static function ($self, $stackPos) {
|
||||||
$self->semValue = $self->semStack[$stackPos-(3-2)]; $self->checkPropertyHookList($self->semStack[$stackPos-(3-2)], $stackPos-(3-1));
|
$self->semValue = $self->semStack[$stackPos-(3-2)]; $self->checkEmptyPropertyHookList($self->semStack[$stackPos-(3-2)], $stackPos-(3-1));
|
||||||
},
|
},
|
||||||
395 => static function ($self, $stackPos) {
|
395 => static function ($self, $stackPos) {
|
||||||
$self->semValue = new Node\PropertyHook($self->semStack[$stackPos-(5-4)], $self->semStack[$stackPos-(5-5)], ['flags' => $self->semStack[$stackPos-(5-2)], 'byRef' => $self->semStack[$stackPos-(5-3)], 'params' => [], 'attrGroups' => $self->semStack[$stackPos-(5-1)]], $self->getAttributes($self->tokenStartStack[$stackPos-(5-1)], $self->tokenEndStack[$stackPos]));
|
$self->semValue = new Node\PropertyHook($self->semStack[$stackPos-(5-4)], $self->semStack[$stackPos-(5-5)], ['flags' => $self->semStack[$stackPos-(5-2)], 'byRef' => $self->semStack[$stackPos-(5-3)], 'params' => [], 'attrGroups' => $self->semStack[$stackPos-(5-1)]], $self->getAttributes($self->tokenStartStack[$stackPos-(5-1)], $self->tokenEndStack[$stackPos]));
|
||||||
|
@ -1159,7 +1159,7 @@ abstract class ParserAbstract implements Parser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** @param PropertyHook[] $hooks */
|
/** @param PropertyHook[] $hooks */
|
||||||
protected function checkPropertyHookList(array $hooks, int $hookPos): void {
|
protected function checkEmptyPropertyHookList(array $hooks, int $hookPos): void {
|
||||||
if (empty($hooks)) {
|
if (empty($hooks)) {
|
||||||
$this->emitError(new Error(
|
$this->emitError(new Error(
|
||||||
'Property hook list cannot be empty', $this->getAttributesAt($hookPos)));
|
'Property hook list cannot be empty', $this->getAttributesAt($hookPos)));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user