3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private $user; public function getUser(): User { return $this->user; } } class FooProxy extends Foo { public function getUser(): User { return yield thingReturningAPromise(); } } echo (new FooProxy())->getUser()->getId(); // returns the result of the promise
Output for 7.1.25 - 7.1.28, 7.2.0 - 7.2.17, 7.3.0 - 7.3.4
Fatal error: Generators may only declare a return type of Generator, Iterator, Traversable, or iterable, User is not permitted in /in/C6vQ6 on line 15
Process exited with code 255.

preferences:
151.01 ms | 996 KiB | 7 Q