3v4l.org

run code in 200+ PHP versions simultaneously
<?php class Dog {} class Bulldog {} interface DogFeeder { function feed(Dog $dog); } function feedChihuahua(DogFeeder $feeder) { $feeder->feed(new Chihuahua()); // this code is OK } class BulldogFeeder implements DogFeeder { function feed(Bulldog $dog) { } } // feedChihuahua(new BulldogFeeder());
based on UQleg
Output for 7.4.0alpha1 - 7.4.0
Fatal error: Declaration of BulldogFeeder::feed(Bulldog $dog) must be compatible with DogFeeder::feed(Dog $dog) in /in/f1SKJ on line 15
Process exited with code 255.
Output for 7.1.26 - 7.3.12
Fatal error: Declaration of BulldogFeeder::feed(Bulldog $dog) must be compatible with DogFeeder::feed(Dog $dog) in /in/f1SKJ on line 13
Process exited with code 255.