Skip to content
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

Fix deprecation warning for UserInterface on Symfony 4 #3033

Merged
merged 1 commit into from
Jan 14, 2022

Conversation

stof
Copy link
Member

@stof stof commented Jan 14, 2022

The deprecated annotation removed in 2.2.3 had a purpose: deprecated interfaces are allowed to extend deprecated interfaces of another package without triggering a warning in DebugClassLoader. However, applying it on the public UserInterface was the mistake. Instead of having an internal interface that is extended by the conditional declaration of the public interface, the implementation is now reversed. An internal CompatUserInterface is now declared conditionally to handle the BC layer, and the public UserInterface extends it.
As our UserInterface and the CompatUserInterface are in the same package, UserInterface is allowed to extend CompatUserInterface without warning even when it is marked as deprecated, making both DebugClassLoader and downstream static analyzers happy.

The deprecated annotation removed in 2.2.3 had a purpose: deprecated
interfaces are allowed to extend deprecated interfaces of another
package without triggering a warning in DebugClassLoader.
However, applying it on the public UserInterface was the mistake.
Instead of having an internal interface that is extended by the
conditional declaration of the public interface, the implementation is
now reversed. An internal CompatUserInterface is now declared
conditionally to handle the BC layer, and the public UserInterface
extends it.
As our UserInterface and the CompatUserInterface are in the same
package, UserInterface is allowed to extend CompatUserInterface without
warning even when it is marked as deprecated, making both
DebugClassLoader and downstream static analyzers happy.
@stof stof merged commit 5459f83 into FriendsOfSymfony:2.x Jan 14, 2022
@stof stof deleted the fix_user_deprecation branch January 14, 2022 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant