<?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(Test $x) {}
//fail, but TestStrict > Test I.e.
//if $x fullfills TestStrict, it 100% satisfy Test too.
//so - why?
public function check(Test $x) {}
}
Fatal error: Declaration of Foo::checkStrict(Test $x) must be compatible with TestStrict::checkStrict(TestStrict $x) in /in/EHpSF on line 13
Process exited with code 255.
Fatal error: Declaration of Foo::checkStrict() must be compatible with TestStrict::checkStrict(TestStrict $x) in /in/EHpSF on line 14
Process exited with code 255.
Output for 5.3.0 - 5.3.29
Fatal error: Declaration of Foo::checkStrict() must be compatible with that of TestStrict::checkStrict() in /in/EHpSF on line 14
Process exited with code 255.
Fatal error: Declaration of Foo::checkStrict() must be compatible with that of TestStrict::checkStrict() in /in/EHpSF on line 13
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING in /in/EHpSF on line 3
Process exited with code 255.