Skip to content

Commit

Permalink
minor silexphp#1026 Type hint against EventDispatcherInterface (Jeroe…
Browse files Browse the repository at this point in the history
…nDeDauw)

This PR was submitted for the master branch but it was merged into the 1.3 branch instead (closes silexphp#1026).

Discussion
----------

Type hint against EventDispatcherInterface

Commits
-------

9e3a35c Type hint against EventDispatcherInterface
  • Loading branch information
fabpot committed Apr 11, 2015
2 parents 58d0461 + 9e3a35c commit 04bd07e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Silex/Application.php
Expand Up @@ -11,6 +11,7 @@

namespace Silex;

use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
use Symfony\Component\HttpKernel\HttpKernel;
use Symfony\Component\HttpKernel\HttpKernelInterface;
Expand Down Expand Up @@ -88,6 +89,9 @@ public function __construct(array $values = array())

$this['dispatcher_class'] = 'Symfony\\Component\\EventDispatcher\\EventDispatcher';
$this['dispatcher'] = $this->share(function () use ($app) {
/**
* @var EventDispatcherInterface $dispatcher
*/
$dispatcher = new $app['dispatcher_class']();

$urlMatcher = new LazyUrlMatcher(function () use ($app) {
Expand Down Expand Up @@ -288,7 +292,7 @@ public function on($eventName, $callback, $priority = 0)
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);

return $dispatcher;
Expand Down

0 comments on commit 04bd07e

Please sign in to comment.