Den 2021-08-25 kl. 12:02, skrev Nikita Popov:
Hi internals,

I'd like to propose the deprecation of "dynamic properties", that is
properties that have not been declared in the class (stdClass and
__get/__set excluded, of course):

https://wiki.php.net/rfc/deprecate_dynamic_properties

This has been discussed in various forms in the past, e.g. in
https://wiki.php.net/rfc/locked-classes as a class modifier and
https://wiki.php.net/rfc/namespace_scoped_declares /
https://github.com/nikic/php-rfcs/blob/language-evolution/rfcs/0000-language-evolution.md
as a declare directive.

This RFC takes the more direct route of deprecating this functionality
entirely. I expect that this will have relatively little impact on modern
code (e.g. in Symfony I could fix the vast majority of deprecation warnings
with a three-line diff), but may have a big impact on legacy code that
doesn't declare properties at all.

Regards,
Nikita

I'm in favour of the proposal as long as the stdClass is leaved as is!
For declared classes I think it's a good idea.

We have legacy code that is littered with dynamic properties using
stdClass. It runs today on PHP 7.4.22 and we plan to migrate to PHP 8
as soon as some Open source libraries works under PHP 8.

Being forced to rewrite this if this proposal changes to also disallow
stdClass dynamic properties would have zero benefits for the app itself
and only incur a cost.

Regards //Björn L

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to