Rules not working for entities using php 8 attributes
aszenz opened this issue · 3 comments
We recently converted our doctrine entities to use php 8 attributes using rector and now we wish to apply some other rules but it seems like many rules don't work on attribute based entities.
I tried TypedPropertyFromColumnTypeRector
rule, and it doesn't work on attribute based entities. It just shows Rector is done!
message without changing anything even though there are many properties left un-typed.
To test I tried the same rule on old annotation based entity and it worked well.
Is there any way to use these rules now or will the attribute based entities require new rules?
Hi, thanks for the question.
Could you share minimal example of what you mean in demo https://getrector.org/demo?
What is the expected result?
The Doctrine entity properties are might not typed automatically, because it would break their nullable contact. It often depends on context how they're used, e.g. with Symfony forms, with ctor construction, with EasyAdminBundle etc.
For this entity it works fine:
https://getrector.org/demo/1ec72f18-78a6-6630-a89d-334dbd12b287
The same entity using attributes it says no change:
https://getrector.org/demo/1ec72f18-25fa-6076-8e94-d77797fe6e88
I see. Could you add failing test fixture (the 2nd demo) in TypedPropertyFromColumnTypeRectorTest
in /Fixture
directory?