Re: Protected inheritance hierarchies
| From: | Claude Pache | Date: | Fri, 08 Aug 2025 07:13:09 +0000 |
| Subject: | Re: Protected inheritance hierarchies | ||
| References: | 1 2 3 | Groups: | php.internals php.internals |
| Request: | Send a blank email to internals+get-128433@lists.php.net to get a copy of this message | ||
> Le 7 août 2025 à 20:37, Jonathan Vollebregt <jnv@jnvsor.net> a écrit :
>
>
> Back to the original issue: I'm going to open a github issue on this since it's
> clearly a bug and I don't see fixing it breaking any existing code.
Hi,
Sorry to reply without completely reading this long thread.
As many of us understand it, the application of Liskov Substitution Principle indeed shows that, if
you can access a member declared in a given class from a given context, you ought also be able to
access the same member when it is redeclared in a subclass.
This is true whether the member is concretly a method, a property or a constant, or whether it is
static or not.
I am writing this to draw the attention that the issue should be resolved not only for protected
properties, but also for protected constants.
Test cases currently passed:
protected method: https://3v4l.org/LmLLu
protected static method: https://3v4l.org/vjllN
Test cases currently in failure:
protected property: https://3v4l.org/br0tj
protected static property: https://3v4l.org/2Ue97
protected constant: https://3v4l.org/jXm6U
—Claude