Skip to content

[code-quality] Make ctor defined dynamic properties private, as most probably case #7036

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

Merged
merged 4 commits into from
Jul 1, 2025

Conversation

TomasVotruba
Copy link
Member

@TomasVotruba TomasVotruba commented Jul 1, 2025

I've just run this rule on a legacy codebase and it's missing features:

  • when a property is defined in constructor, it should be private by default, as its only missing
  • if it uses PHP 7.4 and type is scalar, it should be added instead of no typed or mixed

@TomasVotruba TomasVotruba force-pushed the tv-complete-ctor-setup-private branch from e2bf67f to 76ccbf9 Compare July 1, 2025 10:08
@TomasVotruba TomasVotruba changed the title tv complete ctor setup private [code-quality] Make ctor defined dynamic properties private, as most probably case Jul 1, 2025
@TomasVotruba TomasVotruba merged commit 251dcf3 into main Jul 1, 2025
46 checks passed
@TomasVotruba TomasVotruba deleted the tv-complete-ctor-setup-private branch July 1, 2025 10:17
@samsonasik
Copy link
Member

I think this should be configurable, while for application, it mostly correct, on framework, it mostly cause bc break, I will create PR for it.

@TomasVotruba
Copy link
Member Author

Let's keep it as it is, untill reported otherwise 👍 I want to test defaults in the wild, before overconfiguring every rule :)

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