File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -267,15 +267,20 @@ The following example shows how to inject an anonymous service into another serv
267
267
$services = $configurator->services();
268
268
269
269
$services->set(Foo::class)
270
- ->args([inline (AnonymousBar::class)])
270
+ ->args([service (AnonymousBar::class)])
271
271
};
272
272
273
+ .. versionadded :: 5.1
274
+
275
+ The ``service() `` function was introduced in Symfony 5.1. In previous
276
+ versions it was called ``inline() ``.
277
+
273
278
.. note ::
274
279
275
280
Anonymous services do *NOT * inherit the definitions provided from the
276
281
defaults defined in the configuration. So you'll need to explicitly mark
277
282
service as autowired or autoconfigured when doing an anonymous service
278
- e.g.: ``inline (Foo::class)->autowire()->autoconfigure() ``.
283
+ e.g.: ``service (Foo::class)->autowire()->autoconfigure() ``.
279
284
280
285
Using an anonymous service as a factory looks like this:
281
286
@@ -318,7 +323,7 @@ Using an anonymous service as a factory looks like this:
318
323
$services = $configurator->services();
319
324
320
325
$services->set(Foo::class)
321
- ->factory([inline (AnonymousBar::class), 'constructFoo'])
326
+ ->factory([service (AnonymousBar::class), 'constructFoo'])
322
327
};
323
328
324
329
Deprecating Services
You can’t perform that action at this time.
0 commit comments