Commit aa08fbe
committed
bug symfony#61367 [Console] Fix name/alias/usages when an invokable command has an alias (weitzman)
This PR was squashed before being merged into the 7.4 branch.
Discussion
----------
[Console] Fix name/alias/usages when an invokable command has an alias
| Q | A
| ------------- | ---
| Branch? | 7.4
| Bug fix? | yes
| New feature? | no <!-- if yes, also update src/**/CHANGELOG.md -->
| Deprecations? | no <!-- if yes, also update UPGRADE-*.md and src/**/CHANGELOG.md -->
| Issues |
| License | MIT
Invokable commands don't construct their command name properly when an alias is present. This makes the command uncallable. The name has a pipe and alias appended such as `example:name | my-alias`. This appending is done by `#[AsCommand]`. You can see the effect by looking [the test failure in the first commit](https://github.com/symfony/symfony/actions/runs/16842451165/job/47716168358) to this PR.
The PR fixes the issue by removing a `return` when handling of invokables in Command::__construct(). We can mostly use same logic as non-invokables.
I discovered this while moving Drush (Drupal's CLI) to invokable commands.
Commits
-------
c787a07 [Console] Fix name/alias/usages when an invokable command has an aliasFile tree
3 files changed
+15
-19
lines changed- src/Symfony/Component/Console
- Command
- Tests
- Command
- Fixtures
3 files changed
+15
-19
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
92 | | - | |
93 | | - | |
94 | 92 | | |
95 | 93 | | |
96 | 94 | | |
97 | 95 | | |
98 | | - | |
99 | 96 | | |
100 | 97 | | |
101 | 98 | | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
113 | 102 | | |
114 | 103 | | |
115 | | - | |
116 | | - | |
| 104 | + | |
117 | 105 | | |
118 | 106 | | |
119 | 107 | | |
| |||
159 | 147 | | |
160 | 148 | | |
161 | 149 | | |
162 | | - | |
| 150 | + | |
163 | 151 | | |
164 | 152 | | |
165 | 153 | | |
| |||
Lines changed: 9 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
304 | 304 | | |
305 | 305 | | |
306 | 306 | | |
307 | | - | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
308 | 316 | | |
309 | 317 | | |
310 | 318 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
0 commit comments