Commit 9e3a35c2 authored by jeroendedauw's avatar jeroendedauw Committed by Fabien Potencier

Type hint against EventDispatcherInterface

parent 58d04619
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
namespace Silex; namespace Silex;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\BinaryFileResponse; use Symfony\Component\HttpFoundation\BinaryFileResponse;
use Symfony\Component\HttpKernel\HttpKernel; use Symfony\Component\HttpKernel\HttpKernel;
use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpKernel\HttpKernelInterface;
...@@ -88,6 +89,9 @@ class Application extends \Pimple implements HttpKernelInterface, TerminableInte ...@@ -88,6 +89,9 @@ class Application extends \Pimple implements HttpKernelInterface, TerminableInte
$this['dispatcher_class'] = 'Symfony\\Component\\EventDispatcher\\EventDispatcher'; $this['dispatcher_class'] = 'Symfony\\Component\\EventDispatcher\\EventDispatcher';
$this['dispatcher'] = $this->share(function () use ($app) { $this['dispatcher'] = $this->share(function () use ($app) {
/**
* @var EventDispatcherInterface $dispatcher
*/
$dispatcher = new $app['dispatcher_class'](); $dispatcher = new $app['dispatcher_class']();
$urlMatcher = new LazyUrlMatcher(function () use ($app) { $urlMatcher = new LazyUrlMatcher(function () use ($app) {
...@@ -288,7 +292,7 @@ class Application extends \Pimple implements HttpKernelInterface, TerminableInte ...@@ -288,7 +292,7 @@ class Application extends \Pimple implements HttpKernelInterface, TerminableInte
return; return;
} }
$this['dispatcher'] = $this->share($this->extend('dispatcher', function ($dispatcher, $app) use ($callback, $priority, $eventName) { $this['dispatcher'] = $this->share($this->extend('dispatcher', function (EventDispatcherInterface $dispatcher, $app) use ($callback, $priority, $eventName) {
$dispatcher->addListener($eventName, $app['callback_resolver']->resolveCallback($callback), $priority); $dispatcher->addListener($eventName, $app['callback_resolver']->resolveCallback($callback), $priority);
return $dispatcher; return $dispatcher;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment