3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface AggregateRoot {} class Customer implements AggregateRoot {} interface AggregateRootFactory { public function create() : AggregateRoot; } class CustomerFactory implements AggregateRootFactory { public function create() : Customer // Customer is subtype of AggregateRoot, it should work { return new Customer(); } } $factory = new CustomerFactory(); $customer = $factory->create();

This is an error 500

Value for `_results` contains invalid data `array`


preferences:
162.17 ms | 2163 KiB | 8 Q