Skip to content

Commit c0a88f6

Browse files
committed
minor #11522 Recommend including the package name in messages (greg0ire)
This PR was merged into the 3.4 branch. Discussion ---------- Recommend including the package name in messages Version numbers, but they make more sense when you know the package name. Most times, you will be able to figure it out from some FQCN, but this should make things easier for everyone. cc @nicolas-grekas who told me about this best practice I'm unsure about whether this is the best branch for that kind of (pedantic ?) change Commits ------- d2cfba7 Recommend including the package name in messages
2 parents 5e9d9ac + d2cfba7 commit c0a88f6

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

contributing/code/conventions.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ A feature is marked as deprecated by adding a ``@deprecated`` phpdoc to
9292
relevant classes, methods, properties, ...::
9393

9494
/**
95-
* @deprecated since version 2.8, to be removed in 3.0. Use XXX instead.
95+
* @deprecated since foo-org/bar-lib 2.8, to be removed in 3.0. Use XXX instead.
9696
*/
9797

9898
The deprecation message should indicate the version when the class/method was
@@ -103,7 +103,7 @@ A PHP ``E_USER_DEPRECATED`` error must also be triggered to help people with
103103
the migration starting one or two minor versions before the version where the
104104
feature will be removed (depending on the criticality of the removal)::
105105

106-
@trigger_error('XXX() is deprecated since version 2.8 and will be removed in 3.0. Use XXX instead.', E_USER_DEPRECATED);
106+
@trigger_error('XXX() is deprecated since foo-org/bar-lib 2.8 and will be removed in 3.0. Use XXX instead.', E_USER_DEPRECATED);
107107

108108
Without the `@-silencing operator`_, users would need to opt-out from deprecation
109109
notices. Silencing swaps this behavior and allows users to opt-in when they are

contributing/code/standards.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ short example containing most features described below::
6767
*/
6868
public function someDeprecatedMethod()
6969
{
70-
@trigger_error(sprintf('The %s() method is deprecated since version 2.8 and will be removed in 3.0. Use Acme\Baz::someMethod() instead.', __METHOD__), E_USER_DEPRECATED);
70+
@trigger_error(sprintf('The %s() method is deprecated since foo-org/bar-lib 2.8 and will be removed in 3.0. Use Acme\Baz::someMethod() instead.', __METHOD__), E_USER_DEPRECATED);
7171

7272
return Baz::someMethod();
7373
}

service_container/alias_private.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ or you decided not to maintain it anymore), you can deprecate its definition:
241241
.. code-block:: yaml
242242
243243
AppBundle\Service\OldService:
244-
deprecated: The "%service_id%" service is deprecated since 2.8 and will be removed in 3.0.
244+
deprecated: The "%service_id%" service is deprecated since foo-org/bar-bundle 2.8 and will be removed in 3.0.
245245
246246
.. code-block:: xml
247247
@@ -252,7 +252,7 @@ or you decided not to maintain it anymore), you can deprecate its definition:
252252
253253
<services>
254254
<service id="AppBundle\Service\OldService">
255-
<deprecated>The "%service_id%" service is deprecated since 2.8 and will be removed in 3.0.</deprecated>
255+
<deprecated>The "%service_id%" service is deprecated since foo-org/bar-bundle 2.8 and will be removed in 3.0.</deprecated>
256256
</service>
257257
</services>
258258
</container>
@@ -265,7 +265,7 @@ or you decided not to maintain it anymore), you can deprecate its definition:
265265
->register(OldService::class)
266266
->setDeprecated(
267267
true,
268-
'The "%service_id%" service is deprecated since 2.8 and will be removed in 3.0.'
268+
'The "%service_id%" service is deprecated since foo-org/bar-bundle 2.8 and will be removed in 3.0.'
269269
)
270270
;
271271

0 commit comments

Comments
 (0)