Internals,
I have now opened voting on Undefined Property Error Promotion.
As with your previous RFC, I approve of this in principle, but am
frustrated how little time has been spent considering the edge cases, such
as the ones I mentioned here: https://externals.io/message/117487#117487
It seems to me that we've got an increasingly complicated set of states a
property can be in, depending on whether it's been declared with a type,
without one, or not at all; whether it's had a value assigned to it;
whether it's been unset; etc. If I am struggling to follow the distinctions
between "declared", "defined", "initialised", "dynamic", "nullable" etc,
how will users who start with PHP 9.0 understand why some situations
produce errors and others do not?
Regards,
Rowan Tommins
[IMSoP]
As with your previous RFC, I approve of this in principle, but am
frustrated how little time has been spent considering the edge cases, such
as the ones I mentioned here: https://externals.io/message/117487#117487
Accessing an unset property, which currently emits a warning, will
instead throw an Error.
If a property has already been written to via some mechanism, then the
property exists and this RFC does not apply, no warning or error should
be expected. It's a different responsibility to handle the guards
against writing to one which has not been defined
(AllowDynamicProperties RFC).
Re: Case 4, an untyped property without its own initializer is
effectively defaulted to null.