Skip to content

Conversation

@keradus
Copy link
Member

@keradus keradus commented Dec 12, 2025

Q A
Branch? 6.4
Bug fix? no
New feature? no
Deprecations? no
Issues Fix CS
License MIT

Rule aims to reduce visibility from protected to private, when protected visibility makes no sense (ie in final class).

The rule is widely followed by codebase.
I recommend enabling it (and adding to the Symfony ruleset), as it's followed in almost each file.

There is one file - CacheItem - tha actually relies on "protected" even if class is final, due to having them exposed when serializing.

There are 3 other files where I believe protected was used accidentally, let the CI verify.
update: CI is green


Alternative is to remove the rule to be mentioned at all in local repo config file.

@carsonbot carsonbot added this to the 6.4 milestone Dec 12, 2025
@carsonbot carsonbot changed the title chore: PHP CS Fixer and protected_to_private chore: PHP CS Fixer and protected_to_private Dec 12, 2025
@keradus keradus requested a review from OskarStark as a code owner December 12, 2025 10:50
@nicolas-grekas nicolas-grekas force-pushed the 6.4_protected_to_private branch from 3b050f2 to c98b276 Compare December 14, 2025 07:59
@nicolas-grekas
Copy link
Member

Thank you @keradus.

@nicolas-grekas nicolas-grekas merged commit 6468634 into symfony:6.4 Dec 14, 2025
@keradus keradus deleted the 6.4_protected_to_private branch December 14, 2025 12:26
keradus added a commit to PHP-CS-Fixer/PHP-CS-Fixer that referenced this pull request Dec 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants