Elao/PhpEnums

$lexer->lookahead array acces is deprecated.

laurentmuller opened this issue · 1 comments

We have a deprecation when using the Lexer class with the method lookahead array access:

153x: Accessing Doctrine\Common\Lexer\Token properties via ArrayAccess is deprecated, use the value, type or position property instead (Token.php:104 called by DocParser.php:691, https://github.com/doctrine/lexer/pull/79, package doctrine/lexer) 153x in BackedEnumValueResolverTest::testResolver from Elao\Enum\Tests\Integration\Bridge\Symfony\HttpKernel\Controller\ArgumentResolver

I can not find where the array access is used, but the old code is as following example:

public function parse(Parser $parser): void
{
    // ...
    if (Lexer::T_COMMA === $lexer->lookahead['type']) {
        // ....
    }
}

The public properties must be used instead:

public function parse(Parser $parser): void
{
    // ...
    if (Lexer::T_COMMA === $lexer->lookahead->type) {
        // ....
    }
}

I don't get how it is related to this package though ?