Skip to content

Commit

Permalink
Clarify that addRoute must raise exception
Browse files Browse the repository at this point in the history
Per zendframework#189, `addRoute()` **MUST** raise a `RuntimeException` if called
after either `match()` or `generateUri()` have been called, to ensure
the router state does not change between invocations.
  • Loading branch information
weierophinney committed Dec 1, 2015
1 parent 0757840 commit c9a749e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Router/RouterInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
namespace Zend\Expressive\Router;

use Psr\Http\Message\ServerRequestInterface as Request;
use RuntimeException;
use Zend\Expressive\Exception;

/**
Expand All @@ -27,7 +28,13 @@ interface RouterInterface
* modify route instances before matching (e.g., to provide route options,
* inject a name, etc.).
*
* The method MUST raise a RuntimeException if called after either `match()`
* or `generateUri()` have already been called, to ensure integrity of the
* router between invocations of either of those methods.
*
* @param Route $route
* @throws RuntimeException when called after match() or generateUri() have
* been called.
*/
public function addRoute(Route $route);

Expand Down

0 comments on commit c9a749e

Please sign in to comment.