From 0d841586aecdd6093b0396efef4869f79150d661 Mon Sep 17 00:00:00 2001 From: Trent Steel Date: Mon, 10 Sep 2018 10:42:52 +1000 Subject: [PATCH 1/2] Method should be static. Encourage use of const Function should be static and we should also encourage the use of constants --- doctrine/event_listeners_subscribers.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doctrine/event_listeners_subscribers.rst b/doctrine/event_listeners_subscribers.rst index 09e976f1a7a..9bc05064890 100644 --- a/doctrine/event_listeners_subscribers.rst +++ b/doctrine/event_listeners_subscribers.rst @@ -147,11 +147,11 @@ interface and have an event method for each event it subscribes to:: class SearchIndexerSubscriber implements EventSubscriber { - public function getSubscribedEvents() + public static function getSubscribedEvents() { return array( - 'postPersist', - 'postUpdate', + \Doctrine\ORM\Events::postPersist => 'postPersist', + \Doctrine\ORM\Events::postUpdate => 'postUpdate', ); } From 5431ad631538a6d60ae682f64a3a298b7a6699ac Mon Sep 17 00:00:00 2001 From: Trent Steel Date: Mon, 10 Sep 2018 10:47:50 +1000 Subject: [PATCH 2/2] Should not be static --- doctrine/event_listeners_subscribers.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doctrine/event_listeners_subscribers.rst b/doctrine/event_listeners_subscribers.rst index 9bc05064890..344105f7155 100644 --- a/doctrine/event_listeners_subscribers.rst +++ b/doctrine/event_listeners_subscribers.rst @@ -147,7 +147,7 @@ interface and have an event method for each event it subscribes to:: class SearchIndexerSubscriber implements EventSubscriber { - public static function getSubscribedEvents() + public function getSubscribedEvents() { return array( \Doctrine\ORM\Events::postPersist => 'postPersist',