You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@trigger_error(sprintf('Passing an object as the route name is deprecated in symfony-cmf/Routing v2.3 and will not work in Symfony 5.0. Pass the `RouteObjectInterface::OBJECT_BASED_ROUTE_NAME` constant as the route name and the object as "%s" parameter in the parameters array.', RouteObjectInterface::ROUTE_OBJECT), E_USER_DEPRECATED);
223
+
}
224
+
221
225
$debug = [];
222
226
223
227
foreach ($this->all() as$router) {
@@ -227,8 +231,19 @@ public function generate($name, $parameters = [], $absolute = UrlGeneratorInterf
227
231
continue;
228
232
}
229
233
234
+
// if $router does not announce it is capable of handling
235
+
// non-string routes and the ROUTE_OBJECT is set in the parameters array, continue
236
+
if (array_key_exists(RouteObjectInterface::ROUTE_OBJECT, $parameters) && is_object($parameters[RouteObjectInterface::ROUTE_OBJECT]) && !$routerinstanceof VersatileGeneratorInterface) {
237
+
continue;
238
+
}
239
+
240
+
$routeName = $name;
241
+
if (RouteObjectInterface::OBJECT_BASED_ROUTE_NAME === $name && array_key_exists(RouteObjectInterface::ROUTE_OBJECT, $parameters) && is_object($parameters[RouteObjectInterface::ROUTE_OBJECT])) {
@trigger_error(sprintf('Passing an object as the route name is deprecated in symfony-cmf/Routing v2.3 and will not work in Symfony 5.0. Pass the `RouteObjectInterface::OBJECT_BASED_ROUTE_NAME` constant as the route name and the object as "%s" parameter in the parameters array.', RouteObjectInterface::ROUTE_OBJECT), E_USER_DEPRECATED);
@@ -613,9 +614,16 @@ public function testGenerateNotFound()
613
614
614
615
/**
615
616
* Route is an object but no versatile generator around to do the debug message.
617
+
*
618
+
* @group legacy
619
+
* @expectedDeprecation Passing an object as the route name is deprecated in symfony-cmf/Routing v2.3 and will not work in Symfony 5.0. Pass the `RouteObjectInterface::OBJECT_BASED_ROUTE_NAME` constant as the route name and the object as "_route_object" parameter in the parameters array.
616
620
*/
617
621
publicfunctiontestGenerateObjectNotFound()
618
622
{
623
+
if (!class_exists(ObjectRouteLoader::class)) {
624
+
$this->markTestSkipped('Skip this test on >= sf5. This will throw a \TypeError.');
625
+
}
626
+
619
627
$name = new \stdClass();
620
628
$parameters = ['test' => 'value'];
621
629
@@ -634,9 +642,16 @@ public function testGenerateObjectNotFound()
634
642
635
643
/**
636
644
* A versatile router will generate the debug message.
645
+
*
646
+
* @group legacy
647
+
* @expectedDeprecation Passing an object as the route name is deprecated in symfony-cmf/Routing v2.3 and will not work in Symfony 5.0. Pass the `RouteObjectInterface::OBJECT_BASED_ROUTE_NAME` constant as the route name and the object as "_route_object" parameter in the parameters array.
$this->markTestSkipped('Skip this test on >= sf5. This will throw a \TypeError.');
653
+
}
654
+
640
655
$name = new \stdClass();
641
656
$parameters = ['test' => 'value'];
642
657
@@ -663,8 +678,16 @@ public function testGenerateObjectNotFoundVersatile()
663
678
$this->router->generate($name, $parameters);
664
679
}
665
680
681
+
/**
682
+
* @group legacy
683
+
* @expectedDeprecation Passing an object as the route name is deprecated in symfony-cmf/Routing v2.3 and will not work in Symfony 5.0. Pass the `RouteObjectInterface::OBJECT_BASED_ROUTE_NAME` constant as the route name and the object as "_route_object" parameter in the parameters array.
684
+
*/
666
685
publicfunctiontestGenerateObjectName()
667
686
{
687
+
if (!class_exists(ObjectRouteLoader::class)) {
688
+
$this->markTestSkipped('Skip this test on >= sf5. This will throw a \TypeError.');
0 commit comments