-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[FrameworkBundle] Deprecate Symfony\Bundle\FrameworkBundle\Controller\Controller
#28243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -19,6 +19,8 @@ | |||
* | |||
* It provides methods to common features needed in controllers. | |||
* | |||
* @deprecated since Symfony 4.2. Use {@see AbstractController} instead. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't we add a runtime deprecation notice also?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DebugClassLoader will warn when you extend the class already (and this class is abstract, so it can only be used by extending it)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, but still: when we can, we should add the notice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but wouldn't this report duplicate notice all the time then ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue with not sending the notice is that we cannot spot in our own code when we extend Controller
. Do we? Only the runtime notice would tell, at least with the current strategy in place.
The maybe double notice is not an issue IMHO. Better one more than a missed notice leading to a fatal error when moving to next major.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing runtime notice (which will allow spotting that ControllerTest
misses an @group legacy
annotation, and maybe other glitches.)
aren't we running our testsuite with the DebugClassLoader enabled ? If no, it means that any deprecation coming from DebugClassLoader would be missed (and DebugClassLoader is the best place to report some of them, which is why we have this logic in it). |
Nope, we're not, and there is a good reason to it: we always add runtime deprecation notices. And then, IF there is some |
@@ -8,6 +8,7 @@ CHANGELOG | |||
* Allowed configuring PDO-based cache pools via a new `cache.adapter.pdo` abstract service | |||
* Deprecated auto-injection of the container in AbstractController instances, register them as service subscribers instead | |||
* Deprecated processing of services tagged `security.expression_language_provider` in favor of a new `AddExpressionLanguageProvidersPass` in SecurityBundle. | |||
* Deprecated the `Symfony\Bundle\FrameworkBundle\Controller\Controller` class in favour of `Symfony\Bundle\FrameworkBundle\Controller\AbstractController`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be favor
38dd419
to
f74d509
Compare
See tests :) |
f74d509
to
bd57d7d
Compare
Updated; needed some tweaks since we trigger the depreciation when the file is loaded. |
UPGRADE-4.2 needs to be updated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with some minor comments
@@ -14,11 +14,15 @@ | |||
use Symfony\Component\DependencyInjection\ContainerAwareInterface; | |||
use Symfony\Component\DependencyInjection\ContainerAwareTrait; | |||
|
|||
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.2. Use %s instead.', Controller::class, AbstractController::class), E_USER_DEPRECATED); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... Symfony 4.2, use ...
/** | ||
* Controller is a simple implementation of a Controller. | ||
* | ||
* It provides methods to common features needed in controllers. | ||
* | ||
* @deprecated since Symfony 4.2. Use {@see AbstractController} instead. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... Symfony 4.2, use ...
@fabpot wording updated 👍 |
bd57d7d
to
a7e319d
Compare
Thank you @sroze. |
…undle\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 | #28215 | License | MIT | Doc PR | ø Time to deprecate `Controller`, youpi !! 🎉 Commits ------- a7e319d Deprecate `Symfony\Bundle\FrameworkBundle\Controller\Controller`
@sroze Very nice, thanks 👍 |
I've created symfony/symfony-docs#10282 to document this new feature. Please, don't forget to create a doc issue for every new feature, specially for critical changes like this one (we use the deprecated class hundreds of times in the docs ... it should be a top-priority doc change). Thanks! |
… (chalasr) This PR was merged into the 4.2-dev branch. Discussion ---------- Add missing UPGRADE-4.2 entry for Controller deprecation | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a Forgot in #28243, removal documented in UPGRADE-5.0 Commits ------- cc23f5d Add missing UPGRADE-4.2 entry for Controller deprecation
Time to deprecate
Controller
, youpi !! 🎉