<?php
interface FooInterface
{
public function dump(self $baz);
}
class Foo implements FooInterface
{
public function dump(self $baz) {
var_dump($baz);
}
}
class Bar extends Foo
{
public function dump(Foo $baz)
{
parent::dump($baz);
}
}
(new Foo)->dump(new Bar);
//(new Bar)->dump(new Bar);
//(new Bar)->dump(new Foo);
Fatal error: Declaration of Foo::dump(Foo $baz) must be compatible with FooInterface::dump(FooInterface $baz) in /in/BVFFX on line 11
Process exited with code 255.
Fatal error: Declaration of Foo::dump(Foo $baz) must be compatible with FooInterface::dump(FooInterface $baz) in /in/BVFFX on line 9
Process exited with code 255.
Fatal error: Declaration of Foo::dump() must be compatible with FooInterface::dump(FooInterface $baz) in /in/BVFFX on line 10
Process exited with code 255.
Output for 5.4.0
Fatal error: Declaration of Bar::dump() must be compatible with FooInterface::dump(self $baz) in /in/BVFFX on line 17
Process exited with code 255.