-
-
Notifications
You must be signed in to change notification settings - Fork 421
[make:listener] Match event name against active events class/id #1579
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
[make:listener] Match event name against active events class/id #1579
Conversation
I like the idea and will indeed simplify such maker, and behavior can be duplicated on others as well I think |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for working on this @maelanleborgne - a couple of minor comments below...
src/Maker/MakeListener.php
Outdated
$suggestionList = []; | ||
foreach ($eventIdAndFQCNList as $eventSuggestion) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add spacing for readability between logic statements (e.g. if
's) to be consistent with other code in the bundle.
$suggestionList = []; | |
foreach ($eventIdAndFQCNList as $eventSuggestion) { | |
$suggestionList = []; | |
foreach ($eventIdAndFQCNList as $eventSuggestion) { |
We need to do this for the other if
statements below as well.
src/Maker/MakeListener.php
Outdated
if (1 === \count($suggestionList)) { | ||
$question = new ConfirmationQuestion(sprintf('<fg=green>Did you mean</> <fg=yellow>"%s"</> <fg=green>?</>', $suggestionList[0]), false); | ||
$event = $io->askQuestion($question) ? $suggestionList[0] : $event; | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can eliminate this else
condition by returning early inside the if
conditional. Then just have the statements within the else
called after the if
.
8fe0c1e
to
86f6dd6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @maelanleborgne
Closes #1410
Description
The goal of this PR is to simplify the usage of the
make:listener
command by adding the following features to the event input :Example
Matching on class short name :
Matching on class short name when multiple events match :
Typo detection :