8000 [3.0] Various deprecations cleanups by nicolas-grekas · Pull Request #16107 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[3.0] Various deprecations cleanups #16107

New issue 8000

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 6, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,5 @@ public function process(ContainerBuilder $container)
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')));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -116,27 +116,6 @@ public function panelAction(Request $request, $token)
)), 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.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ private function parseDefinition(\DOMElement $service, $file)
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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this be removed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure it's worth the burden for users. What do others think?

}

Expand Down
14 changes: 2 additions & 12 deletions src/Symfony/Component/DomCrawler/Crawler.php
Original file line number Diff line number Diff line change
Expand Up @@ -901,12 +901,7 @@ private function relativize($xpath)
$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);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #16109

}

Expand All @@ -921,12 +916,7 @@ private function relativize($xpath)
$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::'));
Expand Down
10 changes: 0 additions & 10 deletions src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -551,16 +551,6 @@ public function testFilterXPathWithFakeRoot()
$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(&# F438 39;//body');
$this->assertCount(1, $crawler->filterXPath('/_root/body'));
}

public function testFilterXPathWithAncestorAxis()
{
$crawler = $this->createTestCrawler()->filterXPath('//form');
Expand Down
2 changes: 0 additions & 2 deletions src/Symfony/Component/Form/Tests/AbstractFormTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
1 change: 0 additions & 1 deletion src/Symfony/Component/Process/ProcessBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,6 @@ public function getProcess()
$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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,6 @@ public function validateProperty($object, $propertyName, $groups = null)
$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", '.
Expand Down Expand Up @@ -242,8 +240,6 @@ public function validatePropertyValue($objectOrClass, $propertyName, $value, $gr
$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", '.
Expand Down Expand Up @@ -404,7 +400,6 @@ private function validateEachObjectIn($collection, $propertyPath, array $groups,
if (is_array($value)) {
// Arrays are always cascaded, independent of the specified
// traversal strategy
// (BC with Symfony < 2.5)
$this->validateEachObjectIn(
$value,
$propertyPath.'['.$key.']',
Expand All @@ -416,7 +411,6 @@ private function validateEachObjectIn($collection, $propertyPath, array $groups,
}

// Scalar and null values in the collection are ignored
// (BC with Symfony < 2.5)
if (is_object($value)) {
$this->validateObject(
$value,
Expand Down Expand Up @@ -615,8 +609,6 @@ private function validateClassNode($object, $cacheKey, ClassMetadataInterface $m

// 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".',
Expand Down Expand Up @@ -726,7 +718,6 @@ private function validateGenericNode($value, $object, $cacheKey, MetadataInterfa
if (is_array($value)) {
// Arrays are always traversed, independent of the specified
// traversal strategy
// (BC with Symfony < 2.5)
$this->validateEachObjectIn(
$value,
$propertyPath,
Expand All @@ -739,7 +730,6 @@ private function validateGenericNode($value, $object, $cacheKey, MetadataInterfa

// 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,
Expand Down
0