History log of /PHP-8.2/Zend/tests/readonly_function.phpt (Results 1 – 2 of 2)
Revision Date Author Comments
# 08b75395 08-Sep-2022 Ilija Tovilo

Fix syntax error when dnf type in parens after readonly

Fixes GH-9500
Closes GH-9512


# 76348f33 06-Sep-2021 Nikita Popov

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 us

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.

show more ...