Good:
interface MyInterface
{
function foo();
}
class MyClass implements MyInterface
{
public function foo($a = null, $b = null)
{
echo $a + $b;
}
}
$class = new MyClass();
$class->foo(2, 2);
Result:
4
Bad:
interface MyInterface
{
function foo();
}
class MyClass implements MyInterface
{
public function foo($a, $b)
{
echo $a + $b;
}
}
$class = new MyClass();
$class->foo(2, 2);
Result:
Fatal error: Declaration of MyClass::foo() must be compatible with MyInterface::foo()