3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait AutowireTrait { final public function autowire(bool $autowired = true): self { return $this; } } class A { public function autowire($autowired = true) { return $this; } } class B extends A { use AutowireTrait; } var_dump((new B)->autowire());
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.29, 8.2.0 - 8.2.23, 8.3.0 - 8.3.11
Fatal error: Declaration of AutowireTrait::autowire(bool $autowired = true): B must be compatible with A::autowire($autowired = true) in /in/EAsk8 on line 5
Process exited with code 255.
Output for 7.4.0 - 7.4.33
Warning: Declaration of AutowireTrait::autowire(bool $autowired = true): AutowireTrait should be compatible with A::autowire($autowired = true) in /in/EAsk8 on line 5 object(B)#1 (0) { }
Output for 7.1.25 - 7.1.31, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33
Warning: Declaration of AutowireTrait::autowire(bool $autowired = true): AutowireTrait should be compatible with A::autowire($autowired = true) in /in/EAsk8 on line 19 object(B)#1 (0) { }

preferences:
80.97 ms | 409 KiB | 5 Q