Skip to content

Commit

Permalink
Fixed: Allow list/empty as method and constant name
Browse files Browse the repository at this point in the history
  • Loading branch information
Manuel Pichler committed Nov 23, 2016
1 parent 8e3fb78 commit 962b2cd
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6111,11 +6111,11 @@ protected function parseConstantDeclarator()
$this->tokenStack->push();

$tokenType = $this->tokenizer->peek();
if (false === $this->isKeyword($tokenType)) {

if (false === $this->isMethodName($tokenType)) {
$this->throwUnexpectedTokenException();
}

$token = $this->consumeToken(Tokens::T_STRING);
$token = $this->consumeToken($tokenType);

$this->consumeComments();
$this->consumeToken(Tokens::T_EQUAL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ abstract class PHPParserVersion70 extends PHPParserVersion56
protected function isMethodName($tokenType)
{
switch ($tokenType) {
case Tokens::T_EMPTY:
case Tokens::T_LIST:
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,18 @@ class PHPTokenizerInternal implements Tokenizer
),

Tokens::T_CALLABLE => array(
Tokens::T_OBJECT_OPERATOR => Tokens::T_STRING,
Tokens::T_OBJECT_OPERATOR => Tokens::T_STRING,
Tokens::T_DOUBLE_COLON => Tokens::T_STRING,
),

Tokens::T_LIST => array(
Tokens::T_OBJECT_OPERATOR => Tokens::T_STRING,
Tokens::T_DOUBLE_COLON => Tokens::T_STRING,
),

Tokens::T_EMPTY => array(
Tokens::T_OBJECT_OPERATOR => Tokens::T_STRING,
Tokens::T_DOUBLE_COLON => Tokens::T_STRING,
),

Tokens::T_CLASS => array(
Expand Down

0 comments on commit 962b2cd

Please sign in to comment.