[Console] don't discard existing aliases when constructing Command#62562
Conversation
|
Hey! I see that this is your first PR. That is great! Welcome! Symfony has a contribution guide which I suggest you to read. In short:
Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change. When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor! I am going to sit back now and wait for the reviews. Cheers! Carsonbot |
| } | ||
|
|
||
| // we must not overwrite existing aliases, combine new ones with existing ones | ||
| $aliases = array_unique([ |
There was a problem hiding this comment.
I think I would rather guard the setAliases() call below to not call it with an empty array.
There was a problem hiding this comment.
What's the intended behavior most likely?
Adding aliases from $name being split by | seems to be the latest change. Merging those into the array of existing ones feels most BC-safe over overwriting it if aliases here are not an empty array? 🤔
There was a problem hiding this comment.
I think I would rather guard the
setAliases()call below to not call it with an empty array.
if ($aliases !== []) {
$this->setAliases($aliases);
}Like this? That alone wouldn't fix the issue of existing aliases, because if $name was 'name|newalias', it would still overwrite the existing ones.
There was a problem hiding this comment.
I thought about that too and then I wondered if it is really realistic that someone updates the name to make use of the new opportunity to define name and aliases at once and then additionally also calls setAlias(). 🤷
There was a problem hiding this comment.
Though if we say that's something we want to keep we can indeed remove the if again.
There was a problem hiding this comment.
Perhaps not realistic, but entirely possible.
08fe044 to
2ae73e6
Compare
|
Thank you @henderkes. |
Contributor guidelines:
https://symfony.com/releases#maintained-symfony-branches
and must add an entry to the changelog file of the patched component:
https://symfony.com/doc/current/contributing/code/conventions.html#writing-a-changelog-entry
https://symfony.com/bc