#
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 ...
|