On Fri, Feb 14, 2020 at 2:23 PM Máté Kocsis <kocsismat...@gmail.com> wrote:

>
> So far, my biggest question (apart from the name) have been how non-typed
> properties should behave: as they are implicitly initialized to null if
> they don't have an explicit default value (while typed properties remain
> uninitialized), further modifications would be impossible to do on them -
> which would make non-typed final properties almost useless. Nikita
> suggested to just avoid their initialization, but I'd be curious about
> other ideas as well.
>

Considering that PHP 8 will have union types, adding un-typed properties
support seems like a waste of time.

If somebody really wants a `mixed` property to be immutable, they could
write `private immutable null|bool|int|float|string|array|object
$property;`.

That would make implementation straightforward, since you'd expect
`immutable` to be before a type declaration (can be done in the parser,
right?).

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/

Reply via email to