Commit 6f09f3f
committed
feature #64079 [ErrorHandler] Trigger
This PR was merged into the 8.1 branch.
Discussion
----------
[ErrorHandler] Trigger `@method` deprecation notices for abstract classes
| 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).
Commits
-------
831405a [ErrorHandler] Trigger `@method` deprecation notices for abstract classes too@method deprecation notices for abstract classes (lacatoire)4 files changed
+64-1Lines changed: 64 additions & 1 deletion
File tree
Expand file treeCollapse file tree
Open diff view settings
Filter options
- src/Symfony/Component/ErrorHandler
- Tests
- Fixtures
Expand file treeCollapse file tree
Open diff view settings
Collapse file
src/Symfony/Component/ErrorHandler/CHANGELOG.md
Copy file name to clipboardExpand all lines: src/Symfony/Component/ErrorHandler/CHANGELOG.md+1Lines changed: 1 addition & 0 deletions
- Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
5 | 5 | |
6 | 6 | |
7 | 7 | |
| 8 | + |
8 | 9 | |
9 | 10 | |
10 | 11 | |
|
Collapse file
src/Symfony/Component/ErrorHandler/DebugClassLoader.php
Copy file name to clipboardExpand all lines: src/Symfony/Component/ErrorHandler/DebugClassLoader.php+6-1Lines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
436 | 436 | |
437 | 437 | |
438 | 438 | |
439 | | - |
| 439 | + |
440 | 440 | |
441 | 441 | |
442 | 442 | |
| ||
446 | 446 | |
447 | 447 | |
448 | 448 | |
| 449 | + |
| 450 | + |
| 451 | + |
| 452 | + |
| 453 | + |
449 | 454 | |
450 | 455 | |
451 | 456 | |
|
Collapse file
src/Symfony/Component/ErrorHandler/Tests/DebugClassLoaderTest.php
Copy file name to clipboardExpand all lines: src/Symfony/Component/ErrorHandler/Tests/DebugClassLoaderTest.php+46Lines changed: 46 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
410 | 410 | |
411 | 411 | |
412 | 412 | |
| 413 | + |
| 414 | + |
| 415 | + |
| 416 | + |
| 417 | + |
| 418 | + |
| 419 | + |
| 420 | + |
| 421 | + |
| 422 | + |
| 423 | + |
| 424 | + |
| 425 | + |
| 426 | + |
| 427 | + |
| 428 | + |
| 429 | + |
| 430 | + |
| 431 | + |
| 432 | + |
| 433 | + |
| 434 | + |
| 435 | + |
| 436 | + |
| 437 | + |
| 438 | + |
| 439 | + |
| 440 | + |
| 441 | + |
| 442 | + |
| 443 | + |
| 444 | + |
| 445 | + |
| 446 | + |
| 447 | + |
| 448 | + |
| 449 | + |
| 450 | + |
413 | 451 | |
414 | 452 | |
415 | 453 | |
| ||
722 | 760 | |
723 | 761 | |
724 | 762 | |
| 763 | + |
| 764 | + |
| 765 | + |
| 766 | + |
| 767 | + |
| 768 | + |
| 769 | + |
| 770 | + |
725 | 771 | |
726 | 772 | |
727 | 773 | |
|
Collapse file
src/Symfony/Component/ErrorHandler/Tests/Fixtures/VirtualAbstract.php
Copy file name to clipboard+11Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
0 commit comments