Skip to content

Code broken when final is used as constant/method name #4

@Majkl578

Description

@Majkl578

The following valid code:

class Test
{
    public const FINAL = 123;

    public static function final() {
        echo __METHOD__, PHP_EOL, self::FINAL, PHP_EOL;
    }
}

breaks when BypassFinals is enabled. This is because both the constant and function name are recognized as T_FINAL, but contextually not treated as keywords (modifiers), thanks to context sensitive lexer added in PHP 7.0: https://wiki.php.net/rfc/context_sensitive_lexer

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions