<?php
interface Comparable
{
public function compare(self $compare);
}
// Which is then implemented:
class Foo implements Comparable
{
public function compare(Comparable $compare)
{}
}
class Bar implements Comparable
{
public function compare(Comparable $compare)
{}
}
$foo = new Foo();
$bar = new Bar();
$foo->compare($foo);
$bar->compare($bar);
Fatal error: Declaration of Foo::compare() must be compatible with Comparable::compare(self $compare) in /in/mqYTn on line 10
Process exited with code 255.
Output for 5.3.0 - 5.3.29
Fatal error: Declaration of Foo::compare() must be compatible with that of Comparable::compare() in /in/mqYTn on line 10
Process exited with code 255.