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

Appearance settings

[Console] Commands with an alias should not be recognized as ambiguous #25407

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

Simperfit
Copy link
Contributor

Q A
Branch? 2.7
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? no
Fixed tickets no
License MIT
Doc PR

When having two commands with the same starting name and an alias equal to the starting name, we should not have an ambiguous error because we are setting the alias.


return $commandName === $nameOrAlias || !in_array($commandName, $commands);
});
}

$exact = in_array($name, $commands, true);
if (count($commands) > 1 && !$exact) {
if (count($commands) > 1 && !$exact && !isset($aliases[$name])) {
Copy link
Contributor

@sstok sstok Dec 9, 2017

Choose a reason for hiding this comment

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

Maybe move the isset to the beginning as it's faster then count? - Micro optimization.

@chalasr chalasr added this to the 2.7 milestone Dec 9, 2017
@Simperfit Simperfit force-pushed the bugfix/console-commands-with-an-alias-should-no-be-ambiguous-when-not-using-register branch from 1f1e54c to cb9f6ff Compare December 11, 2017 21:00

return $commandName === $nameOrAlias || !in_array($commandName, $commands);
});
}

$exact = in_array($name, $commands, true);
if (count($commands) > 1 && !$exact) {
if (!isset($aliases[$name]) && count($commands) > 1 && !$exact) {
Copy link
Member

Choose a reason for hiding this comment

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

changing line 537 to $exact = \in_array($name, $commands, true) || isset($aliases[$name]); would avoid the need for both this check and the condition added below

Copy link
Contributor Author

@Simperfit Simperfit Dec 16, 2017

Choose a reason for hiding this comment

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

it's better ike this ;). Thanks!

@Simperfit Simperfit force-pushed the bugfix/console-commands-with-an-alias-should-no-be-ambiguous-when-not-using-register branch from cb9f6ff to 863f632 Compare December 16, 2017 04:47
@chalasr
Copy link
Member

chalasr commented Dec 22, 2017

Thank you @Simperfit.

@chalasr chalasr merged commit 863f632 into symfony:2.7 Dec 22, 2017
chalasr pushed a commit that referenced this pull request Dec 22, 2017
…as ambiguous (Simperfit)

This PR was merged into the 2.7 branch.

Discussion
----------

[Console] Commands with an alias should not be recognized as ambiguous

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks?    | no
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md files -->
| Tests pass?   | no
| Fixed tickets | no <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        |

When having two commands with the same starting name and an alias equal to the starting name, we should not have an ambiguous error because we are setting the alias.

Commits
-------

863f632 [Console] Commands with an alias should not be recognized as ambiguous
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.