<?php class A {protected $a = 'A';} class B1 extends A {} class B2 extends A {protected $a = 'B';} class C extends A { public function foo(A $a) { echo $a->a; // will fail depends on $a implementation // liskov substitution principle failed } } $a = new A(); $b1 = new B1(); $b2 = new B2(); $c = new C(); $c->foo($b1); // ok $c->foo($b2); // not ok?
You have javascript disabled. You will not be able to edit any code.
Generated using Vulcan Logic Dumper, using php 8.0.0