{"action":"created","issue":{"url":"https://api.github.com/repos/pennyphp/penny/issues/149","labels_url":"https://api.github.com/repos/pennyphp/penny/issues/149/labels{/name}","comments_url":"https://api.github.com/repos/pennyphp/penny/issues/149/comments","events_url":"https://api.github.com/repos/pennyphp/penny/issues/149/events","html_url":"https://github.com/pennyphp/penny/pull/149","id":119359732,"number":149,"title":"Fixes #148","user":{"login":"samsonasik","id":459648,"avatar_url":"https://avatars.githubusercontent.com/u/459648?v=3","gravatar_id":"","url":"https://api.github.com/users/samsonasik","html_url":"https://github.com/samsonasik","followers_url":"https://api.github.com/users/samsonasik/followers","following_url":"https://api.github.com/users/samsonasik/following{/other_user}","gists_url":"https://api.github.com/users/samsonasik/gists{/gist_id}","starred_url":"https://api.github.com/users/samsonasik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samsonasik/subscriptions","organizations_url":"https://api.github.com/users/samsonasik/orgs","repos_url":"https://api.github.com/users/samsonasik/repos","events_url":"https://api.github.com/users/samsonasik/events{/privacy}","received_events_url":"https://api.github.com/users/samsonasik/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-11-29T13:11:04Z","updated_at":"2015-12-22T06:22:09Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/pennyphp/penny/pulls/149","html_url":"https://github.com/pennyphp/penny/pull/149","diff_url":"https://github.com/pennyphp/penny/pull/149.diff","patch_url":"https://github.com/pennyphp/penny/pull/149.patch"},"body":"Actually, the check should happen for Dispatcher instead of RouteInfo as if Dispatcher class executed, it must return RouteInfo or throw Exception in the switch case at https://github.com/pennyphp/penny/blob/master/src/Dispatcher.php#L64-L73, so, placing check should be \r\n\r\n```php\r\n   if (!$dispatcher instanceof Dispatcher) {\r\n       throw here....\r\n   } \r\n```\r\n\r\nat `getDispatcher()` method. Hereby a provided fixes ;). In next, the implementation for custom dispatcher must extends `Penny\\Dispatcher` class with `mixed $request` in `__invoke($request)`, or we create new interface for Dispatcher ;)\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/pennyphp/penny/issues/comments/166527741","html_url":"https://github.com/pennyphp/penny/pull/149#issuecomment-166527741","issue_url":"https://api.github.com/repos/pennyphp/penny/issues/149","id":166527741,"user":{"login":"samsonasik","id":459648,"avatar_url":"https://avatars.githubusercontent.com/u/459648?v=3","gravatar_id":"","url":"https://api.github.com/users/samsonasik","html_url":"https://github.com/samsonasik","followers_url":"https://api.github.com/users/samsonasik/followers","following_url":"https://api.github.com/users/samsonasik/following{/other_user}","gists_url":"https://api.github.com/users/samsonasik/gists{/gist_id}","starred_url":"https://api.github.com/users/samsonasik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samsonasik/subscriptions","organizations_url":"https://api.github.com/users/samsonasik/orgs","repos_url":"https://api.github.com/users/samsonasik/repos","events_url":"https://api.github.com/users/samsonasik/events{/privacy}","received_events_url":"https://api.github.com/users/samsonasik/received_events","type":"User","site_admin":false},"created_at":"2015-12-22T06:22:09Z","updated_at":"2015-12-22T06:22:09Z","body":"@gianarb If we have DispatcherInterface, we can have:\r\n\r\n```php\r\nnamespace Penny\\Dispatcher;\r\n\r\ninterface DispatcherInterface\r\n{\r\n    /**\r\n     * @param mixed $request\r\n     * @throws RouteNotFoundException       If the route is not found.\r\n     * @throws MethodNotAllowedException    If the method is not allowed.\r\n     * @throws Exception                    If no one case is matched.\r\n     *\r\n     * @return RouteInfoInterface\r\n     */\r\n    public function __invoke($request);\r\n}\r\n```\r\nThe Dispatcher consumer will implement dispatch with required request no matter need container or not. It's pretty flexible imo ;)"}}