Skip to content

Removes duplicated Deprecated and adds an example. #7243

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion contributing/code/conventions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ A feature is marked as deprecated by adding a ``@deprecated`` phpdoc to
relevant classes, methods, properties, ...::

/**
* @deprecated Deprecated since version 2.8, to be removed in 3.0. Use XXX instead.
* @deprecated since version 2.8, to be removed in 3.0. Use XXX instead.
*/

The deprecation message should indicate the version when the class/method was
Expand All @@ -111,3 +111,21 @@ ready to cope with them (by adding a custom error handler like the one used by
the Web Debug Toolbar or by the PHPUnit bridge).

.. _`@-silencing operator`: https://php.net/manual/en/language.operators.errorcontrol.php

When deprecating a whole class the error should be placed between namespace and
use declarations, like in this example from `ArrayParserCache`_::

namespace Symfony\Component\ExpressionLanguage\ParserCache;

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

use Symfony\Component\ExpressionLanguage\ParsedExpression;

/**
* @author Adrien Brault <adrien.brault@gmail.com>
*
* @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.
*/
class ArrayParserCache implements ParserCacheInterface

.. _`ArrayParserCache`: https://github.com/symfony/symfony/blob/3.2/src/Symfony/Component/ExpressionLanguage/ParserCache/ArrayParserCache.php