Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[ErrorHandler] Trigger @method deprecation notices for abstract classes#64079

Merged
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
Apr 30, 2026
Merged

[ErrorHandler] Trigger @method deprecation notices for abstract classes#64079
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

@lacatoire
Copy link
Copy Markdown
Contributor

@lacatoire lacatoire commented Apr 30, 2026

Q A
Branch? 8.1
Bug fix? no
New feature? yes
Deprecations? no
Issues Fixes #63633
License MIT

DebugClassLoader already collects @method annotations from interfaces so that subclasses receive a deprecation notice when they fail to implement the announced method. The downstream code (the comment around $parentInterfaces near class_implements) explicitly assumes that abstract parent classes accumulate methods in self::$method, but the population step at the top of checkClass only runs when isInterface() is true. As a result, @method annotations 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).

@stof
Copy link
Copy Markdown
Member

stof commented Apr 30, 2026

I think this should go in 8.1 as a new feature rather than treating it as a bugfix applying in LTS branches.
What do you think @nicolas-grekas ?

@nicolas-grekas
Copy link
Copy Markdown
Member

Yes as a new feature, with a changelog entry therefor.

@nicolas-grekas nicolas-grekas modified the milestones: 6.4, 8.1 Apr 30, 2026
@lacatoire lacatoire force-pushed the fix/63633-method-on-abstract-classes branch from e8bac16 to 831405a Compare April 30, 2026 15:39
@lacatoire lacatoire changed the base branch from 6.4 to 8.1 April 30, 2026 15:40
@nicolas-grekas
Copy link
Copy Markdown
Member

Thank you @lacatoire.

@nicolas-grekas nicolas-grekas merged commit 6f09f3f into symfony:8.1 Apr 30, 2026
7 of 15 checks passed
@lacatoire lacatoire deleted the fix/63633-method-on-abstract-classes branch April 30, 2026 20:35
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
@fabpot fabpot mentioned this pull request May 6, 2026
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.

@method on abstract classes does not trigger deprecation notices in subclasses

4 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.