3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface MyOwnInterface { public function getBar(); public function setBar($bar); } trait Foo { protected \DateTime $bar; public function getBar(): \DateTime { return $this->bar; } public function setBar(\DateTime $bar) { $this->bar = $bar; return $this; } } class MyClass implements MyOwnInterface { use Foo; }
Output for 7.4.0, 8.1.32, 8.2.26 - 8.2.29, 8.3.5 - 8.3.25, 8.4.1 - 8.4.12
Fatal error: Declaration of MyClass::setBar(DateTime $bar) must be compatible with MyOwnInterface::setBar($bar) in /in/q0qFe on line 19
Process exited with code 255.

preferences:
52.45 ms | 406 KiB | 5 Q