<?php
interface Test
{
public function check(Test $x);
}
interface TestStrict extends Test
{
public function checkStrict(TestStrict $x);
}
class Foo implements TestStrict
{
//ok, exact match
public function checkStrict(TestStrict $x) {}
//fail, but TestStrict > Test I.e.
//if $x fullfills TestStrict, it 100% satisfy Test too.
//so - why?
public function check(TestStrict $x) {}
}
Fatal error: Declaration of Foo::check(TestStrict $x) must be compatible with Test::check(Test $x) in /in/atOaH on line 20
Process exited with code 255.
Fatal error: Declaration of Foo::check(TestStrict $x) must be compatible with Test::check(Test $x) in /in/atOaH on line 13
Process exited with code 255.