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

Commitcc7a726

Browse files
committed
minor#16458 [DependencyInjection] Fix YAML example in "Defining a Service Locator" section (jbieliauskas)
This PR was merged into the 4.4 branch.Discussion----------[DependencyInjection] Fix YAML example in "Defining a Service Locator" sectionUsing this example in `v5.3.13` gives this error:```Symfony\Component\DependencyInjection\Definition::setArguments(): Argument#1 ($arguments) must be of type array, Symfony\Component\DependencyInjection\Argument\ServiceLocatorArgument given, called in /project/vendor/symfony/dependency-injection/Loader/YamlFileLoader.php on line 527```I assume this is because `!service_locator` is the first constructor argument but it's passed as an array of constructor arguments, in which case the example is not right.<!--If your pull request fixes a BUG, use the oldest maintained branch that containsthe bug (seehttps://symfony.com/releases for the list of maintained branches).If your pull request documents a NEW FEATURE, use the same Symfony branch wherethe feature was introduced (and `6.x` for features of unreleased versions).-->Commits-------bd8b262 Fix YAML example in "Defining a Service Locator" section
2 parents35580b9 +bd8b262 commitcc7a726

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

‎service_container/service_subscribers_locators.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,9 +256,10 @@ argument of type ``service_locator``:
256256
# config/services.yaml
257257
services:
258258
App\CommandBus:
259-
arguments:!service_locator
260-
App\FooCommand:'@app.command_handler.foo'
261-
App\BarCommand:'@app.command_handler.bar'
259+
arguments:
260+
-!service_locator
261+
App\FooCommand:'@app.command_handler.foo'
262+
App\BarCommand:'@app.command_handler.bar'
262263
263264
..code-block::xml
264265

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp