Skip to content

Commit

Permalink
[generate:event:subscriber] Added coding standard (#4076)
Browse files Browse the repository at this point in the history
  • Loading branch information
hjuarez20 authored and enzolutions committed Jun 3, 2019
1 parent 918a883 commit 6af1543
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/Command/Shared/EventsTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions templates/base/class.php.twig
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ use {{ service.class }};
* @var \{{ service.class }}
*/
protected ${{service.camel_case_name}};
{% endfor %}
{% endif %}
{% endblock %}
Expand Down
4 changes: 2 additions & 2 deletions templates/module/src/event-subscriber.php.twig
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 6af1543

Please sign in to comment.