Example : The interface is
public function doFoo($bar);
Can I have a class implementing the interface with method
public function doFoo(array $bar = array('test')) { }
What does the method signature mean in PHP?
Is it just the method name and parameter name ? Or, type hinting and default values for parameters also included ?
The default value for an argument isn't fixed with a interface (To clarify: The value isn't fixed, but if the interface has a default value then the class which implements the interface also needs a default value, but the value is not fixed by the interface).
However when an interface defines a method with a type hint the class must use the same type hint! You can also see this in the manual.
And a quote from there:
An interface, together with type-hinting, provides a good way to make sure that a particular object contains particular methods. See instanceof operator and type hinting.
You can type-hint in several ways. The formatting of a method signature in PHP goes:
class -> type -> variable -> default value
Thus, you can hint that a param must be an instance of a class like:
function foo(someClass $bar)
or you can merely specify that that param must be callable
like:
function foo(callable $bar)
Similarly, you can type hint the an array like you did above.
A param not being an instance of the class you specified throws a fatal error.