[3.0] Various deprecations cleanups

This commit is contained in:
Nicolas Grekas 2015-10-04 15:03:24 +02:00
parent 8b15af9864
commit 534a91cf54
11 changed files with 3 additions and 97 deletions

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bundle\FrameworkBundle\DataCollector;
use Symfony\Component\HttpKernel\DataCollector\AjaxDataCollector as BaseAjaxDataCollector;
@trigger_error('The '.__NAMESPACE__.'\AjaxDataCollector class is deprecated since version 2.8 and will be removed in 3.0. Use Symfony\Component\HttpKernel\DataCollector\AjaxDataCollector instead.', E_USER_DEPRECATED);
/**
* AjaxDataCollector.
*
* @author Bart van den Burg <bart@burgov.nl>
*
* @deprecated since version 2.8, to be removed in 3.0.
*/
class AjaxDataCollector extends BaseAjaxDataCollector
{
}

View File

@ -15,10 +15,6 @@
<tag name="data_collector" template="@WebProfiler/Collector/request.html.twig" id="request" priority="335" />
</service>
<service id="data_collector.ajax" class="Symfony\Component\HttpKernel\DataCollector\AjaxDataCollector" public="false">
<tag name="data_collector" template="@WebProfiler/Collector/ajax.html.twig" id="ajax" priority="315" />
</service>
<service id="data_collector.exception" class="Symfony\Component\HttpKernel\DataCollector\ExceptionDataCollector" public="false">
<tag name="data_collector" template="@WebProfiler/Collector/exception.html.twig" id="exception" priority="305" />
</service>

View File

@ -77,10 +77,5 @@ class ExtensionPass implements CompilerPassInterface
if ($container->has('assets.packages')) {
$container->getDefinition('twig.extension.assets')->addTag('twig.extension');
}
if (method_exists('Symfony\Bridge\Twig\AppVariable', 'setContainer')) {
// we are on Symfony <3.0, where the setContainer method exists
$container->getDefinition('twig.app_variable')->addMethodCall('setContainer', array(new Reference('service_container')));
}
}
}

View File

@ -116,27 +116,6 @@ class ProfilerController
)), 200, array('Content-Type' => 'text/html'));
}
/**
* Purges all tokens.
*
* @return Response A Response instance
*
* @throws NotFoundHttpException
*/
public function purgeAction()
{
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
if (null === $this->profiler) {
throw new NotFoundHttpException('The profiler must be enabled.');
}
$this->profiler->disable();
$this->profiler->purge();
return new RedirectResponse($this->generator->generate('_profiler_info', array('about' => 'purge')), 302, array('Content-Type' => 'text/html'));
}
/**
* Displays information page.
*

View File

@ -16,10 +16,6 @@
<default key="_controller">web_profiler.controller.profiler:searchBarAction</default>
</route>
<route id="_profiler_purge" path="/purge">
<default key="_controller">web_profiler.controller.profiler:purgeAction</default>
</route>
<route id="_profiler_info" path="/info/{about}">
<default key="_controller">web_profiler.controller.profiler:infoAction</default>
</route>

View File

@ -221,7 +221,7 @@ class XmlFileLoader extends FileLoader
if (false !== strpos($name, '-') && false === strpos($name, '_') && !array_key_exists($normalizedName = str_replace('-', '_', $name), $parameters)) {
$parameters[$normalizedName] = XmlUtils::phpize($node->nodeValue);
}
// keep not normalized key for BC too
// keep not normalized key
$parameters[$name] = XmlUtils::phpize($node->nodeValue);
}

View File

@ -901,12 +901,7 @@ class Crawler implements \Countable, \IteratorAggregate
$expression = substr($expression, strlen($parenthesis));
}
// BC for Symfony 2.4 and lower were elements were adding in a fake _root parent
if (0 === strpos($expression, '/_root/')) {
@trigger_error('XPath expressions referencing the fake root node are deprecated since version 2.8 and will be unsupported in 3.0. Please use "./" instead of "/_root/".', E_USER_DEPRECATED);
$expression = './'.substr($expression, 7);
} elseif (0 === strpos($expression, 'self::*/')) {
if (0 === strpos($expression, 'self::*/')) {
$expression = './'.substr($expression, 8);
}
@ -921,12 +916,7 @@ class Crawler implements \Countable, \IteratorAggregate
$expression = 'self::'.substr($expression, 2);
} elseif (0 === strpos($expression, 'child::')) {
$expression = 'self::'.substr($expression, 7);
} elseif ('/' === $expression[0] || 0 === strpos($expression, 'self::')) {
// the only direct child in Symfony 2.4 and lower is _root, which is already handled previously
// so let's drop the expression entirely
$expression = $nonMatchingExpression;
} elseif ('.' === $expression[0]) {
// '.' is the fake root element in Symfony 2.4 and lower, which is excluded from results
} elseif ('/' === $expression[0] || '.' === $expression[0] || 0 === strpos($expression, 'self::')) {
$expression = $nonMatchingExpression;
} elseif (0 === strpos($expression, 'descendant::')) {
$expression = 'descendant-or-self::'.substr($expression, strlen('descendant::'));

View File

@ -551,16 +551,6 @@ EOF
$this->assertCount(0, $crawler->filterXPath('self::_root'), '->filterXPath() returns an empty result if the XPath references the fake root node');
}
/** @group legacy */
public function testLegacyFilterXPathWithFakeRoot()
{
$crawler = $this->createTestCrawler();
$this->assertCount(0, $crawler->filterXPath('/_root'), '->filterXPath() returns an empty result if the XPath references the fake root node');
$crawler = $this->createTestCrawler()->filterXPath('//body');
$this->assertCount(1, $crawler->filterXPath('/_root/body'));
}
public function testFilterXPathWithAncestorAxis()
{
$crawler = $this->createTestCrawler()->filterXPath('//form');

View File

@ -34,8 +34,6 @@ abstract class AbstractFormTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
// We need an actual dispatcher to use the deprecated
// bindRequest() method
$this->dispatcher = new EventDispatcher();
$this->factory = $this->getMock('Symfony\Component\Form\FormFactoryInterface');
$this->form = $this->createForm();

View File

@ -268,7 +268,6 @@ class ProcessBuilder
$script = implode(' ', array_map(array(__NAMESPACE__.'\\ProcessUtils', 'escapeArgument'), $arguments));
if ($this->inheritEnv) {
// include $_ENV for BC purposes
$env = array_replace($_ENV, $_SERVER, $this->env);
} else {
$env = $this->env;

View File

@ -191,8 +191,6 @@ class RecursiveContextualValidator implements ContextualValidatorInterface
$classMetadata = $this->metadataFactory->getMetadataFor($object);
if (!$classMetadata instanceof ClassMetadataInterface) {
// Cannot be UnsupportedMetadataException because of BC with
// Symfony < 2.5
throw new ValidatorException(sprintf(
'The metadata factory should return instances of '.
'"\Symfony\Component\Validator\Mapping\ClassMetadataInterface", '.
@ -242,8 +240,6 @@ class RecursiveContextualValidator implements ContextualValidatorInterface
$classMetadata = $this->metadataFactory->getMetadataFor($objectOrClass);
if (!$classMetadata instanceof ClassMetadataInterface) {
// Cannot be UnsupportedMetadataException because of BC with
// Symfony < 2.5
throw new ValidatorException(sprintf(
'The metadata factory should return instances of '.
'"\Symfony\Component\Validator\Mapping\ClassMetadataInterface", '.
@ -404,7 +400,6 @@ class RecursiveContextualValidator implements ContextualValidatorInterface
if (is_array($value)) {
// Arrays are always cascaded, independent of the specified
// traversal strategy
// (BC with Symfony < 2.5)
$this->validateEachObjectIn(
$value,
$propertyPath.'['.$key.']',
@ -416,7 +411,6 @@ class RecursiveContextualValidator implements ContextualValidatorInterface
}
// Scalar and null values in the collection are ignored
// (BC with Symfony < 2.5)
if (is_object($value)) {
$this->validateObject(
$value,
@ -615,8 +609,6 @@ class RecursiveContextualValidator implements ContextualValidatorInterface
// If TRAVERSE, fail if we have no Traversable
if (!$object instanceof \Traversable) {
// Must throw a ConstraintDefinitionException for backwards
// compatibility reasons with Symfony < 2.5
throw new ConstraintDefinitionException(sprintf(
'Traversal was enabled for "%s", but this class '.
'does not implement "\Traversable".',
@ -726,7 +718,6 @@ class RecursiveContextualValidator implements ContextualValidatorInterface
if (is_array($value)) {
// Arrays are always traversed, independent of the specified
// traversal strategy
// (BC with Symfony < 2.5)
$this->validateEachObjectIn(
$value,
$propertyPath,
@ -739,7 +730,6 @@ class RecursiveContextualValidator implements ContextualValidatorInterface
// If the value is a scalar, pass it anyway, because we want
// a NoSuchMetadataException to be thrown in that case
// (BC with Symfony < 2.5)
$this->validateObject(
$value,
$propertyPath,