You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Reducing the set visibility of a property (private(set), protected(set)) is not reported #1020
PHP 8.4 asymmetric visibility allows restricting who can write to a property (public private(set), public protected(set), ...). Reducing the set visibility of an existing property isn't reported, but it breaks every write from the scopes that lost access:
The same applies to public protected(set) (breaks writes from outside the class hierarchy), and to protected(set) → private(set) or protected → protected private(set) in non-final classes, which breaks writes from child classes.
The tool currently reports nothing for any of these changes: PropertyVisibilityReduced only compares the read visibility.
A PropertySetVisibilityReduced check, run wherever PropertyVisibilityReduced runs, would cover this. BetterReflection already exposes ReflectionProperty#isPrivateSet() and #isProtectedSet(). A few cases should not be reported (or are already reported elsewhere):
a symmetric visibility reduction (e.g. public → protected), already reported by PropertyVisibilityReduced
a property becoming readonly, which is implicitly protected(set) and already reported by PropertyBecameReadonly
protected(set) → private(set) in a final class, which has no child classes
Activity