8000 [3.0] Various deprecations cleanups · symfony/symfony@ceb62ad · GitHub
[go: up one dir, main page]

Skip to content

Commit ceb62ad

Browse files
[3.0] Various deprecations cleanups
1 parent 2b29602 commit ceb62ad

File tree

10 files changed

+3
-87
lines changed

10 files changed

+3
-87
lines changed

src/Symfony/Bundle/FrameworkBundle/DataCollector/AjaxDataCollector.php

Lines changed: 0 additions & 27 deletions
This file was deleted.

src/Symfony/Bundle/FrameworkBundle/Resources/config/collectors.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@
1515
<tag name="data_collector" template="@WebProfiler/Collector/request.html.twig" id="request" priority="335" />
1616
</service>
1717

18-
<service id="data_collector.ajax" class="Symfony\Component\HttpKernel\DataCollector\AjaxDataCollector" public="false">
19-
<tag name="data_collector" template="@WebProfiler/Collector/ajax.html.twig" id="ajax" priority="315" />
20-
</service>
21-
2218
<service id="data_collector.exception" class="Symfony\Component\HttpKernel\DataCollector\ExceptionDataCollector" public="false">
2319
<tag name="data_collector" template="@WebProfiler/Collector/exception.html.twig" id="exception" priority="305" />
2420
</service>

src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/ExtensionPass.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,5 @@ public function process(ContainerBuilder $container)
7777
if ($container->has('assets.packages')) {
7878
$container->getDefinition('twig.extension.assets')->addTag('twig.extension');
7979
}
80-
81-
if (method_exists('Symfony\Bridge\Twig\AppVariable', 'setContainer')) {
82-
// we are on Symfony <3.0, where the setContainer method exists
83-
$container->getDefinition('twig.app_variable')->addMethodCall('setContainer', array(new Reference('service_container')));
84-
}
8580
}
8681
}

src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -116,27 +116,6 @@ public function panelAction(Request $request, $token)
116116
)), 200, array('Content-Type' => 'text/html'));
117117
}
118118

119-
/**
120-
* Purges all tokens.
121-
*
122-
* @return Response A Response instance
123-
*
124-
* @throws NotFoundHttpException
125-
*/
126-
public function purgeAction()
127-
{
128-
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
129-
130-
if (null === $this->profiler) {
131-
throw new NotFoundHttpException('The profiler must be enabled.');
132-
}
133-
134-
$this->profiler->disable();
135-
$this->profiler->purge();
136-
137< 1E0A /code>-
return new RedirectResponse($this->generator->generate('_profiler_info', array('about' => 'purge')), 302, array('Content-Type' => 'text/html'));
138-
}
139-
140119
/**
141120
* Displays information page.
142121
*

src/Symfony/Bundle/WebProfilerBundle/Resources/config/routing/profiler.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@
1616
<default key="_controller">web_profiler.controller.profiler:searchBarAction</default>
1717
</route>
1818

19-
<route id="_profiler_purge" path="/purge">
20-
<default key="_controller">web_profiler.controller.profiler:purgeAction</default>
21-
</route>
22-
2319
<route id="_profiler_info" path="/info/{about}">
2420
<default key="_controller">web_profiler.controller.profiler:infoAction</default>
2521
</route>

src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ private function parseDefinition(\DOMElement $service, $file)
221221
if (false !== strpos($name, '-') && false === strpos($name, '_') && !array_key_exists($normalizedName = str_replace('-', '_', $name), $parameters)) {
222222
$parameters[$normalizedName] = XmlUtils::phpize($node->nodeValue);
223223
}
224-
// keep not normalized key for BC too
224+
// keep not normalized key
225225
$parameters[$name] = XmlUtils::phpize($node->nodeValue);
226226
}
227227

src/Symfony/Component/DomCrawler/Crawler.php

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -901,12 +901,7 @@ private function relativize($xpath)
901901
$expression = substr($expression, strlen($parenthesis));
902902
}
903903

904-
// BC for Symfony 2.4 and lower were elements were adding in a fake _root parent
905-
if (0 === strpos($expression, '/_root/')) {
906-
@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);
907-
908-
$expression = './'.substr($expression, 7);
909-
} elseif (0 === strpos($expression, 'self::*/')) {
904+
if (0 === strpos($expression, 'self::*/')) {
910905
$expression = './'.substr($expression, 8);
911906
}
912907

@@ -921,12 +916,7 @@ private function relativize($xpath)
921916
$expression = 'self::'.substr($expression, 2);
922917
} elseif (0 === strpos($expression, 'child::')) {
923918
$expression = 'self::'.substr($expression, 7);
924-
} elseif ('/' === $expression[0] || 0 === strpos($expression, 'self::')) {
925-
// the only direct child in Symfony 2.4 and lower is _root, which is already handled previously
926-
// so let's drop the expression entirely
927-
$expression = $nonMatchingExpression;
928-
} elseif ('.' === $expression[0]) {
929-
// '.' is the fake root element in Symfony 2.4 and lower, which is excluded from results
919+
} elseif ('/' === $expression[0] || '.' === $expression[0] || 0 === strpos($expression, 'self::')) {
930920
$expression = $nonMatchingExpression;
931921
} elseif (0 === strpos($expression, 'descendant::')) {
932922
$expression = 'descendant-or-self::'.substr($expression, strlen('descendant::'));

src/Symfony/Component/Form/Tests/AbstractFormTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ abstract class AbstractFormTest extends \PHPUnit_Framework_TestCase
3434

3535
protected function setUp()
3636
{
37-
// We need an actual dispatcher to use the deprecated
38-
// bindRequest() method
3937
$this->dispatcher = new EventDispatcher();
4038
$this->factory = $this->getMock('Symfony\Component\Form\FormFactoryInterface');
4139
$this->form = $this->createForm();

src/Symfony/Component/Process/ProcessBuilder.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,6 @@ public function getProcess()
268268
$script = implode(' ', array_map(array(__NAMESPACE__.'\\ProcessUtils', 'escapeArgument'), $arguments));
269269

270270
if ($this->inheritEnv) {
271-
// include $_ENV for BC purposes
272271
$env = array_replace($_ENV, $_SERVER, $this->env);
273272
} else {
274273
$env = $this->env;

src/Symfony/Component/Validator/Validator/RecursiveContextualValidator.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,6 @@ public function validateProperty($object, $propertyName, $groups = null)
191191
$classMetadata = $this->metadataFactory->getMetadataFor($object);
192192

193193
if (!$classMetadata instanceof ClassMetadataInterface) {
194-
// Cannot be UnsupportedMetadataException because of BC with
195-
// Symfony < 2.5
196194
throw new ValidatorException(sprintf(
197195
'The metadata factory should return instances of '.
198196
'"\Symfony\Component\Validator\Mapping\ClassMetadataInterface", '.
@@ -242,8 +240,6 @@ public function validatePropertyValue($objectOrClass, $propertyName, $value, $gr
242240
$classMetadata = $this->metadataFactory->getMetadataFor($objectOrClass);
243241

244242
if (!$classMetadata instanceof ClassMetadataInterface) {
245-
// Cannot be UnsupportedMetadataException because of BC with
246-
// Symfony < 2.5
247243
throw new ValidatorException(sprintf(
248244
'The metadata factory should return instances of '.
249245
'"\Symfony\Component\Validator\Mapping\ClassMetadataInterface", '.
@@ -404,7 +400,6 @@ private function validateEachObjectIn($collection, $propertyPath, array $groups,
404400
if (is_array($value)) {
405401
// Arrays are always cascaded, independent of the specified
406402
// traversal strategy
407-
// (BC with Symfony < 2.5)
408403
$this->validateEachObjectIn(
409404
$value,
410405
$propertyPath.'['.$key.']',
@@ -416,7 +411,6 @@ private function validateEachObjectIn($collection, $propertyPath, array $groups,
416411
}
417412

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

616610
// If TRAVERSE, fail if we have no Traversable
617611
if (!$object instanceof \Traversable) {
618-
// Must throw a ConstraintDefinitionException for backwards
619-
// compatibility reasons with Symfony < 2.5
620612
throw new ConstraintDefinitionException(sprintf(
621613
'Traversal was enabled for "%s", but this class '.
622614
'does not implement "\Traversable".',
@@ -726,7 +718,6 @@ private function validateGenericNode($value, $object, $cacheKey, MetadataInterfa
726718
if (is_array($value)) {
727719
// Arrays are always traversed, independent of the specified
728720
// traversal strategy
729-
// (BC with Symfony < 2.5)
730721
$this->validateEachObjectIn(
731722
$value,
732723
$propertyPath,
@@ -739,7 +730,6 @@ private function validateGenericNode($value, $object, $cacheKey, MetadataInterfa
739730

740731
// If the value is a scalar, pass it anyway, because we want
741732
// a NoSuchMetadataException to be thrown in that case
742-
// (BC with Symfony < 2.5)
743733
$this->validateObject(
744734
$value,
745735
$propertyPath,

0 commit comments

Comments
 (0)
0