8000 Fixed some deprecations according to @stof feedbacks. · symfony/symfony@2806171 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2806171

Browse files
author
Hugo Hamon
committed
Fixed some deprecations according to @stof feedbacks.
1 parent 1af08c1 commit 2806171

File tree

8 files changed

+12
-22
lines changed

8 files changed

+12
-22
lines changed

src/Symfony/Bridge/Monolog/Logger.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class Logger extends BaseLogger implements LoggerInterface, DebugLoggerInterface
2727
*/
2828
public function emerg($message, array $context = array())
2929
{
30-
trigger_error('The '.__METHOD__.' method of the Monolog Logger was removed. Use the emergency() method instead, which is PSR-3 compatible.', E_USER_DEPRECATED);
30+
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);
3131

3232
return parent::addRecord(BaseLogger::EMERGENCY, $message, $context);
3333
}
@@ -37,7 +37,7 @@ public function emerg($message, array $context = array())
3737
*/
3838
public function crit($message, array $context = array())
3939
{
40-
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);
40+
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);
4141

4242
return parent::addRecord(BaseLogger::CRITICAL, $message, $context);
4343
}
@@ -47,7 +47,7 @@ public function crit($message, array $context = array())
4747
*/
4848
public function err($message, array $context = array())
4949
{
50-
trigger_error('The '.__METHOD__.' method of the Monolog Logger was removed. Use the error() method instead, which is PSR-3 compatible.', E_USER_DEPRECATED);
50+
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);
5151

5252
return parent::addRecord(BaseLogger::ERROR, $message, $context);
5353
}
@@ -57,7 +57,7 @@ public function err($message, array $context = array())
5757
*/
5858
public function warn($message, array $context = array())
5959
{
60-
trigger_error('The '.__METHOD__.' method of the Monolog Logger was removed. Use the warning() method instead, which is PSR-3 compatible.', E_USER_DEPRECATED);
60+
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);
6161

6262
return parent::addRecord(BaseLogger::WARNING, $message, $context);
6363
}

src/Symfony/Bundle/FrameworkBundle/Command/RouterApacheDumperCommand.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ protected function configure()
7474
*/
7575
protected function execute(InputInterface $input, OutputInterface $output)
7676
{
77-
trigger_error('The router:dump-apache command is deprecated since version 2.5 and will be removed in 3.0', E_USER_DEPRECATED);
77+
$formatter = $this->getHelper('formatter');
78+
79+
$output->writeln($formatter->formatSection('warning', 'The router:dump-apache command is deprecated since version 2.5 and will be removed in 3.0', 'comment'));
7880

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

src/Symfony/Bundle/TwigBundle/TwigEngine.php

Lines changed: 4 additions & 0 deletions
Ori 6D40 ginal file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ public function __construct(\Twig_Environment $environment, TemplateNameParserIn
4747
*/
4848
public function setDefaultEscapingStrategy($strategy)
4949
{
50+
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);
51+
5052
$this->environment->getExtension('escaper')->setDefaultStrategy($strategy);
5153
}
5254

@@ -56,6 +58,8 @@ public function setDefaultEscapingStrategy($strategy)
5658
*/
5759
public function guessDefaultEscapingStrategy($filename)
5860
{
61+
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);
62+
5963
return TwigDefaultEscapingStrategy::guess($filename);
6064
}
6165

src/Symfony/Component/Debug/DebugClassLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function __construct($classLoader)
4444
$this->wasFinder = is_object($classLoader) && method_exists($classLoader, 'findFile');
4545

4646
if ($this->wasFinder) {
47-
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);
47+
trigger_error('The '.__METHOD__.' method will no longer support receiving an object into its $classLoader argument in 3.0.', E_USER_DEPRECATED);
4848
$this->classLoader = array($classLoader, 'loadClass');
4949
$this->isFinder = true;
5050
} else {

src/Symfony/Component/Validator/Context/ExecutionContext.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -289,8 +289,6 @@ public function getGroup()
289289
public function getClassName()
290290
{
291291
if ($this->metadata instanceof ClassBasedInterface) {
292-
trigger_error('The Symfony\Component\Validator\ClassBasedInterface interface is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
293-
294292
return $this->metadata->getClassName();
295293
}
296294

@@ -318,8 +316,6 @@ public function getPropertyPath($subPath = '')
318316
*/
319317
public function addViolationAt($subPath, $message, array $parameters = array(), $invalidValue = null, $plural = null, $code = null)
320318
{
321-
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);
322-
323319
throw new BadMethodCallException(
324320
'addViolationAt() is not supported anymore as of Symfony 2.5. '.
325321
'Please use buildViolation() instead or enable the legacy mode.'
@@ -331,8 +327,6 @@ public function addViolationAt($subPath, $message, array $parameters = array(),
331327
*/
332328
public function validate($value, $subPath = '', $groups = null, $traverse = false, $deep = false)
333329
{
334-
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);
335-
336330
throw new BadMethodCallException(
337331
'validate() is not supported anymore as of Symfony 2.5. '.
338332
'Please use getValidator() instead or enable the legacy mode.'
@@ -344,8 +338,6 @@ public function validate($value, $subPath = '', $groups = null, $traverse = fals
344338
*/
345339
public function validateValue($value, $constraints, $subPath = '', $groups = null)
346340
{
347-
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);
348-
349341
throw new BadMethodCallException(
350342
'validateValue() is not supported anymore as of Symfony 2.5. '.
351343
'Please use getValidator() instead or enable the legacy mode.'
@@ -357,8 +349,6 @@ public function validateValue($value, $constraints, $subPath = '', $groups = nul
357349
*/
358350
public function getMetadataFactory()
359351
{
360-
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);
361-
362352
throw new BadMethodCallException(
363353
'getMetadataFactory() is not supported anymore as of Symfony 2.5. '.
364354
'Please use getValidator() in combination with getMetadataFor() '.

src/Symfony/Component/Validator/Context/LegacyExecutionContext.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ class LegacyExecutionContext extends ExecutionContext
4141
*/
4242
public function __construct(ValidatorInterface $validator, $root, MetadataFactoryInterface $metadataFactory, TranslatorInterface $translator, $translationDomain = null)
4343
{
44-
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);
45-
4644
parent::__construct(
4745
$validator,
4846
$root,

src/Symfony/Component/Validator/Context/LegacyExecutionContextFactory.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111

1212
namespace Symfony\Component\Validator\Context;
1313

14-
trigger_error('The '.__NAMESPACE__.'\LegacyExecutionContextFactory is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
15-
1614
use Symfony\Component\Translation\TranslatorInterface;
1715
use Symfony\Component\Validator\MetadataFactoryInterface;
1816
use Symfony\Component\Validator\Validator\ValidatorInterface;

src/Symfony/Component/Validator/Mapping/GenericMetadata.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,6 @@ public function getTraversalStrategy()
239239
*/
240240
public function accept(ValidationVisitorInterface $visitor, $value, $group, $propertyPath)
241241
{
242-
trigger_error('The '.__METHOD__.' is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
243-
244242
throw new BadMethodCallException('Not supported.');
245243
}
246244
}

0 commit comments

Comments
 (0)
0