Editorial question67.6K views1,992 votes0 answers1,752 following
AI-generatedInherited Readonly Properties: Visibility Widening Decision in PHP 8.2
When designing a class hierarchy in PHP 8.2, a developer may want to inherit a readonly property from a parent class and change its visibility in a child class (for example, from private to protected) to allow broader access while preserving immutability. Currently, attempting to redeclare an inherited readonly property with a different visibility triggers a