Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow using readonly as function name #7468

Closed
wants to merge 1 commit into from

Commits on Sep 6, 2021

  1. Allow using readonly as function name

    Don't treat "readonly" as a keyword if followed by "(". This
    allows using it as a global function name. In particular, this
    function has been used by WordPress.
    
    This does not allow other uses of "readonly", in particular it
    cannot be used as a class name, unlike "enum". The reason is that
    we'd still have to recognize it as a keyword when using in a type
    position:
    
        class Test {
            public ReadOnly $foo;
        }
    
    This should now be interpreted as a readonly property, not as a
    read-write property with type `ReadOnly`. As such, a class with
    name `ReadOnly`, while unambiguous in most other circumstances,
    would not be usable as property or parameter type. For that
    reason, we do not support it at all.
    nikic committed Sep 6, 2021
    Configuration menu
    Copy the full SHA
    7e2f6e7 View commit details
    Browse the repository at this point in the history