Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Console] Make error message more verbose#38919

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fabpot merged 1 commit intosymfony:5.xfromNyholm:console-error-arguments
Nov 1, 2020

Conversation

@Nyholm
Copy link
Member

QA
Branch?5.x
Bug fix?no
New feature?yes
Deprecations?no
TicketsFix#38904
LicenseMIT
Doc PRno

This will make the error message a bit more verbose when you are using too many or too few arguments.

$all =$this->definition->getArguments();
$symfonyCommandName =null;
if (($inputArgument =$all[$key =array_key_first($all)] ??null) &&'command' ===$inputArgument->getName()) {
$symfonyCommandName =$this->tokens[0] ??null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

hmm, what if people use short command name ? liked:m:m instead ofdoctrine: migration:migrate
Just wondering what should be the output...

Copy link
MemberAuthor

@NyholmNyholmOct 31, 2020
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Good question. The output would be:

Too many arguments to "d:m:m" command, expected arguments "version".

$all =$this->definition->getArguments();
$symfonyCommandName =null;
if (($inputArgument =$all[$key =array_key_first($all)] ??null) &&'command' ===$inputArgument->getName()) {
$symfonyCommandName =$this->tokens[0] ??null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

The command name is not always$this->tokens[0].bin/console -v secrets:list will have-v as$this->tokens[0]

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

You should use$this->arguments['command'][0] instead (when we reach this error, we know that the command argument has already been parsed)

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Awesome.
You are correct. I've updated the PR.

❯ bin/console -v secrets:list foobarIn ArgvInput.php line 186:                                                                     [Symfony\Component\Console\Exception\RuntimeException]             No arguments expected for "secrets:list" command, got "foobar".

@fabpotfabpotforce-pushed theconsole-error-arguments branch frombe44cfa toef221e8CompareNovember 1, 2020 17:40
@fabpot
Copy link
Member

Thank you@Nyholm.

@Nyholm
Copy link
MemberAuthor

Thank you for all reviews and for merging.

@NyholmNyholm deleted the console-error-arguments branchNovember 1, 2020 17:43
@fabpotfabpot mentioned this pull requestNov 10, 2020
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@stofstofstof left review comments

@jderussejderussejderusse left review comments

@fabpotfabpotfabpot approved these changes

@ycerutoycerutoyceruto approved these changes

@chalasrchalasrchalasr approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

5.4

Development

Successfully merging this pull request may close these issues.

[Console] Too many arguments message contains an incorrect number of missing arguments

7 participants

@Nyholm@fabpot@stof@jderusse@yceruto@chalasr@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp