Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[DependencyInjection] Preserve the id of decorated services #49622

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

Closed

Conversation

nicolas-grekas
Copy link
Member

@nicolas-grekas nicolas-grekas commented Mar 6, 2023

Q A
Branch? 6.3
Bug fix? no
New feature? no
Deprecations? no
Tickets -
License MIT
Doc PR -

Currently, when a service "foo" is decorated by a service "bar", all references to "foo" are replaced by references to "bar".

This has visible side effects e.g. when running debug:autowiring, before this PR:

Symfony\Contracts\HttpClient\HttpClientInterface (.debug.http_client)

After:

Symfony\Contracts\HttpClient\HttpClientInterface (http_client)

Details matter ;)

@carsonbot carsonbot added this to the 6.3 milestone Mar 6, 2023
nicolas-grekas added a commit that referenced this pull request Mar 6, 2023
… convention (nicolas-grekas)

This PR was merged into the 5.4 branch.

Discussion
----------

[Translation] Decouple TranslatorPathsPass from "debug." convention

| Q             | A
| ------------- | ---
| Branch?       | 5.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

Needed to make #49622 green.

Commits
-------

0a12ee6 [Translation] Decouple TranslatorPathsPass from "debug." convention
@nicolas-grekas nicolas-grekas force-pushed the di-rename-decorated branch 5 times, most recently from 3522d0b to 4793562 Compare March 6, 2023 21:11
@@ -22,11 +22,23 @@
*/
class ResolveReferencesToAliasesPass extends AbstractRecursivePass
{
public function __construct(
private ?DecoratorServicePass $decoratorPass = null,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
private ?DecoratorServicePass $decoratorPass = null,
private readonly ?DecoratorServicePass $decoratorPass = null,

/**
* @var array<string, string>
*/
public array $decoratedServices = [];
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
public array $decoratedServices = [];
private array $decoratedServices = [];

@nicolas-grekas
Copy link
Member Author

Thanks for the reviews. I figured out during the night that a less invasive approach might be preferred. See #49625

@nicolas-grekas nicolas-grekas deleted the di-rename-decorated branch March 7, 2023 08:08
nicolas-grekas added a commit that referenced this pull request Mar 8, 2023
…as-grekas)

This PR was merged into the 6.3 branch.

Discussion
----------

[DependencyInjection] Keep track of decorated ids

| Q             | A
| ------------- | ---
| Branch?       | 6.3
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

When a service "foo" is decorated by a service "bar", all references to "foo" are replaced by references to "bar".

This has visible side effects e.g. when running `debug:autowiring`, before this PR:
```
Symfony\Contracts\HttpClient\HttpClientInterface (.debug.http_client)
```

After:
```
Symfony\Contracts\HttpClient\HttpClientInterface (http_client)
```

Details matter ;)

This PR replaces #49622 since it's a less invasive way to achieve this behavior.

Commits
-------

1ac07d3 [DependencyInjection] Keep track of decorated ids
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.

4 participants