zendframework / zend-expressive-router

Router subcomponent for Expressive
BSD 3-Clause "New" or "Revised" License
28 stars 13 forks source link

Remove default value for initial argument to `fromRouteFailure()` #43

Closed weierophinney closed 6 years ago

weierophinney commented 6 years ago

Currently, phpspec/prophecy does not properly mock method arguments that are nullable if the default value is not also null. This raised an interesting design issue for RouteResult::fromResultFailure(), as the change to use a nullable argument where the default value is an empty array instead then caused test errors.

In reviewing the functionality, a default argument makes no sense. We should pass in exactly what we intend: the allowed methods for the failed route match, if any. Routers should then pass in:

This patch updates to that behavior, and adds tests to verify behavior of the result once created.

Supercedes #42.