Skip to content

Commit e1ca11a

Browse files
committed
TASK: Ignore phpstan issues in EnumMemberDeclarationNode
Reason: phpstan appears to be unable to account for the mutability of iterables and assumes here that both statements that read `Scanner::type($tokens)` will return the same result, even though in fact, `$tokens` has been mutated in the meantime. Maybe related: phpstan/phpstan#8337
1 parent 67f99c3 commit e1ca11a

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/Parser/Ast/EnumMemberDeclarationNode.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,13 @@ public static function fromTokens(\Iterator $tokens): self
5151
if (Scanner::type($tokens) === TokenType::BRACKET_ROUND_OPEN) {
5252
Scanner::skipOne($tokens);
5353
$value = match (Scanner::type($tokens)) {
54+
/** @phpstan-ignore-next-line */
5455
TokenType::STRING_QUOTED => StringLiteralNode::fromTokens($tokens),
56+
/** @phpstan-ignore-next-line */
5557
TokenType::NUMBER_DECIMAL => NumberLiteralNode::fromTokens($tokens),
5658
default => throw new \Exception('@TODO: Unexpected Token ' . Scanner::type($tokens)->value)
5759
};
60+
/** @phpstan-ignore-next-line */
5861
Scanner::assertType($tokens, TokenType::BRACKET_ROUND_CLOSE);
5962
Scanner::skipOne($tokens);
6063
}

0 commit comments

Comments
 (0)