PHPUnit mock object, returnValueMap for methods with optional parameters

thanks to this post I figured out that the stub
PHPUnit_Framework_MockObject_Stub_ReturnValueMap
counts the number of ALL the parameters of the function (including the optional ones).
So the map must be
array(
 array(inputParam, …inputParamN, optionalParam1, …optionalParam2, return value )
)