Create default set of listeners late
Right now the following subscribers are created together with the dispatcher: * app * exception_handler * ResponseListener * RouterListener With the exception_handler in particular this is an issue because you can no longer change it after the dispatcher has been created. And it gets created when you call before(), after() or error(). It means that you cannot unset it for tests. The RouterListener has a similar issue because you can no longer change the UrlMatcher it uses. And you cannot move its creation into a request listener, because request listeners cannot add other request listeners (the new ones won't get executed anymore at that point). This commit ensures that those listeners will be created a lot later, allowing their dependencies to be modified before runtime.
Showing
src/Silex/LazyUrlMatcher.php
0 → 100644
Please register or sign in to comment