-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Console] command list ordering, styles in command names bugfix #12051 #12500
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
@spdionis thanks for this PR and congrats on being your first one! As you may have noticed, the service that we use to test all the submitted PR has produced an error and that's why this PR cannot be considered to be merged yet. Here you can find the details about the result of executing the unit tests: https://travis-ci.org/symfony/symfony/jobs/41312055 If you prefer to execute the tests in your own machine, please read this article about how to do it: http://symfony.com/doc/current/contributing/code/tests.html |
@javiereguiluz the issue is actually that the PR has been sent to the master branch, which is now 3.0.x-dev. but Travis cannot install dev dependencies for the master branch, because some of them (Doctrine for instance) are depending on the 2.x version of Symfony components. PRs have to be sent to 2.7 (which is the default branch on github btw) or older for Travis to test them (we will need to figure a way to make test run on 3.0. We cannot force Doctrine to document compatibility with 3.0 yet, especially not in stable releases) |
ad42f69
to
1591f78
Compare
@stof @javiereguiluz Initially there were also some failing tests that now run correctly. I missed them before because i was working on windows. A lot of tests fail on windows on vanilla repository, i'm not sure why. If needed I can open against 2.7 branch. |
ping @stof @javiereguiluz tests run fine. |
foreach ($commands as $name => $command) { | ||
$key = $this->application->extractNamespace($name, 1); | ||
if (!$key) { | ||
$key = '_global'; | ||
$globalCommands['_global'][$name] = $command; |
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 suggest the _global
key here, build $globalCommands
as being only the array of global commands themselves, and the prepending this array in the list of commands after the sorting with array_shift($namespacedCommands, $globalCommands)
(and doing it only in case the list of global commands is not empty to avoid useless work)
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.
hmm, actually no. The switch from array_merge to array_shift won't work because the code expects to have a _global key for global commands. But the global key could be handle at the time of merging, keeping $globalCommands
as the list of global commands (which is not the case currently)
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'm not sure what you meant here. Anyway I know that $globalCommands['_global']
feels redunant but in my opinion is it fine. The array_merge
call later looks pretty straightforward this way.
@spdionis It would help if you could split this PR into 2 PRs, one for each bug fix. |
I added a test that checks both command order and formatting. I can't separate the PRs though because one changes the expected output of the other. I'm also not sure I'm testing this the right way, if it's not point me in the right direction please. Sorry for the late answer. EDIT: looks like the test fails on travis, but it passes on my vagrant box. This test is too fragile... EDIT2: test passes now |
Closing in favor of #16123 |
This is my first pull request, hope everything is alright.
0name
it would show up before the global commands.