Skip to content

Commit

Permalink
Base enum label validity on constant name rule
Browse files Browse the repository at this point in the history
  • Loading branch information
kylekatarnls committed Mar 3, 2023
1 parent 31be7cd commit c1cd664
Showing 1 changed file with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8173,17 +8173,12 @@ private function parseEnumCase()
$this->tokenStack->add($this->tokenizer->next());
$this->tokenStack->push();
$this->consumeComments();
$caseName = $this->tokenizer->currentToken()->image;

if (in_array($this->tokenizer->peek(), array(
Tokens::T_NEW,
Tokens::T_NULL,
Tokens::T_STRING,
Tokens::T_DEFAULT
), true) === false) {
if (!preg_match('/^[a-zA-Z_\x80-\xff][a-zA-Z0-9_\x80-\xff]*$/', $caseName)) {
throw $this->getUnexpectedTokenException();
}

$caseName = $this->tokenizer->currentToken()->image;
$this->tokenStack->add($this->tokenizer->next());
$this->consumeComments();
$case = $this->builder->buildEnumCase($caseName, $this->parseEnumCaseValue());
Expand Down

0 comments on commit c1cd664

Please sign in to comment.