Skip to content

[DI] add id of referencing service when a deprecated alias is found #29995

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

Merged
merged 1 commit into from
Jan 28, 2019

Conversation

nicolas-grekas
Copy link
Member

Q A
Branch? master
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets -
License MIT
Doc PR -

Improves #29968 a bit for DX.

@javiereguiluz
Copy link
Member

Nice improvement! Not sure if it's possible, but I'd reword the error message:

As referenced by "alias": the "deprecated_foo_alias" service alias
is deprecated. You should stop using it, as it will soon be removed.

like this:

The "deprecated_foo_alias" service alias referenced by "alias"
is deprecated. You should stop using it, as it will soon be removed.

@nicolas-grekas
Copy link
Member Author

I'd happily improve the message, but your suggestion is not possible, see L65 how the message is constructed. We can only append or prepend to the message conveyed by the alias.

Copy link
Member

@javiereguiluz javiereguiluz left a comment

Choose a reason for hiding this comment

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

Nice!

@javiereguiluz javiereguiluz added the DX DX = Developer eXperience (anything that improves the experience of using Symfony) label Jan 28, 2019
@stof
Copy link
Member

stof commented Jan 28, 2019

Note that this PR is renaming the placeholder used in the message. When it gets merged, the blog post published today should be updated to reflect the change.

@nicolas-grekas nicolas-grekas merged commit b124fb7 into symfony:master Jan 28, 2019
nicolas-grekas added a commit that referenced this pull request Jan 28, 2019
… is found (nicolas-grekas)

This PR was merged into the 4.3-dev branch.

Discussion
----------

[DI] add id of referencing service when a deprecated alias is found

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Improves #29968 a bit for DX.

Commits
-------

b124fb7 [DI] add id of referencing service when a deprecated alias is found
@stof
Copy link
Member

stof commented Jan 28, 2019

@nicolas-grekas with your change to move the trigger_error outside the loop, what happens if you have non-deprecated alias -> deprecated alias -> actual service ? Do we still get a warning somewhere (so that the author of non-deprecated alias can know that they should update their alias) ?

@nicolas-grekas nicolas-grekas deleted the alias+ branch January 28, 2019 16:44
@nicolas-grekas
Copy link
Member Author

Do we still get a warning somewhere (so that the author of non-deprecated alias can know that they should update their alias) ?

yes, because of the loop in process (see L32)

@javiereguiluz
Copy link
Member

@stof thanks for this warning. The blog post has been updated accordingly.

javiereguiluz added a commit to symfony/symfony-docs that referenced this pull request Jan 29, 2019
…iluz)

This PR was squashed before being merged into the master branch (closes #10937).

Discussion
----------

Documented the deprecation of service aliases

It documents symfony/symfony#29968 but it contains the changes of the pending PR symfony/symfony#29995

Commits
-------

d5d87e6 Documented the deprecation of service aliases
XuruDragon pushed a commit to XuruDragon/symfony that referenced this pull request Feb 4, 2019
…ebug:autowiring

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | none
| License       | MIT
| Doc PR        | n/a

Fix and improves a bit PR symfony#29968 and symfony#29995
XuruDragon pushed a commit to XuruDragon/symfony that referenced this pull request Feb 4, 2019
…ebug:autowiring

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | none
| License       | MIT
| Doc PR        | n/a

Fix and improves a bit PR symfony#29968 and symfony#29995
XuruDragon pushed a commit to XuruDragon/symfony that referenced this pull request Feb 4, 2019
…ebug:autowiring

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | none
| License       | MIT
| Doc PR        | n/a

Fix and improves a bit PR symfony#29968 and symfony#29995
XuruDragon pushed a commit to XuruDragon/symfony that referenced this pull request Feb 4, 2019
…ebug:autowiring

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | none
| License       | MIT
| Doc PR        | n/a

Fix and improves a bit PR symfony#29968 and symfony#29995
XuruDragon pushed a commit to XuruDragon/symfony that referenced this pull request Feb 5, 2019
…ebug:autowiring

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | none
| License       | MIT
| Doc PR        | n/a

Fix and improves a bit PR symfony#29968 and symfony#29995
XuruDragon pushed a commit to XuruDragon/symfony that referenced this pull request Feb 6, 2019
…ebug:autowiring

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | none
| License       | MIT
| Doc PR        | n/a

Fix and improves a bit PR symfony#29968 and symfony#29995
XuruDragon pushed a commit to XuruDragon/symfony that referenced this pull request Feb 6, 2019
…ebug:autowiring

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | none
| License       | MIT
| Doc PR        | n/a

Fix and improves a bit PR symfony#29968 and symfony#29995
XuruDragon pushed a commit to XuruDragon/symfony that referenced this pull request Feb 6, 2019
…ebug:autowiring

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | none
| License       | MIT
| Doc PR        | n/a

Fix and improves a bit PR symfony#29968 and symfony#29995
XuruDragon pushed a commit to XuruDragon/symfony that referenced this pull request Feb 6, 2019
…ebug:autowiring

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | none
| License       | MIT
| Doc PR        | n/a

Fix and improves a bit PR symfony#29968 and symfony#29995
XuruDragon pushed a commit to XuruDragon/symfony that referenced this pull request Feb 7, 2019
…ebug:autowiring

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | none
| License       | MIT
| Doc PR        | n/a

Fix and improves a bit PR symfony#29968 and symfony#29995
nicolas-grekas added a commit that referenced this pull request Feb 8, 2019
…ed aliases in debug:autowiring (XuruDragon)

This PR was merged into the 4.3-dev branch.

Discussion
----------

[DependencyInjection] Added information about deprecated aliases in debug:autowiring

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | none
| License       | MIT
| Doc PR        | n/a

Fix and improves a bit PR #29968 and #29995

![Screenshot](https://i.imgur.com/GDj2NIY.png)

Commits
-------

3d2378d [DependencyInjection] Added information about deprecated aliases in debug:autowiring
@nicolas-grekas nicolas-grekas modified the milestones: next, 4.3 Apr 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DependencyInjection DX DX = Developer eXperience (anything that improves the experience of using Symfony) Status: Reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants