From 6af1543f914bfdec29497441783704eb0ef7483a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Harold=20Ju=C3=A1rez?= Date: Mon, 3 Jun 2019 17:56:25 -0600 Subject: [PATCH] [generate:event:subscriber] Added coding standard (#4076) --- src/Command/Shared/EventsTrait.php | 3 ++- templates/base/class.php.twig | 1 + templates/module/src/event-subscriber.php.twig | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Command/Shared/EventsTrait.php b/src/Command/Shared/EventsTrait.php index bb8ce10ea..fee9c205f 100644 --- a/src/Command/Shared/EventsTrait.php +++ b/src/Command/Shared/EventsTrait.php @@ -37,9 +37,10 @@ public function eventsQuestion() } $callbackSuggestion = str_replace('.', '_', $event); + $callback = $this->getIo()->ask( $this->trans('commands.generate.event.subscriber.questions.callback-name'), - $callbackSuggestion + $this->stringConverter->underscoreToCamelCase($callbackSuggestion) ); $eventCollection[$event] = $callback; diff --git a/templates/base/class.php.twig b/templates/base/class.php.twig index e8275a158..7bca23cf9 100644 --- a/templates/base/class.php.twig +++ b/templates/base/class.php.twig @@ -23,6 +23,7 @@ use {{ service.class }}; * @var \{{ service.class }} */ protected ${{service.camel_case_name}}; + {% endfor %} {% endif %} {% endblock %} diff --git a/templates/module/src/event-subscriber.php.twig b/templates/module/src/event-subscriber.php.twig index cb5d01c3f..b3f54c9e3 100644 --- a/templates/module/src/event-subscriber.php.twig +++ b/templates/module/src/event-subscriber.php.twig @@ -40,10 +40,10 @@ class {{ class }} implements EventSubscriberInterface {% endblock %} return $events; } - {% for event_name, callback in events %} + /** - * This method is called whenever the {{ event_name }} event is dispatched. + * This method is called when the {{ event_name }} is dispatched. * * @param \Symfony\Component\EventDispatcher\Event $event * The dispatched event.