You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Where 5.1 is the version from which the deprecation starts. Note that the deprecation message can use the :phpfunction:`printf` format. In this case, you can pass placeholders as extra arguments after the deprecation message.
170
+
// you can also use printf format (all arguments after the message will be used)
8000
171
+
trigger_deprecation('...', '1.3', 'Value "%s" is deprecated, use ... instead.', $value);
Copy file name to clipboardExpand all lines: contributing/code/conventions.rst
+4-6Lines changed: 4 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -116,12 +116,10 @@ When the replacement is in another namespace than the deprecated class, its FQCN
116
116
* @deprecated since Symfony 5.1, use A\B\Replacement instead.
117
117
*/
118
118
119
-
A PHP ``E_USER_DEPRECATED`` error must also be triggered to help people with the migration::
120
-
121
-
trigger_deprecation('vendor-name/package-name', '5.1', 'The "%s" class is deprecated since Symfony 5.1, use "%s" instead.', Deprecated::class, Replacement::class);
122
-
123
-
The ``trigger_deprecation`` function internally use the php function :phpfunction:`assert`. This means you should use `zend.assertions` to disable deprecations in production.
119
+
A deprecation must also be triggered to help people with the migration
120
+
(requires the ``symfony/deprecation-contracts`` package)::
124
121
122
+
trigger_deprecation('symfony/package-name', '5.1', 'The "%s" class is deprecated, use "%s" instead.', Deprecated::class, Replacement::class);
125
123
126
124
When deprecating a whole class the ``trigger_deprecation()`` call should be placed
127
125
between the namespace and the use declarations, like in this example from
@@ -131,7 +129,7 @@ between the namespace and the use declarations, like in this example from
131
129
132
130
use Symfony\Component\Routing\Loader\ContainerLoader;
133
131
134
-
trigger_deprecation('symfony/routing', '4.4', 'The "%s" class is deprecated since Symfony 4.4, use "%s" instead.', ServiceRouterLoader::class, ContainerLoader::class);
132
+
trigger_deprecation('symfony/routing', '4.4', 'The "%s" class is deprecated, use "%s" instead.', ServiceRouterLoader::class, ContainerLoader::class);
135
133
136
134
/**
137
135
* @deprecated since Symfony 4.4, use Symfony\Component\Routing\Loader\ContainerLoader instead.
0 commit comments