Skip to content
Permalink
Browse files

FIX #3983: Correct coding standards for EventSubscriber class (#3984)

  • Loading branch information...
csegarra authored and LOBsTerr committed Nov 29, 2018
1 parent 3782e09 commit d72f5c0534f1b3f30058e1322e5449a64e29c4e7
Showing with 4 additions and 5 deletions.
  1. +4 −5 templates/module/src/event-subscriber.php.twig
@@ -20,7 +20,6 @@ use Symfony\Component\EventDispatcher\Event;
class {{ class }} implements EventSubscriberInterface {% endblock %}

{% block class_construct %}

/**
* Constructs a new {{ class }} object.
*/
@@ -34,7 +33,7 @@ class {{ class }} implements EventSubscriberInterface {% endblock %}
/**
* {@inheritdoc}
*/
static function getSubscribedEvents() {
public static function getSubscribedEvents() {
{% for event_name, callback in events %}
$events['{{ event_name }}'] = ['{{ callback }}'];
{% endfor %}
@@ -44,10 +43,10 @@ class {{ class }} implements EventSubscriberInterface {% endblock %}

{% for event_name, callback in events %}
/**
* This method is called whenever the {{ event_name }} event is
* dispatched.
* This method is called whenever the {{ event_name }} event is dispatched.
*
* @param GetResponseEvent $event
* @param \Symfony\Component\EventDispatcher\Event $event
* The dispatched event.
*/
public function {{ callback }}(Event $event) {
\Drupal::messenger()->addMessage('Event {{ event_name }} thrown by Subscriber in module {{ module }}.', 'status', TRUE);

0 comments on commit d72f5c0

Please sign in to comment.
You can’t perform that action at this time.