Fixed some deprecations according to @stof feedbacks.

This commit is contained in:
Hugo Hamon 2015-01-04 01:21:40 +01:00
parent 2a3e7d2cc9
commit fd47c07253
8 changed files with 12 additions and 22 deletions

View File

@ -27,7 +27,7 @@ class Logger extends BaseLogger implements LoggerInterface, DebugLoggerInterface
*/
public function emerg($message, array $context = array())
{
trigger_error('The '.__METHOD__.' method of the Monolog Logger was removed. Use the emergency() method instead, which is PSR-3 compatible.', E_USER_DEPRECATED);
trigger_error('The '.__METHOD__.' method inherited from the Symfony\Component\HttpKernel\Log\LoggerInterface interface is deprecated since version 2.2 and will be removed in 3.0. Use the emergency() method instead, which is PSR-3 compatible.', E_USER_DEPRECATED);
return parent::addRecord(BaseLogger::EMERGENCY, $message, $context);
}
@ -37,7 +37,7 @@ class Logger extends BaseLogger implements LoggerInterface, DebugLoggerInterface
*/
public function crit($message, array $context = array())
{
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);
trigger_error('The '.__METHOD__.' method inherited from the Symfony\Component\HttpKernel\Log\LoggerInterface interface is deprecated since version 2.2 and will be removed in 3.0. Use the method critical() method instead, which is PSR-3 compatible.', E_USER_DEPRECATED);
return parent::addRecord(BaseLogger::CRITICAL, $message, $context);
}
@ -47,7 +47,7 @@ class Logger extends BaseLogger implements LoggerInterface, DebugLoggerInterface
*/
public function err($message, array $context = array())
{
trigger_error('The '.__METHOD__.' method of the Monolog Logger was removed. Use the error() method instead, which is PSR-3 compatible.', E_USER_DEPRECATED);
trigger_error('The '.__METHOD__.' method inherited from the Symfony\Component\HttpKernel\Log\LoggerInterface interface is deprecated since version 2.2 and will be removed in 3.0. Use the error() method instead, which is PSR-3 compatible.', E_USER_DEPRECATED);
return parent::addRecord(BaseLogger::ERROR, $message, $context);
}
@ -57,7 +57,7 @@ class Logger extends BaseLogger implements LoggerInterface, DebugLoggerInterface
*/
public function warn($message, array $context = array())
{
trigger_error('The '.__METHOD__.' method of the Monolog Logger was removed. Use the warning() method instead, which is PSR-3 compatible.', E_USER_DEPRECATED);
trigger_error('The '.__METHOD__.' method inherited from the Symfony\Component\HttpKernel\Log\LoggerInterface interface is deprecated since version 2.2 and will be removed in 3.0. Use the warning() method instead, which is PSR-3 compatible.', E_USER_DEPRECATED);
return parent::addRecord(BaseLogger::WARNING, $message, $context);
}

View File

@ -74,7 +74,9 @@ EOF
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
trigger_error('The router:dump-apache command is deprecated since version 2.5 and will be removed in 3.0', E_USER_DEPRECATED);
$formatter = $this->getHelper('formatter');
$output->writeln($formatter->formatSection('warning', 'The router:dump-apache command is deprecated since version 2.5 and will be removed in 3.0', 'comment'));
$router = $this->getContainer()->get('router');

View File

@ -47,6 +47,8 @@ class TwigEngine extends BaseEngine implements EngineInterface
*/
public function setDefaultEscapingStrategy($strategy)
{
trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0. Inject the escaping strategy in the Twig_Environment object instead.', E_USER_DEPRECATED);
$this->environment->getExtension('escaper')->setDefaultStrategy($strategy);
}
@ -56,6 +58,8 @@ class TwigEngine extends BaseEngine implements EngineInterface
*/
public function guessDefaultEscapingStrategy($filename)
{
trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0. Use the Symfony\Bundle\TwigBundle\TwigDefaultEscapingStrategy::guess method instead.', E_USER_DEPRECATED);
return TwigDefaultEscapingStrategy::guess($filename);
}

View File

@ -44,7 +44,7 @@ class DebugClassLoader
$this->wasFinder = is_object($classLoader) && method_exists($classLoader, 'findFile');
if ($this->wasFinder) {
trigger_error('Since version 2.5, passing an object in the $classLoader argument of the '.__METHOD__.' is deprecated and support for it will be removed in 3.0.', E_USER_DEPRECATED);
trigger_error('The '.__METHOD__.' method will no longer support receiving an object into its $classLoader argument in 3.0.', E_USER_DEPRECATED);
$this->classLoader = array($classLoader, 'loadClass');
$this->isFinder = true;
} else {

View File

@ -289,8 +289,6 @@ class ExecutionContext implements ExecutionContextInterface
public function getClassName()
{
if ($this->metadata instanceof ClassBasedInterface) {
trigger_error('The Symfony\Component\Validator\ClassBasedInterface interface is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
return $this->metadata->getClassName();
}
@ -318,8 +316,6 @@ class ExecutionContext implements ExecutionContextInterface
*/
public function addViolationAt($subPath, $message, array $parameters = array(), $invalidValue = null, $plural = null, $code = null)
{
trigger_error('The '.__METHOD__.' is deprecated since version 2.5 and will be removed in 3.0. Use the '.__CLASS__.'::buildViolation method instead.', E_USER_DEPRECATED);
throw new BadMethodCallException(
'addViolationAt() is not supported anymore as of Symfony 2.5. '.
'Please use buildViolation() instead or enable the legacy mode.'
@ -331,8 +327,6 @@ class ExecutionContext implements ExecutionContextInterface
*/
public function validate($value, $subPath = '', $groups = null, $traverse = false, $deep = false)
{
trigger_error('The '.__METHOD__.' is deprecated since version 2.5 and will be removed in 3.0. Use the '.__CLASS__.'::getValidator method together with Symfony\Component\Validator\Validator\ValidatorInterface::inContext method instead.', E_USER_DEPRECATED);
throw new BadMethodCallException(
'validate() is not supported anymore as of Symfony 2.5. '.
'Please use getValidator() instead or enable the legacy mode.'
@ -344,8 +338,6 @@ class ExecutionContext implements ExecutionContextInterface
*/
public function validateValue($value, $constraints, $subPath = '', $groups = null)
{
trigger_error('The '.__METHOD__.' is deprecated since version 2.5 and will be removed in 3.0. Use the '.__CLASS__.'::getValidator method together with Symfony\Component\Validator\Validator\ValidatorInterface::inContext method instead.', E_USER_DEPRECATED);
throw new BadMethodCallException(
'validateValue() is not supported anymore as of Symfony 2.5. '.
'Please use getValidator() instead or enable the legacy mode.'
@ -357,8 +349,6 @@ class ExecutionContext implements ExecutionContextInterface
*/
public function getMetadataFactory()
{
trigger_error('The '.__METHOD__.' is deprecated since version 2.5 and will be removed in 3.0. Use the '.__CLASS__.'::getValidator method together with Symfony\Component\Validator\Validator\ValidatorInterface::getMetadataFor or Symfony\Component\Validator\Validator\ValidatorInterface::hasMetadataFor method instead.', E_USER_DEPRECATED);
throw new BadMethodCallException(
'getMetadataFactory() is not supported anymore as of Symfony 2.5. '.
'Please use getValidator() in combination with getMetadataFor() '.

View File

@ -41,8 +41,6 @@ class LegacyExecutionContext extends ExecutionContext
*/
public function __construct(ValidatorInterface $validator, $root, MetadataFactoryInterface $metadataFactory, TranslatorInterface $translator, $translationDomain = null)
{
trigger_error('The '.__CLASS__.' class is deprecated since version 2.5 and will be removed in 3.0. Use the new Symfony\Component\Validator\Context\ExecutionContext class instead.', E_USER_DEPRECATED);
parent::__construct(
$validator,
$root,

View File

@ -11,8 +11,6 @@
namespace Symfony\Component\Validator\Context;
trigger_error('The '.__NAMESPACE__.'\LegacyExecutionContextFactory is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
use Symfony\Component\Translation\TranslatorInterface;
use Symfony\Component\Validator\MetadataFactoryInterface;
use Symfony\Component\Validator\Validator\ValidatorInterface;

View File

@ -239,8 +239,6 @@ class GenericMetadata implements MetadataInterface
*/
public function accept(ValidationVisitorInterface $visitor, $value, $group, $propertyPath)
{
trigger_error('The '.__METHOD__.' is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
throw new BadMethodCallException('Not supported.');
}
}