Re: [VOTE] Deprecate dynamic properties
| From: | Peter Bowyer | Date: | Sat, 13 Nov 2021 08:26:31 +0000 |
| Subject: | Re: [VOTE] Deprecate dynamic properties | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-116338@lists.php.net to get a copy of this message | ||
On Sat, 13 Nov 2021, 00:14 Christoph M. Becker, <cmbecker69@gmx.de> wrote:
> Offering an
> opt-out of dynamic properties or some switch to disable the deprecation
> would not help in that regard.
>
Given this is a big change to the way PHP has behaved for decades I did
wonder why the RFC didn't propose an opt-out of dynamic properties rather
than opt-in, preserving the long-term language behaviour. So thanks for
covering that.
I think you and the PHP internals community will be surprised by how widely
used dynamic properties are. I read through a handful of WordPress plugins
we have installed and found a few. And in my own where I'm using a named
class instead of an array.
I work with modern framework based code most of the time and I find it easy
to forget what is out there as quintessential or traditional PHP code.
Whether we have #[AllowDynamicProperties] or #[DenyDynamicProperties] one
set of PHP users is going to be doing a find & replace across their
codebase.
From a DX perspective I'd rather have #[DenyDynamicProperties] as it's like
declaring strict_mode and opt-in.
Either way are the planned engine changes feasible, as the feature of
dynamic properties stays in the language but toggled off/on per class?
Peter
>