<?php
interface Test
{
public function check(Test $x);
}
//this is ok:
class Foo implements Test
{
public function check(Test $x) {}
}
interface BarInterface extends Test{};
//this is fail, but why? Bar implements Test, so.. logically it fulfills contract..
class Bar implements Test
{
public function check(BarInterface $x) {}
}
Fatal error: Declaration of Bar::check(BarInterface $x) must be compatible with Test::check(Test $x) in /in/78MOr on line 20
Process exited with code 255.
Fatal error: Declaration of Bar::check(BarInterface $x) must be compatible with Test::check(Test $x) in /in/78MOr on line 18
Process exited with code 255.