3v4l.org

run code in 500+ PHP versions simultaneously
<?php class SkipNonFinalClassProtectedProperty { public function __construct(protected object $x) { } } class SomeChild extends SkipNonFinalClassProtectedProperty { /** * @var object */ protected $x; public function __construct(object $x) { $this->x = $x; } }
Output for 8.1.0 - 8.1.13
Fatal error: Type of SomeChild::$x must be object (as in class SkipNonFinalClassProtectedProperty) in /in/BYkPK on line 10
Process exited with code 255.
Output for 8.0.1 - 8.0.26
Fatal error: Type of SomeChild::$x must be object (as in class SkipNonFinalClassProtectedProperty) in /in/BYkPK on line 21
Process exited with code 255.

preferences:
153.63 ms | 1257 KiB | 6 Q