denzyldick / phanalist

Performant static analyzer for PHP, which is extremely easy to use. It helps you catch common mistakes in your PHP code.
https://denzyldick.github.io/phanalist/
MIT License
126 stars 5 forks source link

E0012 #47

Closed SerheyDolgushev closed 6 months ago

SerheyDolgushev commented 6 months ago

Detect services that update their properties dynamically. It should be useful for swoole updates.

SerheyDolgushev commented 6 months ago

@denzyldick can you please update the status of this one to "In Progress"?

denzyldick commented 6 months ago

I just found out that PHP 8.0 supports this attribute #[AllowDynamicProperties].

I don't think there is a way to detect which version of PHP is being scanned. I don't see the need for this attribute. What do you think? Ignoring this attribute should probably be a setting.

SerheyDolgushev commented 6 months ago

This rule is about determining if there are any dynamic properties (even defined) are set for the services. Which is problematic for Swoole. I will provide more details later, but it is a bit different to AllowDynamicProperties attribute.

SerheyDolgushev commented 6 months ago

@denzyldick I have just pushed https://github.com/SerheyDolgushev/php-shared-memory-model it describes the problem that I want to solve with this new rule. Basically, when you migrate to Swoole/RoadRunner you need to get rid of "properties set in the services" (not sure what is the best name for such properties). I used Symfony as a simple example, but it is reproducible in other use-cases.

SerheyDolgushev commented 6 months ago

Implemented in https://github.com/denzyldick/phanalist/pull/51