3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public int $v = 2; } class B extends A { public function getValue(A $v): void { echo $v->v; } } class C extends A { public int $v; } $b = new B; $c = new C; $b->getValue($b); $b->getValue($c);
Output for 8.2.29, 8.3.5 - 8.3.25, 8.4.9 - 8.4.12
2 Fatal error: Uncaught Error: Typed property C::$v must not be accessed before initialization in /in/pv39f:9 Stack trace: #0 /in/pv39f(20): B->getValue(Object(C)) #1 {main} thrown in /in/pv39f on line 9
Process exited with code 255.

preferences:
42.37 ms | 406 KiB | 5 Q