[ErrorHandler] Trigger @method deprecation notices for abstract classes#64079
Merged
nicolas-grekas merged 1 commit intosymfony:8.1symfony/symfony:8.1from Apr 30, 2026
lacatoire:fix/63633-method-on-abstract-classeslacatoire/symfony:fix/63633-method-on-abstract-classesCopy head branch name to clipboard
Merged
[ErrorHandler] Trigger @method deprecation notices for abstract classes#64079nicolas-grekas merged 1 commit intosymfony:8.1symfony/symfony:8.1from lacatoire:fix/63633-method-on-abstract-classeslacatoire/symfony:fix/63633-method-on-abstract-classesCopy head branch name to clipboard
nicolas-grekas merged 1 commit intosymfony:8.1symfony/symfony:8.1from
lacatoire:fix/63633-method-on-abstract-classeslacatoire/symfony:fix/63633-method-on-abstract-classesCopy head branch name to clipboard
Conversation
Member
|
I think this should go in 8.1 as a new feature rather than treating it as a bugfix applying in LTS branches. |
Member
|
Yes as a new feature, with a changelog entry therefor. |
e8bac16 to
831405a
Compare
Member
|
Thank you @lacatoire. |
javiereguiluz
added a commit
to symfony/symfony-docs
that referenced
this pull request
May 4, 2026
…r abstract classes (lacatoire) This PR was merged into the 8.1 branch. Discussion ---------- [ErrorHandler] Document `@method` deprecation notices for abstract classes Documents the new 8.1 behavior from symfony/symfony#64079: ``DebugClassLoader`` now also collects ```@method``` annotations declared on abstract classes (previously only interfaces) to trigger deprecation notices for subclasses missing the announced method. Fixes #22313 Commits ------- a5d01b8 [ErrorHandler] Document `@method` deprecation notices for abstract classes
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DebugClassLoaderalready collects@methodannotations from interfaces so that subclasses receive a deprecation notice when they fail to implement the announced method. The downstream code (the comment around$parentInterfacesnearclass_implements) explicitly assumes that abstract parent classes accumulate methods inself::$method, but the population step at the top ofcheckClassonly runs whenisInterface()is true. As a result,@methodannotations on abstract classes were silently ignored.Extend the population check to
isInterface() || isAbstract()so abstract classes can announce upcoming abstract methods just like interfaces can. When the abstract class itself already declares a method matching the annotation, the corresponding entry is skipped: the annotation is then plain documentation and subclasses do not need to be deprecated.Adds two tests covering both cases (subclass missing the method, subclass implementing it).