Roave/BackwardCompatibilityCheck

Duplicate issues reported when public method is removed on a parent class

weirdan opened this issue · 4 comments

Assume we have the following class hierarchy:

class A {
   public function m(): void {}
}
class B extends A {}
class C extends A {}

When A::m() is removed, BCC reports Method A#m() was removed 3 times, once for the base class and once more for every descendant.

https://github.com/vimeo/psalm/pull/7276/files resulted in 867 entries in changelog.

Yes, the duplication is annoying, but kinda necessary when inheritance involves third-party dependencies.

IMO it is not that problematic, compared to not having this reported at all 🤔

The problem is, BCC does not report the issue on the descendant class, it just repeats the same message:

  • [BC] Method A#m() was removed
  • [BC] Method A#m() was removed
  • [BC] Method A#m() was removed

At the very least I would expect something like this:

  • [BC] Method A#m() was removed
  • [BC] Method B#m() (inherited from A) was removed
  • [BC] Method C#m() (inherited from A) was removed

Makes sense - that is certainly something we can improve on!