8000 Fixes more deprecation notices as per @stof review. · symfony/symfony@f9fbb4f · GitHub
[go: up one dir, main page]

Skip to content

Commit f9fbb4f

Browse files
author
Hugo Hamon
committed
Fixes more deprecation notices as per @stof review.
1 parent fd47c07 commit f9fbb4f

File tree

7 files changed

+12
-30
lines changed

7 files changed

+12
-30
lines changed

src/Symfony/Bundle/TwigBundle/Extension/ActionsExtension.php

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

1212
namespace Symfony\Bundle\TwigBundle\Extension;
1313

14-
trigger_error('The '.__NAMESPACE__.'\ActionsExtension class is deprecated since version 2.2 and will be removed in Symfony 3.0.', E_USER_DEPRECATED);
15-
1614
use Symfony\Bundle\TwigBundle\TokenParser\RenderTokenParser;
1715
use Symfony\Component\DependencyInjection\ContainerInterface;
1816
use Symfony\Component\HttpKernel\Fragment\FragmentHandler;
@@ -31,14 +29,14 @@ class ActionsExtension extends \Twig_Extension
3129
/**
3230
* @param FragmentHandler|ContainerInterface $handler
3331
*
34-
* @deprecated Passing a ContainerInterface as a first argument is deprecated as of 2.7 and will be removed in 3.0.
32+
* @deprecated Passing a ContainerInterface as a first argument is deprecated since 2.7 and will be removed in 3.0.
3533
*/
3634
public function __construct($handler)
3735
{
3836
if ($handler instanceof FragmentHandler) {
3937
$this->handler = $handler;
4038
} elseif ($handler instanceof ContainerInterface) {
41-
trigger_error(sprintf('The ability to pass a ContainerInterface instance as a first argument to %s was deprecated in 2.7 and will be removed in 3.0. Please, pass a FragmentHandler instance instead.', __METHOD__), E_USER_DEPRECATED);
39+
trigger_error('The ability to pass a ContainerInterface instance as a first argument to '.__METHOD__.' method is deprecated since version 2.7 and will be removed in 3.0. Pass a FragmentHandler instance instead.', E_USER_DEPRECATED);
4240

4341
$this->handler = $handler->get('fragment.handler');
4442
} else {

src/Symfony/Bundle/TwigBundle/TwigEngine.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,23 +42,23 @@ public function __construct(\Twig_Environment $environment, TemplateNameParserIn
4242
}
4343

4444
/**
45-
* @deprecated since version 2.3, to be removed in 3.0.
45+
* @deprecated since version 2.7, to be removed in 3.0.
4646
* Inject the escaping strategy on \Twig_Environment instead.
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);
50+
trigger_error('The '.__METHOD__.' method is deprecated since version 2.7 and will be removed in 3.0. Inject the escaping strategy in the Twig_Environment object instead.', E_USER_DEPRECATED);
5151

5252
$this->environment->getExtension('escaper')->setDefaultStrategy($strategy);
5353
}
5454

5555
/**
56-
* @deprecated since version 2.3, to be removed in 3.0.
56+
* @deprecated since version 2.7, to be removed in 3.0.
5757
* Use TwigDefaultEscapingStrategy instead.
5858
*/
5959
public function guessDefaultEscapingStrategy($filename)
6060
{
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);
61+
trigger_error('The '.__METHOD__.' method is deprecated since version 2.7 and will be removed in 3.0. Use the Symfony\Bundle\TwigBundle\TwigDefaultEscapingStrategy::guess method instead.', E_USER_DEPRECATED);
6262

6363
return TwigDefaultEscapingStrategy::guess($filename);
6464
}

src/Symfony/Component/Form/Util/InheritDataAwareIterator.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,4 @@
2525
*/
2626
class InheritDataAwareIterator extends VirtualFormAwareIterator
2727
{
28-
public function __construct(\Traversable $iterator)
29-
{
30-
// Do not trigger deprecation notice in parent construct method
31-
// when using this class instead of the deprecated parent one.
32-
parent::__construct($iterator, false);
33-
}
3428
}

src/Symfony/Component/Form/Util/VirtualFormAwareIterator.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@
2525
*/
2626
class VirtualFormAwareIterator extends \IteratorIterator implements \RecursiveIterator
2727
{
28-
public function __construct(\Traversable $iterator, $triggerDeprecationNotice = true)
28+
public function __construct(\Traversable $iterator)
2929
{
30-
/**
30+
/*
3131
* Prevent to trigger deprecation notice when already using the
3232
* InheritDataAwareIterator class that extends this deprecated one.
3333
* The {@link Symfony\Component\Form\Util\InheritDataAwareIterator::__construct} method
3434
* forces this argument to false.
3535
*/
36-
if ($triggerDeprecationNotice) {
36+
if (__CLASS__ === get_class($this)) {
3737
trigger_error('The '.__CLASS__.' class is deprecated since version 2.3 and will be removed in 3.0. Use the Symfony\Component\Form\Util\InheritDataAwareIterator class instead.', E_USER_DEPRECATED);
3838
}
3939

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

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,6 @@ public function addViolation($message, array $parameters = array(), $invalidValu
187187
// API, as they are not present in the new interface anymore.
188188
// You should use buildViolation() instead.
189189
if (func_num_args() > 2) {
190-
trigger_error('The parameters $invalidValue, $plural and $code in method '.__METHOD__.' are deprecated since version 2.5 and will be removed in 3.0. Use the '.__CLASS__.'::buildViolation method instead.', E_USER_DEPRECATED);
191-
192190
throw new BadMethodCallException(
193191
'The parameters $invalidValue, $plural and $code are '.
194192
'not supported anymore as of Symfony 2.5. Please use '.
@@ -288,11 +286,7 @@ public function getGroup()
288286
*/
289287
public function getClassName()
290288
{
291-
if ($this->metadata instanceof ClassBasedInterface) {
292-
return $this->metadata->getClassName();
293-
}
294-
295-
return null;
289+
return $this->metadata instanceof ClassBasedInterface ? $this->metadata->getClassName() : null;
296290
}
297291

298292
/**

src/Symfony/Component/Validator/ExecutionContextInterface.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,7 @@ interface ExecutionContextInterface
9999
*
100100
* @api
101101
*
102-
* @deprecated since version 2.5.
103-
* The parameters $invalidValue, $plural and $code will be removed
104-
* in 3.0.
102+
* @deprecated the parameters $invalidValue, $plural and $code are deprecated since version 2.5 and will be removed in 3.0.
105103
*/
106104
public function addViolation($message, array $params = array(), $invalidValue = null, $plural = null, $code = null);
107105

src/Symfony/Component/Yaml/Yaml.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,7 @@ class Yaml
4646
*
4747
* @throws ParseException If the YAML is not valid
4848
*
49-
* @deprecated since version 2.2, to be removed in 3.0.
50-
* The ability to pass file names to the parse() method is
51-
* deprecated. Pass the YAML contents of the file instead.
49+
* @deprecated The ability to pass file names to the Yaml::parse method is deprecated since version 2.2 and will be removed in 3.0. Pass the YAML contents of the file instead.
5250
*
5351
* @api
5452
*/

0 commit comments

Comments
 (0)
0