Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[DependencyInjection] Add "when" argument to #[AsAlias]#60186

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

Zuruuh
Copy link
Contributor

QA
Branch?7.3
Bug fix?no
New feature?yes
Deprecations?no
IssuesFix#60118
LicenseMIT

Also I wonder if it would make sense to accept an array of environments in#[AsAlias], since in practice if I want to use the same service in two envs I'd have to duplicate the whole declaration now

#[AsAlias(MyInterface::class, when:'dev']#[AsAlias(MyInterface::class, when:'test']class MyClass {}

Thoughts ?

@carsonbot
Copy link

Hey!

I see that this is your first PR. That is great! Welcome!

Symfony has acontribution guide which I suggest you to read.

In short:

  • Always add tests
  • Keep backward compatibility (seehttps://symfony.com/bc).
  • Bug fixes must be submitted against the lowest maintained branch where they apply (seehttps://symfony.com/releases)
  • Features and deprecations must be submitted against the 7.3 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

Zuruuh reacted with heart emoji

@ZuruuhZuruuhforce-pushed thealias-attribute-when-argument branch from32ab3b0 toe3fcf6dCompareApril 9, 2025 09:58
@nicolas-grekas
Copy link
Member

Accepting string|array would make sense to me indeed.
Note that tests fail currently.

@ZuruuhZuruuhforce-pushed thealias-attribute-when-argument branch frome3fcf6d to2020177CompareApril 9, 2025 12:25
@Zuruuh
Copy link
ContributorAuthor

👍 Updated the implem to use astring|array instead 👍 Also moved the check for existing aliases inside of the env condition to ensure we don't fail when an alias isn't going to be used for the selected environment.
Also fixed the huge diff on CHANGELOG.md I forgot to disable my auto-formatter 🤠

The new tests pass now locally

@Zuruuh
Copy link
ContributorAuthor

I've checked the failling tests quickly and they seem unrelated 👍 Looks like they're also failling on other PRs

@nicolas-grekasnicolas-grekasforce-pushed thealias-attribute-when-argument branch from0f2869f to187524dCompareApril 14, 2025 12:40
@nicolas-grekas
Copy link
Member

Thank you@Zuruuh.

Zuruuh reacted with hooray emoji

@nicolas-grekasnicolas-grekas merged commitd5b5581 intosymfony:7.3Apr 14, 2025
6 of 11 checks passed
@ZuruuhZuruuh deleted the alias-attribute-when-argument branchApril 14, 2025 12:47
@fabpotfabpot mentioned this pull requestMay 2, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@OskarStarkOskarStarkOskarStark left review comments

@alexandre-dauboisalexandre-dauboisalexandre-daubois left review comments

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

@GromNaNGromNaNGromNaN approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
7.3
Development

Successfully merging this pull request may close these issues.

Add "when" argument to #[AsAlias]
6 participants
@Zuruuh@carsonbot@nicolas-grekas@GromNaN@OskarStark@alexandre-daubois

[8]ページ先頭

©2009-2025 Movatter.jp