Deprecate dynamic property creation with #[AllowDynamicProperties] escape hatch#7571
Deprecate dynamic property creation with #[AllowDynamicProperties] escape hatch#7571nikic wants to merge 9 commits intophp:masterfrom
Conversation
10a0286 to
a65dcea
Compare
f90e5d6 to
1d6be97
Compare
TysonAndre
left a comment
There was a problem hiding this comment.
I had some minor comments/questions, easily fixable
|
While leaving the merits of this change to the voters, we had a technical question about this implementation. Our framework uses dynamic properties to load models in a base class which all user app extend for each MVC + route connection. This is sometimes done with a trait in the child class and sometimes automatically in the base class. Will this evaluate the |
The attribute also affects child classes. Quoting from the RFC:
If you add the attribute to the base class, then all classes that inherit from it can use dynamic properties as well. (You do need to extend from it -- using a trait with the attribute or implementing an interface with the attribute won't have an effect. And now that I say that, the implementation should probably explicitly forbid doing that.) |
|
(Comment deleted and replaced with message to php internals list: https://news-web.php.net/php.internals/116519 ) |
f87f850 to
981a491
Compare
These would have no effect -- for the sake of clarity, reject them outright.
Per Tyson's request.
Also switch it to use de_DE, which is more standard in our test suite.
981a491 to
536d440
Compare
|
Merged as 902d643. |
This is a variant of #7390 that adds an
#[AllowDynamicProperties]escape hatch, to explicitly allow using dynamic properties on a class without deprecation.RFC: https://wiki.php.net/rfc/deprecate_dynamic_properties
TODO: Plaster
#[AllowDynamicProperties]over large swathes of tests.