Elao / PhpEnums

:nut_and_bolt: Extended PHP 8.1+ enums features & specific integrations with frameworks and libraries
MIT License
326 stars 27 forks source link

$lexer->lookahead array acces is deprecated. #225

Open laurentmuller opened 1 year ago

laurentmuller commented 1 year ago

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) {
        // ....
    }
}
ogizanagi commented 1 year ago

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