3v4l.org

run code in 200+ PHP versions simultaneously
<?php 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()); //
Output for 7.4.0alpha1 - 7.4.0
Fatal error: Could not check compatibility between BulldogFeeder::feed(Bulldog $dog) and DogFeeder::feed(Dog $dog), because class Dog is not available in /in/sULkI on line 14
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/sULkI on line 12
Process exited with code 255.