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

[DI] deprecate theinline() function from the PHP-DSL in favor ofservice()#36388

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
fabpot merged 1 commit intosymfony:masterfromnicolas-grekas:di-inline
Apr 12, 2020

Conversation

nicolas-grekas
Copy link
Member

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

In the PHP-DSL, theinline() function helps declaring ... inline services.

I'm proposing to rename it toservice(), for consistency with yaml tags. All other helpers but this one have the same name as the yaml tag.

Let's do this while "nobody" uses this format yet :)

@fabpot
Copy link
Member

Thank you@nicolas-grekas.

@fabpotfabpot merged commit6ff7c2e intosymfony:masterApr 12, 2020
@nicolas-grekasnicolas-grekas deleted the di-inline branchApril 12, 2020 12:06
fabpot added a commit that referenced this pull requestApr 24, 2020
This PR was merged into the 5.1-dev branch.Discussion----------[DI] add syntax to stack decorators| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | yes| Deprecations? | no| Tickets       |Fix#30599| License       | MIT| Doc PR        | -Declare this:```yamlservices:    my_stack_of_decorators:        stack:            - class: App\ExternalDecorator            - class: App\InternalDecorator            - class: App\DecoratoredClass```And get this:![image](https://user-images.githubusercontent.com/243674/78615803-b8c8e580-7872-11ea-95c2-22cb78f88ca8.png)The PR is now ready with support for Yaml, XML and the PHP-DSL. It needs#36388,#36392 and#36389 to pass, and relates to#36390 to be DX-friendly.The new syntax now supports composable stacks - i.e stack you can reuse in the middle of another stack.RIP middleware, simple decorators FTW :)From the test cases:```yamlservices:    reusable_stack:        stack:            - class: stdClass              properties:                  label: A                  inner: '@.inner'            - class: stdClass              properties:                  label: B                  inner: '@.inner'    concrete_stack:        stack:            - parent: reusable_stack            - class: stdClass              properties:                  label: C```This will create a service similar to:```php(object) [    'label' => 'A',    'inner' => (object) [        'label' => 'B',        'inner' => (object) [             'label' => 'C',        ]    ],];```When used together with autowiring, this is enough to declare a stack of decorators:```yamlservices:    my_processing_stack:        stack:            - App\ExternalDecorator: ~            - App\InternalDecorator: ~            - App\TheDecoratedClass: ~```See fixtures for the other configuration formats.See alsohttps://twitter.com/nicolasgrekas/status/1248198573998604288Todo:- [x] rebase on top of#36388,#36392 and#36389 once they are merged- [x] test declaring deeper nested stacksCommits-------98eeeae [DI] add syntax to stack decorators
@nicolas-grekasnicolas-grekas modified the milestones:next,5.1May 4, 2020
@fabpotfabpot mentioned this pull requestMay 5, 2020
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@fabpotfabpotfabpot approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
5.1
Development

Successfully merging this pull request may close these issues.

3 participants
@nicolas-grekas@fabpot@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp