On Mon, Nov 15, 2021 at 11:21 AM Larry Garfield <la...@garfieldtech.com>
wrote:

> A possible idea to help make this transition (which I do support) more
> gradual:
>
> Instead of an "allow" attribute, introduce a boolean flag attribute.
>
> #[DynamicProperties(true)]
> class Beep {}
>
> The attribute marks whether dynamic properties are enabled or disabled via
> boolean.  If disabled, then they're an error if used.
>
> 8.2: Introduce the attribute, with a default of TRUE.  Exactly zero code
> breaks, but people can start adding the attribute now.  That means people
> who want to lock-out dynamic properties can do so starting now, and those
> cases that do need them (or can't easily get away from them) can be flagged
> far in advance.
> 8.something: Change the default to FALSE.  Using dynamic properties when
> false throws a deprecation, not an error.  People have had some number of
> years to add the attribute either direction if desired.
>

This is exactly what Nikita is proposing, except that instead of the
attribute being introduced in PHP 8.2, he's proposing to introduce it
EARLIER.  Roughly PHP 2 sort of timeframe.

This is because attributes are forward compatible by design and developers
can already start adding #[AllowDynamicProperties] to their code NOW.  Even
their code that was written to run cleanly on PHP 5.6 because users are
terrible at upgrading their servers despite a 2x performance increase.
</rant>

The point is, we don't need 8.2 to be a soft-launch before deprecation
because precisely nobody is prevented from adding this attribute
preemptively.

-Sara

Reply via email to