10000 [DependencyInjection] Enable deprecating parameters · symfony/symfony-docs@04ad117 · GitHub
[go: up one dir, main page]

Skip to content

Commit 04ad117

Browse files
[DependencyInjection] Enable deprecating parameters
1 parent 740e44f commit 04ad117

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

configuration.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ Configuration Formats
5858
~~~~~~~~~~~~~~~~~~~~~
5959

6060
Unlike other frameworks, Symfony doesn't impose a specific format on you to
61-
configure your applications, but lets you choose between YAML, XML and PHP.
61+
configure your applications, but lets you choose between YAML, XML and PHP.
6262
Throughout the Symfony documentation, all configuration examples will be
6363
shown in these three formats.
6464

service_container.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -607,6 +607,22 @@ accessor methods for parameters::
607607
To learn more about compiling the container see
608608
:doc:`/components/dependency_injection/compilation`.
609609

610+
It is also possible to deprecate a container parameter. This is particularly useful
611+
if you're writing your own package and want to warn developers to not use a parameter anymore
612+
because it will be removed in one of the next version of your package.
613+
Deprecating a container parameter can be done as follow::
614+
615+
$container->deprecateParameter(
616+
'vendor.foo',
617+
'vendor-name/package-name', '1.3',
618+
// optionally you can set a custom deprecation message
619+
'"vendor.foo" is deprecated, you should use "vendor.foo_replacement" instead.'
620+
);
621+
622+
.. versionadded:: 6.3
623+
624+
The ``ContainerBuilder::deprecateParameter`` method was introduced in Symfony 6.3.
625+
610626
.. _services-wire-specific-service:
611627

612628
Choose a Specific Service

0 commit comments

Comments
 (0)
0