On Fri, Nov 12, 2021 at 5:08 AM Nikita Popov <nikita....@gmail.com> wrote:
>
> Hi internals,
>
> I've opened the vote on
> https://wiki.php.net/rfc/deprecate_dynamic_properties. Voting will close
> 2021-11-26.
>
> Regards,
> Nikita

In the Motivation section when talking about static analysis the RFC
makes the claim:

> The #[AllowDynamicProperties] attribute proposed in this RFC makes the cases 
> where dynamic properties are used intentionally explicit.

however this really isn't true as the attribute is on the class rather
than the use. Static analysis will still have no idea whether any
dynamic property assignment is indeed a bug or intentional. The
information added is only whether the author of the class has deemed
it okay for dynamic properties to be used on it, not by it. The class
author and the dynamic property user might not be the same person or
have any relation. The class being intentionally used with dynamic
properties is not necessarily in the user's control. Similarly the
class being unintentionally used with dynamic properties may not be
either.

This user/used mismatch is repeated in the RFC, for example:

> Classes marked with #[AllowDynamicProperties] as well as their children can 
> continue using dynamic properties without deprecation or removal.

These classes cannot then use dynamic properties, they can have
dynamic properties used on them.

The inaccurate prevention claim is repeated as well:

> #[AllowDynamicProperties] requires making classes that rely on dynamic 
> properties explicit and prevents accidental use of dynamic properties

It may help prevent some, but others can skate through on happenstance.

Cheers,
Paul

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

Reply via email to