Skip to content
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

[generate:event:subscriber] Generated EventSubscriber class does not honor coding standards #3983

Closed
csegarra opened this issue Nov 27, 2018 · 3 comments
Labels
Milestone

Comments

@csegarra
Copy link
Contributor

csegarra commented Nov 27, 2018

Problem/Motivation

The code generated for the EventSubscriber has some errors regarding the Drupal coding standards:

  • Expected 1 blank line before function; 2 found before the class constructor.
  • Visibility must be declared on method "getSubscribedEvents".
  • Doc comment short description must be on a single line, further text should be a separate paragraph on callback functions.
  • Missing parameter comment on callback functions.
  • Expected type hint "GetResponseEvent"; found "Event" for $event on callback functions.

How to reproduce

Using Drupal Console 1.8 create a custom module:

drupal generate:module \
  --module "CS Test" \
  --machine-name cs_test \
  --module-path modules/custom \
  --description "Code Styling test module" \
  -q

And then add an EventSubscriber for some events:

drupal generate:event:subscriber \
  --module cs_test

Solution

The EventSubscriber class should be modified to follow the Drupal coding standards.

csegarra added a commit to gcoop-libre/drupal-console that referenced this issue Nov 27, 2018
@LOBsTerr
Copy link
Member

@csegarra Can you create a PR I will review it? Thank you

@csegarra
Copy link
Contributor Author

Hi @LOBsTerr !

Yesterday I have made the PR #3984 with the changes to the template.

Regards!

@LOBsTerr
Copy link
Member

@csegarra Thank you for your contribution. I have merged the code.
I'm closing the issue, feel free to reopen it.

@LOBsTerr LOBsTerr added this to the 1.9.0 milestone Nov 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants