-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Console] Made console command shortcuts case insensitive #23869
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
[Console] Made console command shortcuts case insensitive #23869
Conversation
I don't know if we should make this change (at the moment we're doing the opposite in other parts of the framework: stop being case-insensitive) but I can confirm that this is a very annoying issue. I make this error almost every day. In my case the error is: |
I agree being strict is perfect for bots and automated stuff. Bots will/should not use shortcuts though. This is purely good for DX that I believe is very important. I don't believe it should be in the same bucket as other more restrictive flows |
👍 for this idea, even if I've never hit such an issue myself. |
This is a BC break. Taking the same example as in your test case: // test.php
$app = new Symfony\Component\Console\Application();
$app->register('FOO:BAR')->setCode(function () { print 'FOO:BAR executed'; });
$app->register('foo:bar')->setCode(function () { print 'foo:bar executed'; });
$app->run(); Current behavior is:
With this, both If we want to fix this issue, we should make command names case insensitive (as @javiereguiluz seems to be asking for), not only shortcuts, and that would require a proper upgrade path. |
@chalasr I agree this is a BC break as you stated it. I've updated the table to mark it as such. But if we assume that such a person exists that prefers I do like the idea of having all commands case insensitive. That would also solve the problem but I don't know how much work that is. There was a nice talk by @ellotheth called Building for Utopia at PHPTek talking about similar issues. |
Why should there be any BC break? Can't we search case sensitive first,
then insensitive if nothing found?
|
@nicolas-grekas I think we can. I will try that |
Ready for review again. |
Could you add a note in the Console CHANGELOG? |
Thanks @chalasr I've updated the Console CHANGELOG |
Thank you for contributing to Symfony @thanosp. |
…ive (thanosp) This PR was merged into the 3.4 branch. Discussion ---------- [Console] Made console command shortcuts case insensitive | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | yes <!-- don't forget updating src/**/CHANGELOG.md files --> | BC breaks? | no | Deprecations? | no <!-- don't forget updating UPGRADE-*.md files --> | Tests pass? | yes | Fixed tickets | #... <!-- #-prefixed issue number(s), if any --> | License | MIT | Doc PR | symfony/symfony-docs#... <!--highly recommended for new features--> <!-- - Bug fixes must be submitted against the lowest branch where they apply (lowest branches are regularly merged to upper ones so they get the fixes too). - Features and deprecations must be submitted against the 3.4, legacy code removals go to the master branch. - Please fill in this template according to the PR you're about to submit. - Replace this comment by a description of what your PR is solving. --> This patch would save a lot of time wasted correcting typos. Symfony commands are using `:` as a namespace separator. Most keyboards require pressing shift to get this character. As an accident a developer in hurry (me) when trying to use the shortcut of commands will often type the character after `:` also while pressing shift. Right now this will lead to an error effectively wasting the attempt to save time by using the shortcut. e.g. `bin/console c:C` Commits ------- 04df283 [Console] Added a case-insensitive fallback for console command names
This patch would save a lot of time wasted correcting typos.
Symfony commands are using
:
as a namespace separator.Most keyboards require pressing shift to get this character.
As an accident a developer in hurry (me) when trying to use the shortcut of commands will often type the character after
:
also while pressing shift. Right now this will lead to an error effectively wasting the attempt to save time by using the shortcut.e.g.
bin/console c:C