8000 Undeprecate the single-colon notation for controllers · symfony/symfony@e578c92 · GitHub
[go: up one dir, main page]

Skip to content

Commit e578c92

Browse files
committed
Undeprecate the single-colon notation for controllers
This notation is the only way to support controllers as services in the 3.4 LTS version. This deprecation has only a very small benefit for the Symfony codebase (the amount of code involved is very small), but has a huge cost for the community which cannot avoid this deprecation without dropping support for the LTS or making crazy logic to switch routing files (as they cannot switch things inline in YAML or XML files). This deprecation will be delayed until a future 5.x version, when the current LTS will be 4.4 (which supports the new notation).
1 parent c96325f commit e578c92

File tree

4 files changed

+3
-17
lines changed

4 files changed

+3
-17
lines changed

UPGRADE-5.0.md

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ EventDispatcher
3030
FrameworkBundle
3131
---------------
3232

33-
* Removed support for `bundle:controller:action` and `service:action` syntaxes to reference controllers. Use `serviceOrFqcn::method`
33+
* Removed support for `bundle:controller:action` syntax to reference controllers. Use `serviceOrFqcn::method`
3434
instead where `serviceOrFqcn` is either the service ID when using controllers as services or the FQCN of the controller.
3535

3636
Before:
@@ -40,11 +40,6 @@ FrameworkBundle
4040
path: /
4141
defaults:
4242
_controller: FrameworkBundle:Redirect:redirect
43-
44-
service_controller:
45-
path: /
46-
defaults:
47-
_controller: app.my_controller:myAction
4843
```
4944
5045
After:
@@ -54,11 +49,6 @@ FrameworkBundle
5449
path: /
5550
defaults:
5651
_controller: Symfony\Bundle\FrameworkBundle\Controller\RedirectController::redirectAction
57-
58-
service_controller:
59-
path: /
60-
defaults:
61-
_controller: app.my_controller::myAction
6252
```
6353
6454
* Removed `Symfony\Bundle\FrameworkBundle\Controller\ControllerNameParser`.

src/Symfony/Component/HttpKernel/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ CHANGELOG
66

77
* added orphaned events support to `EventDataCollector`
88
* `ExceptionListener` now logs exceptions at priority `0` (previously logged at `-128`)
9-
* Deprecated `service:action` syntax with a single colon to reference controllers. Use `service::method` instead.
9+
* Add support for using `service::method` to reference controllers, making it consistent with other cases. It is recommended over the `service:action` syntax with a single colon, which will be deprecated in the future.
1010
* Added the ability to profile individual argument value resolvers via the
1111
`Symfony\Component\HttpKernel\Controller\ArgumentResolver\TraceableValueResolver`
1212

src/Symfony/Component/HttpKernel/Controller/ContainerControllerResolver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ protected function createController($controller)
3636
{
3737
if (1 === substr_count($controller, ':')) {
3838
$controller = str_replace(':', '::', $controller);
39-
@trigger_error(sprintf('Referencing controllers with a single colon is deprecated since Symfony 4.1. Use %s instead.', $controller), E_USER_DEPRECATED);
39+
// TODO deprecate this in 5.1
4040
}
4141

4242
return parent::createController($controller);

src/Symfony/Component/HttpKernel/Tests/Controller/ContainerControllerResolverTest.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@
1919

2020
class ContainerControllerResolverTest extends ControllerResolverTest
2121
{
22-
/**
23-
* @group legacy
24-
* @expectedDeprecation Referencing controllers with a single colon is deprecated since Symfony 4.1. Use foo::action instead.
25-
*/
2622
public function testGetControllerServiceWithSingleColon()
2723
{
2824
$service = new ControllerTestService('foo');

0 commit comments

Comments
 (0)
0