Skip to content

Conversation

@calebdw
Copy link
Contributor

@calebdw calebdw commented Aug 7, 2025

Hello!

This Rector removes the readonly visibility modifier from properties in classes that are already marked as readonly. This is useful for cleaning up code where the readonly modifier is redundant due to the class's readonly status.

Thanks!

@TomasVotruba
Copy link
Member

Hey, good work 👌

Last step is to register rule in the set:
https://github.com/rectorphp/rector-src/blob/main/src/Config/Level/CodeQualityLevel.php

And apply on the codebase. Let's see what it finds here :)

@calebdw
Copy link
Contributor Author

calebdw commented Aug 7, 2025

Sounds good---is there any preference on where the rule is added in the set? Are rules just appended or should it go near the front since it's relatively safe?

@calebdw calebdw force-pushed the calebdw/push-vtxlpxnpnpwk branch from ed995fe to 341f25b Compare August 7, 2025 05:01
@TomasVotruba
Copy link
Member

Anywhere where you'd expect it.

Rebase and force push make it harder for me to review new changes. Ideally keep new changes in separated commits.

@calebdw
Copy link
Contributor Author

calebdw commented Aug 7, 2025

Should be good to go then, I ran the rector and it didn't find any instances in this codebase

Rebase and force push make it harder for me to review new changes. Ideally keep new changes in separated commits.

I'll try to keep this in mind, but Github offers a quick way to review the interdiff:

image

@calebdw calebdw force-pushed the calebdw/push-vtxlpxnpnpwk branch from 341f25b to 2c77a94 Compare August 7, 2025 13:51
This Rector removes the `readonly` visibility modifier from properties
in classes that are already marked as `readonly`. This is useful for
cleaning up code where the `readonly` modifier is redundant due to the
class's readonly status.
@calebdw calebdw force-pushed the calebdw/push-vtxlpxnpnpwk branch from 2c77a94 to 48d3b5c Compare August 7, 2025 14:24
@samsonasik
Copy link
Member

Let's give it a try, thank you @calebdw

@samsonasik samsonasik merged commit ac4f09b into rectorphp:main Aug 7, 2025
47 checks passed
@calebdw calebdw deleted the calebdw/push-vtxlpxnpnpwk branch August 7, 2025 14:30
@github-actions
Copy link
Contributor

This pull request has been automatically locked because it has been closed for 150 days. Please open a new PR if you want to continue the work.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 11, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants