Skip to content

Commit 4edbd60

Browse files
committed
feature symfony#28243 [FrameworkBundle] Deprecate Symfony\Bundle\FrameworkBundle\Controller\Controller (sroze)
This PR was merged into the 4.2-dev branch. Discussion ---------- [FrameworkBundle] Deprecate `Symfony\Bundle\FrameworkBundle\Controller\Controller` | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | yes | Tests pass? | yes | Fixed tickets | symfony#28215 | License | MIT | Doc PR | ø Time to deprecate `Controller`, youpi !! 🎉 Commits ------- a7e319d Deprecate `Symfony\Bundle\FrameworkBundle\Controller\Controller`
2 parents 9cc80ec + a7e319d commit 4edbd60

File tree

6 files changed

+20
-10
lines changed

6 files changed

+20
-10
lines changed

UPGRADE-5.0.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ FrameworkBundle
9191
* Removed `Symfony\Bundle\FrameworkBundle\Controller\ControllerNameParser`.
9292
* Warming up a router in `RouterCacheWarmer` that does not implement the `WarmableInterface` is not supported anymore.
9393
* The `RequestDataCollector` class has been removed. Use the `Symfony\Component\HttpKernel\DataCollector\RequestDataCollector` class instead.
94+
* Removed `Symfony\Bundle\FrameworkBundle\Controller\Controller`. Use `Symfony\Bundle\FrameworkBundle\Controller\AbstractController` instead.
9495

9596
HttpFoundation
9697
--------------

src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ CHANGELOG
88
* Allowed configuring PDO-based cache pools via a new `cache.adapter.pdo` abstract service
99
* Deprecated auto-injection of the container in AbstractController instances, register them as service subscribers instead
1010
* Deprecated processing of services tagged `security.expression_language_provider` in favor of a new `AddExpressionLanguageProvidersPass` in SecurityBundle.
11+
* Deprecated the `Symfony\Bundle\FrameworkBundle\Controller\Controller` class in favor of `Symfony\Bundle\FrameworkBundle\Controller\AbstractController`.
1112
* Enabled autoconfiguration for `Psr\Log\LoggerAwareInterface`
1213
* Added new "auto" mode for `framework.session.cookie_secure` to turn it on when HTTPS is used
1314

src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,15 @@
1414
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
1515
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
1616

17+
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.2, use %s instead.', Controller::class, AbstractController::class), E_USER_DEPRECATED);
18+
1719
/**
1820
* Controller is a simple implementation of a Controller.
1921
*
2022
* It provides methods to common features needed in controllers.
2123
*
24+
* @deprecated since Symfony 4.2, use {@see AbstractController} instead.
25+
*
2226
* @author Fabien Potencier <fabien@symfony.com>
2327
*/
2428
abstract class Controller implements ContainerAwareInterface

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
use Symfony\Bridge\Monolog\Processor\ProcessorInterface;
2020
use Symfony\Bridge\Twig\Extension\CsrfExtension;
2121
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
22-
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
2322
use Symfony\Bundle\FrameworkBundle\Routing\AnnotatedRouteControllerLoader;
2423
use Symfony\Bundle\FullStack;
2524
use Symfony\Component\Cache\Adapter\AbstractAdapter;
@@ -299,7 +298,6 @@ public function load(array $configs, ContainerBuilder $container)
299298

300299
// Added explicitly so that we don't rely on the class map being dumped to make it work
301300
'Symfony\\Bundle\\FrameworkBundle\\Controller\\AbstractController',
302-
'Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller',
303301
));
304302

305303
$container->registerForAutoconfiguration(Command::class)
@@ -316,7 +314,7 @@ public function load(array $configs, ContainerBuilder $container)
316314
->addTag('controller.argument_value_resolver');
317315
$container->registerForAutoconfiguration(AbstractController::class)
318316
->addTag('controller.service_arguments');
319-
$container->registerForAutoconfiguration(Controller::class)
317+
$container->registerForAutoconfiguration('Symfony\Bundle\FrameworkBundle\Controller\Controller')
320318
->addTag('controller.service_arguments');
321319
$container->registerForAutoconfiguration(DataCollectorInterface::class)
322320
->addTag('data_collector');

src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTest.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,13 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\Tests\Controller;
1313

14-
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
15-
14+
/**
15+
* @group legacy
16+
*/
1617
class ControllerTest extends ControllerTraitTest
1718
{
1819
protected function createController()
1920
{
2021
return new TestController();
2122
}
2223
}
23-
24-
class TestController extends Controller
25-
{
26-
use TestControllerTrait;
27-
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
namespace Symfony\Bundle\FrameworkBundle\Tests\Controller;
4+
5+
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
6+
7+
class TestController extends Controller
8+
{
9+
use TestControllerTrait;
10+
}

0 commit comments

Comments
 (0)