> Le 17 nov. 2023 à 11:47, Rowan Tommins <rowan.coll...@gmail.com> a écrit :
>
> On 16 November 2023 21:38:48 GMT, Jakub Zelenka <bu...@php.net> wrote:
>> This sounds like a huge BC break. Probably bigger and a bit harder to fix
>> than disallowing dynamic props.
>
> More common, maybe; but trivial to fix: add "=null" at the end of all untyped
> property declarations that don't already have an initializer. It would be
> trivial to automate with something like Rector.
>
The fix is trivial, but the number of files to be touched is huge.
>
>> Maybe it would be better to do this as some sort of opt in behaviour
>
> We already have the opt-in behaviour: add "mixed" to a property declaration,
> and it no longer gets initialized to null. [...]
>
Yes, except that an untyped (respectively `mixed`) property cannot be
redeclared as `mixed` (resp. untyped) in a subclass. A small step in the right
direction is to allow that.
—Claude
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php