Skip to content

Commit

Permalink
merged 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Apr 12, 2012
2 parents 68d2bb6 + 69f86e4 commit 085ec3b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion EventDispatcher.php
Expand Up @@ -123,7 +123,7 @@ public function addSubscriber(EventSubscriberInterface $subscriber)
if (is_string($params)) { if (is_string($params)) {
$this->addListener($eventName, array($subscriber, $params)); $this->addListener($eventName, array($subscriber, $params));
} elseif (is_string($params[0])) { } elseif (is_string($params[0])) {
$this->addListener($eventName, array($subscriber, $params[0]), $params[1]); $this->addListener($eventName, array($subscriber, $params[0]), isset($params[1]) ? $params[1] : 0);
} else { } else {
foreach ($params as $listener) { foreach ($params as $listener) {
$this->addListener($eventName, array($subscriber, $listener[0]), isset($listener[1]) ? $listener[1] : 0); $this->addListener($eventName, array($subscriber, $listener[0]), isset($listener[1]) ? $listener[1] : 0);
Expand Down
5 changes: 4 additions & 1 deletion Tests/EventDispatcherTest.php
Expand Up @@ -278,7 +278,10 @@ class TestEventSubscriberWithPriorities implements EventSubscriberInterface
{ {
public static function getSubscribedEvents() public static function getSubscribedEvents()
{ {
return array('pre.foo' => array('preFoo', 10)); return array(
'pre.foo' => array('preFoo', 10),
'post.foo' => array('postFoo'),
);
} }
} }


Expand Down

0 comments on commit 085ec3b

Please sign in to comment.