3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { abstract public function __construct(int $j); } class Bar extends Foo { public function __construct(string $j) { } } $ref = new \ReflectionClass(\Bar::class); var_dump($ref->getMethod('__construct')->getPrototype()->getDeclaringClass()->getName());
Output for 7.4.0 - 7.4.6
Fatal error: Class Foo contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (Foo::__construct) in /in/hI2C2 on line 3
Process exited with code 255.
Output for 7.2.0 - 7.2.31, 7.3.0 - 7.3.18
Fatal error: Class Foo contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (Foo::__construct) in /in/hI2C2 on line 8
Process exited with code 255.

preferences:
184.58 ms | 1395 KiB | 65 Q