8000 minor #7243 Removes duplicated Deprecated and adds an example. (dbrum… · symfony/symfony-docs@c4d1f54 · GitHub
[go: up one dir, main page]

Skip to content

Commit c4d1f54

Browse files
committed
minor #7243 Removes duplicated Deprecated and adds an example. (dbrumann)
This PR was submitted for the master branch but it was merged into the 2.7 branch instead (closes #7243). Discussion ---------- Removes duplicated Deprecated and adds an example. Removes the duplicate "Deprecated" after `@deprecated` annotation as was asked in my PR symfony/symfony#20735. Also adds a randomly selected example that shows how the abstract `XXX` should look like and an edge case of `trigger_error()` when deprecating a whole class. Commits ------- a2c04e7 Deletes duplicate "Deprecated" and adds a more explicit example.
2 parents 7cbf8be + a2c04e7 commit c4d1f54

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

contributing/code/conventions.rst

Lines changed: 19 additions & 1 deletion
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 Deprecated since version 2.8, to be removed in 3.0. Use XXX instead.
95+
* @deprecated since version 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
@@ -111,3 +111,21 @@ ready to cope with them (by adding a custom error handler like the one used by
111111
the Web Debug Toolbar or by the PHPUnit bridge).
112112

113113
.. _`@-silencing operator`: https://php.net/manual/en/language.operators.errorcontrol.php
114+
115+
When deprecating a whole class the error should be placed between namespace and
116+
use declarations, like in this example from `ArrayParserCache`_::
117+
118+
namespace Symfony\Component\ExpressionLanguage\ParserCache;
119+
120+
@trigger_error('The '.__NAMESPACE__.'\ArrayParserCache class is deprecated since version 3.2 and will be removed in 4.0. Use the Symfony\Component\Cache\Adapter\ArrayAdapter class instead.', E_USER_DEPRECATED);
121+
122+
use Symfony\Component\ExpressionLanguage\ParsedExpression;
123+
124+
/**
125+
* @author Adrien Brault <adrien.brault@gmail.com>
126+
*
127+
* @deprecated ArrayParserCache class is deprecated since version 3.2 and will be removed in 4.0. Use the Symfony\Component\Cache\Adapter\ArrayAdapter class instead.
128+
*/
129+
class ArrayParserCache implements ParserCacheInterface
130+
131+
.. _`ArrayParserCache`: https://github.com/symfony/symfony/blob/3.2/src/Symfony/Component/ExpressionLanguage/ParserCache/ArrayParserCache.php

0 commit comments

Comments
 (0)
0