Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5beb5f8

Browse files
committed
[Routing] remove deprecations
1 parent b332f9b commit 5beb5f8

17 files changed

+29
-1297
lines changed

src/Symfony/Bundle/FrameworkBundle/CacheWarmer/RouterCacheWarmer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function warmUp($cacheDir)
4949
return;
5050
}
5151

52-
@trigger_error(sprintf('Passing a %s without implementing %s is deprecated since Symfony 4.1.', RouterInterface::class, WarmableInterface::class), \E_USER_DEPRECATED);
52+
throw new \LogicException(sprintf('The router %s cannot be warmed up because it does not implement %s.', \get_class($router), WarmableInterface::class));
5353
}
5454

5555
/**

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
use Symfony\Bridge\Twig\Extension\CsrfExtension;
2222
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
2323
use Symfony\Bundle\FrameworkBundle\Routing\AnnotatedRouteControllerLoader;
24-
use Symfony\Bundle\FrameworkBundle\Routing\RedirectableUrlMatcher;
2524
use Symfony\Bundle\FullStack;
2625
use Symfony\Component\Asset\PackageInterface;
2726
use Symfony\Component\BrowserKit\AbstractBrowser;
@@ -88,12 +87,8 @@
8887
use Symfony\Component\PropertyInfo\PropertyInitializableExtractorInterface;
8988
use Symfony\Component\PropertyInfo\PropertyListExtractorInterface;
9089
use Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface;
91-
use Symfony\Component\Routing\Generator\Dumper\PhpGeneratorDumper;
92-
use Symfony\Component\Routing\Generator\UrlGenerator;
9390
use Symfony\Component\Routing\Loader\AnnotationDirectoryLoader;
9491
use Symfony\Component\Routing\Loader\AnnotationFileLoader;
95-
use Symfony\Component\Routing\Matcher\CompiledUrlMatcher;
96-
use Symfony\Component\Routing\Matcher\Dumper\PhpMatcherDumper;
9792
use Symfony\Component\Security\Core\Security;
9893
use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface;
9994
use Symfony\Component\Serializer\Encoder\DecoderInterface;
@@ -792,19 +787,12 @@ private function registerRouterConfiguration(array $config, ContainerBuilder $co
792787
}
793788

794789
$container->setParameter('router.resource', $config['resource']);
795-
$container->setParameter('router.cache_class_prefix', $container->getParameter('kernel.container_class')); // deprecated
796790
$router = $container->findDefinition('router.default');
797791
$argument = $router->getArgument(2);
798792
$argument['strict_requirements'] = $config['strict_requirements'];
799793
if (isset($config['type'])) {
800794
$argument['resource_type'] = $config['type'];
801795
}
802-
if (!class_exists(CompiledUrlMatcher::class)) {
803-
$argument['matcher_class'] = $argument['matcher_base_class'] = $argument['matcher_base_class'] ?? RedirectableUrlMatcher::class;
804-
$argument['matcher_dumper_class'] = PhpMatcherDumper::class;
805-
$argument['generator_class'] = $argument['generator_base_class'] = $argument['generator_base_class'] ?? UrlGenerator::class;
806-
$argument['generator_dumper_class'] = PhpGeneratorDumper::class;
807-
}
808796
$router->replaceArgument(2, $argument);
809797

810798
$container->setParameter('request_listener.http_port', $config['http_port']);

src/Symfony/Bundle/FrameworkBundle/Routing/RedirectableUrlMatcher.php

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

src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/RouterCacheWarmerTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,15 @@ public function testWarmUpWithWarmebleInterface()
3232
$this->addToAssertionCount(1);
3333
}
3434

35-
/**
36-
* @expectedDeprecation Passing a Symfony\Component\Routing\RouterInterface without implementing Symfony\Component\HttpKernel\CacheWarmer\WarmableInterface is deprecated since Symfony 4.1.
37-
* @group legacy
38-
*/
3935
public function testWarmUpWithoutWarmebleInterface()
4036
{
4137
$containerMock = $this->getMockBuilder(ContainerInterface::class)->setMethods(['get', 'has'])->getMock();
4238

4339
$routerMock = $this->getMockBuilder(testRouterInterfaceWithoutWarmebleInterface::class)->setMethods(['match', 'generate', 'getContext', 'setContext', 'getRouteCollection'])->getMock();
4440
$containerMock->expects($this->any())->method('get')->with('router')->willReturn($routerMock);
4541
$routerCacheWarmer = new RouterCacheWarmer($containerMock);
42+
$this->expectException(\LogicException::class);
43+
$this->expectExceptionMessage('cannot be warmed up because it does not implement Symfony\Component\HttpKernel\CacheWarmer\WarmableInterface');
4644
$routerCacheWarmer->warmUp('/tmp');
4745
}
4846
}

src/Symfony/Bundle/FrameworkBundle/Tests/Routing/RedirectableUrlMatcherTest.php

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

src/Symfony/Component/Routing/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
CHANGELOG
22
=========
33

4+
5.0.0
5+
-----
6+
7+
* removed `PhpGeneratorDumper` and `PhpMatcherDumper`
8+
* removed `generator_base_class`, `generator_cache_class`, `matcher_base_class` and `matcher_cache_class` router options
9+
* `Serializable` implementing methods for `Route` and `CompiledRoute` are final
10+
* removed referencing service route loaders with a single colon
11+
412
4.3.0
513
-----
614

src/Symfony/Component/Routing/CompiledRoute.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,9 @@ public function __serialize(): array
6464
}
6565

6666
/**
67-
* @internal since Symfony 4.3
68-
* @final since Symfony 4.3
67+
* @internal
6968
*/
70-
public function serialize()
69+
final public function serialize()
7170
{
7271
return serialize($this->__serialize());
7372
}
@@ -85,10 +84,9 @@ public function __unserialize(array $data): void
8584
}
8685

8786
/**
88-
* @internal since Symfony 4.3
89-
* @final since Symfony 4.3
87+
* @internal
9088
*/
91-
public function unserialize($serialized)
89+
final public function unserialize($serialized)
9290
{
9391
$this->__unserialize(unserialize($serialized, ['allowed_classes' => false]));
9492
}

src/Symfony/Component/Routing/Generator/Dumper/PhpGeneratorDumper.php

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

src/Symfony/Component/Routing/Loader/ObjectRouteLoader.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,6 @@ public function load($resource, $type = null)
4848
throw new \InvalidArgumentException(sprintf('Invalid resource "%s" passed to the "service" route loader: use the format "service::method" or "service" if your service has an "__invoke" method.', $resource));
4949
}
5050

51-
if (1 === substr_count($resource, ':')) {
52-
$resource = str_replace(':', '::', $resource);
53-
@trigger_error(sprintf('Referencing service route loaders with a single colon is deprecated since Symfony 4.1. Use %s instead.', $resource), E_USER_DEPRECATED);
54-
}
55-
5651
$parts = explode('::', $resource);
5752
$serviceString = $parts[0];
5853
$method = $parts[1] ?? '__invoke';

0 commit comments

Comments
 (0)