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] Optimize autowiring logic by telling it about excluded symbols#46279

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
nicolas-grekas merged 1 commit intosymfony:6.2fromnicolas-grekas:di-autowe
May 27, 2022

Conversation

@nicolas-grekas
Copy link
Member

@nicolas-grekasnicolas-grekas commentedMay 6, 2022
edited
Loading

QA
Branch?6.1
Bug fix?no
New feature?yes
Deprecations?no
Tickets-
LicenseMIT
Doc PR-

Replaces#46275

While inspecting the dumped container of the demo app, I noticed that it contains so-called "errored" services. They come e.g from entities that are used as type-hints on controllers. To compute those services, the autowiring logic currently loads all services looking for possible type-compatible candidates.

But here, we should know that those won't be found: they're excluded from being loaded.

Instead of completely ignoring excluded classes, this PR still registers them, but as abstract and with a specialcontainer.excluded tag.

This allows the rest of the compilation logic to skip+remove them, while allowingAutowiringPass to compute a better error message and way faster.

Here is the relevant part of ahttps://blackfire.io comparison:

image

chalasr, javiereguiluz, maxhelias, and ging-dev reacted with rocket emoji
@nicolas-grekasnicolas-grekas changed the title[DependencyInjection] Optimize autowiring logic by telling it about about excluded symbols[DependencyInjection] Optimize autowiring logic by telling it about excluded symbolsMay 6, 2022
@nicolas-grekasnicolas-grekasforce-pushed thedi-autowe branch 4 times, most recently from008b491 toa8c3369CompareMay 6, 2022 16:49
fabpot added a commit that referenced this pull requestJul 3, 2022
…(HypeMC)This PR was merged into the 6.2 branch.Discussion----------[DependencyInjection] Add missing use statement in test| Q             | A| ------------- | ---| Branch?       | 6.2| Bug fix?      | yes| New feature?  | no| Deprecations? | no| Tickets       | -| License       | MIT| Doc PR        | -Looks like#46279 removed a use statement by accident. This PR returns the missing use statement & fixes the tests.Commits-------b03cbe6 [DependencyInjection] Add missing use statement in test
@fabpotfabpot mentioned this pull requestOct 24, 2022
nicolas-grekas added a commit that referenced this pull requestDec 14, 2022
…for excluded services (apfelbox)This PR was merged into the 6.2 branch.Discussion----------[FrameworkBundle] container:debug CLI output improvements for excluded services| Q             | A| ------------- | ---| Branch?       | 6.3| Bug fix?      | no| New feature?  | yes (not sure)| Deprecations? | no| Tickets       | —| License       | MIT| Doc PR        | —<!--Replace this notice by a short README for your feature/bugfix.This will help reviewers and should be a good start for the documentation.Additionally (seehttps://symfony.com/releases): - Always add tests and ensure they pass. - Bug fixes must be submitted against the lowest maintained branch where they apply   (lowest branches are regularly merged to upper ones so they get the fixes too). - Features and deprecations must be submitted against the latest branch. - For new features, provide some code snippets to help understand usage. - Changelog entry should followhttps://symfony.com/doc/current/contributing/code/conventions.html#writing-a-changelog-entry - Never break backward compatibility (seehttps://symfony.com/bc).-->Normally I test whether the exclusion rules from the service container of my bundles work correctly by just using the `debug:container` command and looking whether my excluded services occur in the last.However, due to the latest changes in#46279 all services (excluded or not) are always in this list.You need to open the definition to see if it was excluded:![CleanShot 2022-12-12 at 11 01 08](https://user-images.githubusercontent.com/1032411/207017120-50d3c263-ce7a-4c92-bb7e-8a8f86c47983.png)This PR proposes two things:1. add a more prominent warning to the service definition details screen that the service is excluded![CleanShot 2022-12-12 at 11 01 52](https://user-images.githubusercontent.com/1032411/207017261-44495233-f513-4c29-bb6d-469eb0418080.png)(wording tbd)2. mark the services as excluded in the list (right now by graying them out):![CleanShot 2022-12-12 at 11 02 44](https://user-images.githubusercontent.com/1032411/207017481-993010da-3364-49dd-b7e0-4f3c07f14ad5.png)If this looks like something you want to include, I will add the "graying out" part to the table view as well.wdyt?Commits-------9d2f10f Hide excluded services from container debug list
chalasr added a commit that referenced this pull requestMay 29, 2023
…s92)This PR was merged into the 6.2 branch.Discussion----------Hide definitions bearing the `container.excluded` tag| Q             | A| ------------- | ---| Branch?       | 6.2| Bug fix?      | yes| New feature?  | no| | Depreciation? | no| Tickets       |Fix#50417| License       | MIT| Doc PR        | -Normally I test whether the exclusion rules from the service container of my bundles work correctly by just using the `debug:container` command and looking whether my excluded services occur in the last.However, due to the latest changes in#46279 all folders and subfulders (excluded or not) are always in this list.You need to open the definition to see if it was excluded:<img width="1463" alt="Service Container" src="https://github.com/symfony/symfony/assets/31630905/609d75b7-3840-4c7d-b3ec-4c0d4bc158e6">For example, `Command`, `Query`, `Entity` are folders, but they are specified as services in the container.This PR fixes this problem to ignore definitions bearing the container.excluded tag if those are to be hidden for Descriptors: `JsonDescriptor`,  `MarkdownDescriptor`, `TextDescriptor` and `XmlDescriptor`.After fixes problem:<img width="1351" alt="Снимок экрана 2023-05-27 в 17 03 19" src="https://github.com/symfony/symfony/assets/31630905/e2aecdeb-9261-4d98-af10-a74db7f1e46a">Commits-------2c668ba Ignore definitions bearing the `container.excluded` tag
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@javiereguiluzjaviereguiluzjaviereguiluz left review comments

@stofstofstof approved these changes

@dunglasdunglasAwaiting requested review from dunglasdunglas is a code owner

Assignees

No one assigned

Projects

None yet

Milestone

6.2

Development

Successfully merging this pull request may close these issues.

6 participants

@nicolas-grekas@javiereguiluz@brusch@stof@chalasr@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp