Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate TypedPropertyFromStrictConstructorReadonlyClassRector as based on docblock and public elements; use private elements and property promotion instead #5049

Merged
merged 2 commits into from
Sep 19, 2023

Conversation

TomasVotruba
Copy link
Member

@TomasVotruba TomasVotruba commented Sep 19, 2023

I'm looking into more complex rules spotted in #5025. It seems this one is going back to the doblock-based logic we try to avoid from. Hence Rector 0.15 blogpost - https://getrector.com/blog/new-in-rector-015-complete-safe-and-known-type-declarations

The Rector upgrade path is based on PHP native features, so the motivation is to rise the PHP version, instead of "backporting" features using markers. Saying that, I'll deprecate this rule and it should be made private, if needed, not to promote docblock based logic.

My appologies this got through my review 🙏

Ref #4552

@TomasVotruba TomasVotruba force-pushed the tv-remove-docblock-readonly-property-rule branch from e554128 to 1481518 Compare September 19, 2023 13:21
@staabm
Copy link
Contributor

staabm commented Sep 19, 2023

this rule is really useful for us. we will port it into our custom rector rule-set

@TomasVotruba
Copy link
Member Author

I'd recommend to use readlonly attribute instead once the PHP version is reached.

@TomasVotruba TomasVotruba force-pushed the tv-remove-docblock-readonly-property-rule branch from 1481518 to 8279ffa Compare September 19, 2023 13:24
@staabm
Copy link
Contributor

staabm commented Sep 19, 2023

I'd recommend to use readlonly attribute instead once the PHP version is reached.

thats the goal in the end. we use @immutable in projects which are not yet on PHP 8.2

…sed on docblock and public elements; use private elements and property promotion instead
@TomasVotruba TomasVotruba enabled auto-merge (squash) September 19, 2023 13:40
@TomasVotruba TomasVotruba merged commit 76611f6 into main Sep 19, 2023
@TomasVotruba TomasVotruba force-pushed the tv-remove-docblock-readonly-property-rule branch from b43d484 to 30ca9a6 Compare September 19, 2023 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants