Skip to content

Commit a2846b9

Browse files
committed
[symfony#13379] Some small cleanups
1 parent c494084 commit a2846b9

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

Diff for: components/phpunit_bridge.rst

+6-3
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,14 @@ each test suite's results in their own section.
161161
Trigger Deprecation Notices
162162
---------------------------
163163

164-
Deprecation notices can be triggered by using::
164+
Deprecation notices can be triggered by using ``trigger_deprecation`` from
165+
the ``symfony/deprecation-contracts`` package::
165166

166-
trigger_deprecation('vendor-name/package-name', '5.1', 'Your deprecation message');
167+
// indicates something is deprecated since version 1.3 of vendor-name/packagename
168+
trigger_deprecation('vendor-name/package-name', '1.3', 'Your deprecation message');
167169

168-
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)
171+
trigger_deprecation('...', '1.3', 'Value "%s" is deprecated, use ... instead.', $value);
169172

170173
Mark Tests as Legacy
171174
--------------------

Diff for: contributing/code/conventions.rst

+4-6
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,10 @@ When the replacement is in another namespace than the deprecated class, its FQCN
116116
* @deprecated since Symfony 5.1, use A\B\Replacement instead.
117117
*/
118118

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)::
124121

122+
trigger_deprecation('symfony/package-name', '5.1', 'The "%s" class is deprecated, use "%s" instead.', Deprecated::class, Replacement::class);
125123

126124
When deprecating a whole class the ``trigger_deprecation()`` call should be placed
127125
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
131129

132130
use Symfony\Component\Routing\Loader\ContainerLoader;
133131

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);
135133

136134
/**
137135
* @deprecated since Symfony 4.4, use Symfony\Component\Routing\Loader\ContainerLoader instead.

Diff for: contributing/code/standards.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ short example containing most features described below::
7272
*/
7373
public function someDeprecatedMethod()
7474
{
75-
trigger_deprecation('vendor-name/package-name', '5.1', 'The %s() method is deprecated. Use Acme\Baz::someMethod() instead.', __METHOD__);
75+
trigger_deprecation('symfony/package-name', '5.1', 'The %s() method is deprecated, use Acme\Baz::someMethod() instead.', __METHOD__);
7676

7777
return Baz::someMethod();
7878
}

0 commit comments

Comments
 (0)