8000 [EventDispatcher] Fixed E_NOTICES with multiple eventnames per subscriber · Pull Request #3900 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[EventDispatcher] Fixed E_NOTICES with multiple eventnames per subscriber #3900

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from Apr 12, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[EventDispatcher] Fixed E_NOTICES with multiple eventnames per subscr…
…iber with mixed priorities
  • Loading branch information
Drak committed Apr 12, 2012
commit 57dd9147d9b4864c79967b46f9d7cb77a48aaf02
2 changes: 1 addition & 1 deletion src/Symfony/Component/EventDispatcher/EventDispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public function addSubscriber(EventSubscriberInterface $subscriber)
if (is_string($params)) {
$this->addListener($eventName, array($subscriber, $params));
} else {
$this->addListener($eventName, array($subscriber, $params[0]), $params[1]);
$this->addListener($eventName, array($subscriber, $params[0]), isset($params[1]) ? $params[1] : 0);
}
}
}
Expand Down
8000
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,9 @@ class TestEventSubscriberWithPriorities implements EventSubscriberInterface
{
public static function getSubscribedEvents()
{
return array('pre.foo' => array('preFoo', 10));
return array(
'pre.foo' => array('preFoo', 10),
'post.foo' => array('postFoo'),
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CS: this should probably be unindented.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done for readability.

8926 Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I meant:

return array(
    'pre.foo' => array('preFoo', 10),
    'post.foo' => array('postFoo'),
);

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes :)

}
}
0