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

Skip to content

Commit c1a8344

Browse files
committed
[Routing] remove deprecations
1 parent 090cf32 commit c1a8344

18 files changed

+23
-1332
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 & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -824,19 +824,12 @@ private function registerRouterConfiguration(array $config, ContainerBuilder $co
824824
}
825825

826826
$container->setParameter('router.resource', $config['resource']);
827-
$container->setParameter('router.cache_class_prefix', $container->getParameter('kernel.container_class')); // deprecated
828827
$router = $container->findDefinition('router.default');
829828
$argument = $router->getArgument(2);
830829
$argument['strict_requirements'] = $config['strict_requirements'];
831830
if (isset($config['type'])) {
832831
$argument['resource_type'] = $config['type'];
833832
}
834-
if (!class_exists(CompiledUrlMatcher::class)) {
835-
$argument['matcher_class'] = $argument['matcher_base_class'] = $argument['matcher_base_class'] ?? RedirectableUrlMatcher::class;
836-
$argument['matcher_dumper_class'] = PhpMatcherDumper::class;
837-
$argument['generator_class'] = $argument['generator_base_class'] = $argument['generator_base_class'] ?? UrlGenerator::class;
838-
$argument['generator_dumper_class'] = PhpGeneratorDumper::class;
839-
}
840833
$router->replaceArgument(2, $argument);
841834

842835
$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+
* removed `Serializable` implementation for `Route` and `CompiledRoute`
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: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*
1717
* @author Fabien Potencier <[email protected]>
1818
*/
19-
class CompiledRoute implements \Serializable
19+
class CompiledRoute
2020
{
2121
private $variables;
2222
private $tokens;
@@ -63,14 +63,6 @@ public function __serialize(): array
6363
];
6464
}
6565

66-
/**
67-
* @internal since Symfony 4.3, will be removed in Symfony 5 as the class won't implement Serializable anymore
68-
*/
69-
public function serialize()
70-
{
71-
return serialize($this->__serialize());
72-
}
73-
7466
public function __unserialize(array $data): void
7567
{
7668
$this->variables = $data['vars'];
@@ -83,14 +75,6 @@ public function __unserialize(array $data): void
8375
$this->hostVariables = $data['host_vars'];
8476
}
8577

86-
/**
87-
* @internal since Symfony 4.3, will be removed in Symfony 5 as the class won't implement Serializable anymore
88-
*/
89-
public function unserialize($serialized)
90-
{
91-
$this->__unserialize(unserialize($serialized, ['allowed_classes' => false]));
92-
}
93-
9478
/**
9579
* Returns the static prefix.
9680
*

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)