-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Command] Add question helper for unknown or ambiguous commands #19282
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
Conversation
hason
commented
Jul 4, 2016
Q | A |
---|---|
Branch? | master |
Bug fix? | no |
New feature? | yes |
BC breaks? | no |
Deprecations? | no |
Tests pass? | yes |
Fixed tickets | #16261 |
License | MIT |
Doc PR |
Without looking at the code, I cannot understand the difference between |
|
||
public function __construct($namespace, $alternatives = array(), $code = null, $previous = null) | ||
{ | ||
$this->command = $namespace; |
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.
typo $this->namespace = $namespace;
👍 It would be nice to have this. IMO having several exception classes could be avoided here. Adding an utility method to the CommandNotFoundException that formats the message based on alternatives (i.e. "Did you mean...") should be enough. |
|
||
if ($alternatives) { | ||
if (1 == count($alternatives)) { | ||
$message .= "\n\nDid you mean this?\n "; |
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.
I doubt the exception should format the message rendered in the console itself. Instead, consumers should build the formatted message IMO.
@hason Can you take comments into account and rebase? Thanks. |
Closing as there is no feedback. Feel free to reopen whenever it is ready. |