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

Skip to content

[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

Merged
merged 1 commit into from
Aug 28, 2018

Conversation

sroze
Copy link
Contributor

@sroze sroze commented Aug 22, 2018

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 !! 🎉

@@ -19,6 +19,8 @@
*
* It provides methods to common features needed in controllers.
*
* @deprecated since Symfony 4.2. Use {@see AbstractController} instead.
Copy link
Member

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?

Copy link
Member

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)

Copy link
Member

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

Copy link
Member

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 ?

Copy link
Member

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.

Copy link
Member

@nicolas-grekas nicolas-grekas left a 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.)

@stof
Copy link
Member

stof commented Aug 23, 2018

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).

@nicolas-grekas
Copy link
Member

nicolas-grekas commented Aug 23, 2018

Nope, we're not, and there is a good reason to it: we always add runtime deprecation notices. And then, IF there is some Symfony\* class that must implement/extend some interface/class for BC, then we remove the runtime notice so that our own code is deprecation free in the phpunit report. As you can see, making DebugClassLoader report these would defeat the whole process.

@@ -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`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be favor

@sroze sroze force-pushed the deprecate-controller branch from 38dd419 to f74d509 Compare August 24, 2018 09:42
@nicolas-grekas
Copy link
Member

See tests :)

@sroze sroze force-pushed the deprecate-controller branch from f74d509 to bd57d7d Compare August 26, 2018 12:10
@sroze
Copy link
Contributor Author

sroze commented Aug 26, 2018

Updated; needed some tweaks since we trigger the depreciation when the file is loaded.

@chalasr
Copy link
Member

chalasr commented Aug 26, 2018

UPGRADE-4.2 needs to be updated

Copy link
Member

@fabpot fabpot left a 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);
Copy link
Member

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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... Symfony 4.2, use ...

@sroze
Copy link
Contributor Author

sroze commented Aug 27, 2018

@fabpot wording updated 👍

@sroze sroze force-pushed the deprecate-controller branch from bd57d7d to a7e319d Compare August 27, 2018 18:13
@fabpot
Copy link
Member

fabpot commented Aug 28, 2018

Thank you @sroze.

@fabpot fabpot merged commit a7e319d into symfony:master Aug 28, 2018
fabpot added a commit that referenced this pull request Aug 28, 2018
…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`
@TomasVotruba
Copy link
Contributor

@sroze Very nice, thanks 👍

@javiereguiluz
Copy link
Member

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!

nicolas-grekas added a commit that referenced this pull request Sep 8, 2018
… (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
@nicolas-grekas nicolas-grekas modified the milestones: next, 4.2 Nov 1, 2018
This was referenced Nov 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants