Skip to content

Commit

Permalink
Adds deprecation notices for structures to be removed in 3.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
Hugo Hamon committed Jan 5, 2015
1 parent e64daca commit 86b9f6b
Show file tree
Hide file tree
Showing 164 changed files with 435 additions and 145 deletions.
Expand Up @@ -300,6 +300,8 @@ public function getValuesForChoices(array $entities)
*/
public function getIndicesForChoices(array $entities)
{
trigger_error('The '.__METHOD__.' method is deprecated since version 2.4 and will be removed in 3.0.', E_USER_DEPRECATED);

// Performance optimization
if (empty($entities)) {
return array();
Expand Down Expand Up @@ -342,6 +344,8 @@ public function getIndicesForChoices(array $entities)
*/
public function getIndicesForValues(array $values)
{
trigger_error('The '.__METHOD__.' method is deprecated since version 2.4 and will be removed in 3.0.', E_USER_DEPRECATED);

// Performance optimization
if (empty($values)) {
return array();
Expand Down
2 changes: 2 additions & 0 deletions src/Symfony/Bridge/Doctrine/Tests/DoctrineOrmTestCase.php
Expand Up @@ -11,6 +11,8 @@

namespace Symfony\Bridge\Doctrine\Tests;

trigger_error('The '.__NAMESPACE__.'\DoctrineOrmTestCase class is deprecated since version 2.4 and will be removed in 3.0. Use Symfony\Bridge\Doctrine\Test\DoctrineTestHelper class instead.', E_USER_DEPRECATED);

use Symfony\Bridge\Doctrine\Test\DoctrineTestHelper;

/**
Expand Down
16 changes: 8 additions & 8 deletions src/Symfony/Bridge/Monolog/Logger.php
Expand Up @@ -23,41 +23,41 @@
class Logger extends BaseLogger implements LoggerInterface, DebugLoggerInterface
{
/**
* @deprecated since 2.2, to be removed in 3.0. Use emergency() which is PSR-3 compatible.
* @deprecated since version 2.2, to be removed in 3.0. Use emergency() which is PSR-3 compatible.
*/
public function emerg($message, array $context = array())
{
trigger_error('The emerg() method of the Monolog Logger was removed. You should use the new method emergency() instead, which is PSR-3 compatible.', E_USER_DEPRECATED);
trigger_error('The '.__METHOD__.' method of the Monolog Logger was removed. Use the emergency() method instead, which is PSR-3 compatible.', E_USER_DEPRECATED);

return parent::addRecord(BaseLogger::EMERGENCY, $message, $context);
}

/**
* @deprecated since 2.2, to be removed in 3.0. Use critical() which is PSR-3 compatible.
* @deprecated since version 2.2, to be removed in 3.0. Use critical() which is PSR-3 compatible.
*/
public function crit($message, array $context = array())
{
trigger_error('The crit() method of the Monolog Logger was removed. You should use the new method critical() instead, which is PSR-3 compatible.', E_USER_DEPRECATED);
trigger_error('The '.__METHOD__.' method of the Monolog Logger was removed. Use the method critical() method instead, which is PSR-3 compatible.', E_USER_DEPRECATED);

return parent::addRecord(BaseLogger::CRITICAL, $message, $context);
}

/**
* @deprecated since 2.2, to be removed in 3.0. Use error() which is PSR-3 compatible.
* @deprecated since version 2.2, to be removed in 3.0. Use error() which is PSR-3 compatible.
*/
public function err($message, array $context = array())
{
trigger_error('The err() method of the Monolog Logger was removed. You should use the new method error() instead, which is PSR-3 compatible.', E_USER_DEPRECATED);
trigger_error('The '.__METHOD__.' method of the Monolog Logger was removed. Use the error() method instead, which is PSR-3 compatible.', E_USER_DEPRECATED);

return parent::addRecord(BaseLogger::ERROR, $message, $context);
}

/**
* @deprecated since 2.2, to be removed in 3.0. Use warning() which is PSR-3 compatible.
* @deprecated since version 2.2, to be removed in 3.0. Use warning() which is PSR-3 compatible.
*/
public function warn($message, array $context = array())
{
trigger_error('The warn() method of the Monolog Logger was removed. You should use the new method warning() instead, which is PSR-3 compatible.', E_USER_DEPRECATED);
trigger_error('The '.__METHOD__.' method of the Monolog Logger was removed. Use the warning() method instead, which is PSR-3 compatible.', E_USER_DEPRECATED);

return parent::addRecord(BaseLogger::WARNING, $message, $context);
}
Expand Down
Expand Up @@ -304,6 +304,8 @@ public function getValuesForChoices(array $models)
*/
public function getIndicesForChoices(array $models)
{
trigger_error('The '.__METHOD__.' method is deprecated since version 2.4 and will be removed in 3.0.', E_USER_DEPRECATED);

if (empty($models)) {
return array();
}
Expand Down Expand Up @@ -350,6 +352,8 @@ public function getIndicesForChoices(array $models)
*/
public function getIndicesForValues(array $values)
{
trigger_error('The '.__METHOD__.' method is deprecated since version 2.4 and will be removed in 3.0.', E_USER_DEPRECATED);

if (empty($values)) {
return array();
}
Expand Down
3 changes: 1 addition & 2 deletions src/Symfony/Bridge/Twig/Node/FormEnctypeNode.php
Expand Up @@ -14,8 +14,7 @@
/**
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @deprecated Deprecated since version 2.3, to be removed in 3.0. Use
* the helper "form_start()" instead.
* @deprecated since version 2.3, to be removed in 3.0. Use the helper "form_start()" instead.
*/
class FormEnctypeNode extends SearchAndRenderBlockNode
{
Expand Down
Expand Up @@ -74,7 +74,7 @@ protected function configure()
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
trigger_error('The router:dump-apache command is deprecated since 2.5 and will be removed in 3.0', E_USER_DEPRECATED);
trigger_error('The router:dump-apache command is deprecated since version 2.5 and will be removed in 3.0', E_USER_DEPRECATED);

$router = $this->getContainer()->get('router');

Expand Down
Expand Up @@ -273,7 +273,7 @@ public function createFormBuilder($data = null, array $options = array())
*/
public function getRequest()
{
trigger_error('The "getRequest" method of the base "Controller" class has been deprecated since Symfony 2.4 and will be removed in 3.0. The only reliable way to get the "Request" object is to inject it in the action method.', E_USER_DEPRECATED);
trigger_error('The '.__METHOD__.' method is deprecated since version 2.4 and will be removed in 3.0. The only reliable way to get the "Request" object is to inject it in the action method.', E_USER_DEPRECATED);

return $this->container->get('request_stack')->getCurrentRequest();
}
Expand Down
Expand Up @@ -116,7 +116,7 @@ private function addCsrfSection(ArrayNodeDefinition $rootNode)
->children()
->scalarNode('field_name')
->defaultValue('_token')
->info('Deprecated since 2.4, to be removed in 3.0. Use form.csrf_protection.field_name instead')
->info('Deprecated since version 2.4, to be removed in 3.0. Use form.csrf_protection.field_name instead')
->end()
->end()
->end()
Expand Down
2 changes: 2 additions & 0 deletions src/Symfony/Bundle/FrameworkBundle/Templating/Debugger.php
Expand Up @@ -11,6 +11,8 @@

namespace Symfony\Bundle\FrameworkBundle\Templating;

trigger_error('The '.__NAMESPACE__.'\Debugger class is deprecated since version 2.4 and will be removed in 3.0. Use the Psr\Log\LoggerInterface interface instead.', E_USER_DEPRECATED);

use Symfony\Component\Templating\DebuggerInterface;
use Psr\Log\LoggerInterface;

Expand Down
Expand Up @@ -42,6 +42,8 @@ public function __construct(ContainerInterface $container)
*/
public function getSecurity()
{
trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0.', E_USER_DEPRECATED);

if ($this->container->has('security.context')) {
return $this->container->get('security.context');
}
Expand Down
Expand Up @@ -30,11 +30,12 @@ class RequestHelper extends Helper
*
* @param Request|RequestStack $requestStack A RequestStack instance or a Request instance
*
* @deprecated since 2.5, passing a Request instance is deprecated and support for it will be removed in 3.0
* @deprecated since version 2.5, passing a Request instance is deprecated and support for it will be removed in 3.0
*/
public function __construct($requestStack)
{
if ($requestStack instanceof Request) {
trigger_error('Since version 2.5, passing a Request instance into the '.__METHOD__.' is deprecated and support for it will be removed in 3.0. Inject a Symfony\Component\HttpFoundation\RequestStack instance instead.', E_USER_DEPRECATED);
$this->request = $requestStack;
} elseif ($requestStack instanceof RequestStack) {
$this->requestStack = $requestStack;
Expand Down
Expand Up @@ -30,11 +30,12 @@ class SessionHelper extends Helper
*
* @param Request|RequestStack $requestStack A RequestStack instance or a Request instance
*
* @deprecated since 2.5, passing a Request instance is deprecated and support for it will be removed in 3.0
* @deprecated since version 2.5, passing a Request instance is deprecated and support for it will be removed in 3.0
*/
public function __construct($requestStack)
{
if ($requestStack instanceof Request) {
trigger_error('Since version 2.5, passing a Request instance into the '.__METHOD__.' is deprecated and support for it will be removed in 3.0. Inject a Symfony\Component\HttpFoundation\RequestStack instance instead.', E_USER_DEPRECATED);
$this->session = $requestStack->getSession();
} elseif ($requestStack instanceof RequestStack) {
$this->requestStack = $requestStack;
Expand Down
Expand Up @@ -61,7 +61,7 @@ private function addFormSection(ArrayNodeDefinition $rootNode)
->end()
->children()
->arrayNode('form')
->info('Deprecated since 2.6, to be removed in 3.0. Use twig.form_themes instead')
->info('Deprecated since version 2.6, to be removed in 3.0. Use twig.form_themes instead')
->addDefaultsIfNotSet()
->fixXmlConfig('resource')
->children()
Expand Down
2 changes: 2 additions & 0 deletions src/Symfony/Bundle/TwigBundle/Extension/ActionsExtension.php
Expand Up @@ -11,6 +11,8 @@

namespace Symfony\Bundle\TwigBundle\Extension;

trigger_error('The '.__NAMESPACE__.'\ActionsExtension class is deprecated since version 2.2 and will be removed in Symfony 3.0.', E_USER_DEPRECATED);

use Symfony\Bundle\TwigBundle\TokenParser\RenderTokenParser;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpKernel\Fragment\FragmentHandler;
Expand Down
Expand Up @@ -9,7 +9,7 @@

<xsd:complexType name="config">
<xsd:sequence>
<!-- @deprecated since 2.6, to be removed in 3.0 -->
<!-- @deprecated since version 2.6, to be removed in 3.0 -->
<xsd:element name="form" type="form" minOccurs="0" maxOccurs="1" />
<xsd:element name="form-theme" type="xsd:string" minOccurs="0" maxOccurs="unbounded" />
<xsd:element name="global" type="global" minOccurs="0" maxOccurs="unbounded" />
Expand Down
Expand Up @@ -57,7 +57,7 @@ public function testLoadFullConfiguration($format)
$resources = $container->getParameter('twig.form.resources');
$this->assertContains('form_div_layout.html.twig', $resources, '->load() includes default template for form resources');
$this->assertContains('MyBundle::form.html.twig', $resources, '->load() merges new templates into form resources');
// @deprecated since 2.6, to be removed in 3.0
// @deprecated since version 2.6, to be removed in 3.0
$this->assertContains('MyBundle::formDeprecated.html.twig', $resources, '->load() merges new templates into form resources');

// Globals
Expand Down
2 changes: 2 additions & 0 deletions src/Symfony/Component/ClassLoader/DebugClassLoader.php
Expand Up @@ -11,6 +11,8 @@

namespace Symfony\Component\ClassLoader;

trigger_error('The '.__NAMESPACE__.'\DebugClassLoader class is deprecated since version 2.4 and will be removed in 3.0. Use the Symfony\Component\Debug\DebugClassLoader class instead.', E_USER_DEPRECATED);

/**
* Autoloader checking if the class is really defined in the file found.
*
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/ClassLoader/UniversalClassLoader.php
Expand Up @@ -11,7 +11,7 @@

namespace Symfony\Component\ClassLoader;

trigger_error('The "Symfony\Component\ClassLoader\UniversalClassLoader" class was deprecated in version 2.7 and will be removed in 3.0. Use "Symfony\Component\ClassLoader\ClassLoader" instead.', E_USER_DEPRECATED);
trigger_error('The '.__NAMESPACE__.'\UniversalClassLoader class is deprecated since version 2.7 and will be removed in 3.0. Use the Symfony\Component\ClassLoader\ClassLoader class instead.', E_USER_DEPRECATED);

/**
* UniversalClassLoader implements a "universal" autoloader for PHP 5.3.
Expand Down
2 changes: 2 additions & 0 deletions src/Symfony/Component/Config/Definition/ReferenceDumper.php
Expand Up @@ -11,6 +11,8 @@

namespace Symfony\Component\Config\Definition;

trigger_error('The '.__NAMESPACE__.'\ReferenceDumper class is deprecated since version 2.4 and will be removed in 3.0. Use the Symfony\Component\Config\Definition\Dumper\YamlReferenceDumper class instead.', E_USER_DEPRECATED);

use Symfony\Component\Config\Definition\Dumper\YamlReferenceDumper;

/**
Expand Down
4 changes: 4 additions & 0 deletions src/Symfony/Component/Console/Application.php
Expand Up @@ -628,6 +628,8 @@ public static function getAbbreviations($names)
*/
public function asText($namespace = null, $raw = false)
{
trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);

$descriptor = new TextDescriptor();
$output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, !$raw);
$descriptor->describe($output, $this, array('namespace' => $namespace, 'raw_output' => true));
Expand All @@ -647,6 +649,8 @@ public function asText($namespace = null, $raw = false)
*/
public function asXml($namespace = null, $asDom = false)
{
trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);

$descriptor = new XmlDescriptor();

if ($asDom) {
Expand Down
4 changes: 4 additions & 0 deletions src/Symfony/Component/Console/Command/Command.php
Expand Up @@ -609,6 +609,8 @@ public function getHelper($name)
*/
public function asText()
{
trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);

$descriptor = new TextDescriptor();
$output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true);
$descriptor->describe($output, $this, array('raw_output' => true));
Expand All @@ -627,6 +629,8 @@ public function asText()
*/
public function asXml($asDom = false)
{
trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);

$descriptor = new XmlDescriptor();

if ($asDom) {
Expand Down
8 changes: 6 additions & 2 deletions src/Symfony/Component/Console/Helper/ProgressBar.php
Expand Up @@ -171,12 +171,14 @@ public function getMaxSteps()
/**
* Gets the progress bar step.
*
* @deprecated since 2.6, to be removed in 3.0. Use {@link getProgress()} instead.
* @deprecated since version 2.6, to be removed in 3.0. Use {@link getProgress()} instead.
*
* @return int The progress bar step
*/
public function getStep()
{
trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the getProgress() method instead.', E_USER_DEPRECATED);

return $this->getProgress();
}

Expand Down Expand Up @@ -358,14 +360,16 @@ public function advance($step = 1)
/**
* Sets the current progress.
*
* @deprecated since 2.6, to be removed in 3.0. Use {@link setProgress()} instead.
* @deprecated since version 2.6, to be removed in 3.0. Use {@link setProgress()} instead.
*
* @param int $step The current progress
*
* @throws \LogicException
*/
public function setCurrent($step)
{
trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the setProgress() method instead.', E_USER_DEPRECATED);

$this->setProgress($step);
}

Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/Console/Helper/ProgressHelper.php
Expand Up @@ -20,7 +20,7 @@
* @author Chris Jones <leeked@gmail.com>
* @author Fabien Potencier <fabien@symfony.com>
*
* @deprecated Deprecated since 2.5, to be removed in 3.0; use ProgressBar instead.
* @deprecated Deprecated since version 2.5, to be removed in 3.0; use ProgressBar instead.
*/
class ProgressHelper extends Helper
{
Expand Down Expand Up @@ -120,7 +120,7 @@ class ProgressHelper extends Helper
public function __construct($triggerDeprecationError = true)
{
if ($triggerDeprecationError) {
trigger_error('"Symfony\Component\Console\Helper\ProgressHelper" is deprecated since version 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\ProgressBar" instead.', E_USER_DEPRECATED);
trigger_error('The '.__CLASS__.' class is deprecated since version 2.5 and will be removed in 3.0. Use the Symfony\Component\Console\Helper\ProgressBar class instead.', E_USER_DEPRECATED);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/Console/Helper/TableHelper.php
Expand Up @@ -20,7 +20,7 @@
* @author Саша Стаменковић <umpirsky@gmail.com>
* @author Fabien Potencier <fabien@symfony.com>
*
* @deprecated Deprecated since 2.5, to be removed in 3.0; use Table instead.
* @deprecated Deprecated since version 2.5, to be removed in 3.0; use Table instead.
*/
class TableHelper extends Helper
{
Expand All @@ -36,7 +36,7 @@ class TableHelper extends Helper
public function __construct($triggerDeprecationError = true)
{
if ($triggerDeprecationError) {
trigger_error('"Symfony\Component\Console\Helper\TableHelper" is deprecated since version 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\Table" instead.', E_USER_DEPRECATED);
trigger_error('The '.__CLASS__.' class is deprecated since version 2.5 and will be removed in 3.0. Use the Symfony\Component\Console\Helper\Table class instead.', E_USER_DEPRECATED);
}

$this->table = new Table(new NullOutput());
Expand Down
4 changes: 4 additions & 0 deletions src/Symfony/Component/Console/Input/InputDefinition.php
Expand Up @@ -421,6 +421,8 @@ public function getSynopsis()
*/
public function asText()
{
trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);

$descriptor = new TextDescriptor();
$output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true);
$descriptor->describe($output, $this, array('raw_output' => true));
Expand All @@ -439,6 +441,8 @@ public function asText()
*/
public function asXml($asDom = false)
{
trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);

$descriptor = new XmlDescriptor();

if ($asDom) {
Expand Down
4 changes: 4 additions & 0 deletions src/Symfony/Component/Console/Input/StringInput.php
Expand Up @@ -39,6 +39,10 @@ class StringInput extends ArgvInput
*/
public function __construct($input, InputDefinition $definition = null)
{
if ($definition) {
trigger_error('The $definition argument of the '.__METHOD__.' method is deprecated and will be removed in 3.0. Set this parameter with the bind() method instead.', E_USER_DEPRECATED);
}

parent::__construct(array(), null);

$this->setTokens($this->tokenize($input));
Expand Down

0 comments on commit 86b9f6b

Please sign in to comment.