3v4l.org

run code in 300+ PHP versions simultaneously
<?php abstract 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: Declaration of Bar::__construct(string $j) must be compatible with Foo::__construct(int $j) in /in/l8h8S on line 13
Process exited with code 255.
Output for 7.2.0 - 7.2.31, 7.3.0 - 7.3.18
Fatal error: Declaration of Bar::__construct(string $j) must be compatible with Foo::__construct(int $j) in /in/l8h8S on line 18
Process exited with code 255.

preferences:
188.2 ms | 1395 KiB | 65 Q