Skip to content

Conversation

@henderkes
Copy link
Contributor

@henderkes henderkes commented Nov 29, 2025

Q A
Branch? 7.4
Bug fix? yes
New feature? no
Deprecations? no
Issues Fix #62557
License MIT

Contributor guidelines:

@carsonbot
Copy link

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:

  • Always add tests
  • Keep backward compatibility (see https://symfony.com/bc).
  • Bug fixes must be submitted against the lowest maintained branch where they apply (see https://symfony.com/releases)
  • Features and deprecations must be submitted against the 8.1 branch.

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!
If this PR is merged in a lower version branch, it will be merged up to all maintained branches within a few days.

I am going to sit back now and wait for the reviews.

Cheers!

Carsonbot

@OskarStark OskarStark changed the title [Console] don't discard existing aliases when constructing Command (fix bug #62557) [Console] don't discard existing aliases when constructing Command Nov 29, 2025
}

// we must not overwrite existing aliases, combine new ones with existing ones
$aliases = array_unique([
Copy link
Member

Choose a reason for hiding this comment

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

I think I would rather guard the setAliases() call below to not call it with an empty array.

Copy link
Contributor

Choose a reason for hiding this comment

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

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? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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.

Copy link
Member

Choose a reason for hiding this comment

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

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(). 🤷

Copy link
Member

Choose a reason for hiding this comment

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

Though if we say that's something we want to keep we can indeed remove the if again.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Perhaps not realistic, but entirely possible.

@henderkes henderkes force-pushed the 7.4 branch 2 times, most recently from 08fe044 to 2ae73e6 Compare November 29, 2025 13:19
@chalasr
Copy link
Member

chalasr commented Dec 2, 2025

Thank you @henderkes.

@chalasr chalasr merged commit 93ea5f6 into symfony:7.4 Dec 2, 2025
12 checks passed
@henderkes henderkes deleted the 7.4 branch December 2, 2025 07:34
This was referenced Dec 7, 2025
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.

8 participants