BackwardCompatibilityCheck icon indicating copy to clipboard operation
BackwardCompatibilityCheck copied to clipboard

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

Open weirdan opened this issue 4 years ago • 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.

weirdan avatar Jan 03 '22 17:01 weirdan

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

weirdan avatar Jan 03 '22 17:01 weirdan

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 :thinking:

Ocramius avatar Jan 03 '22 17:01 Ocramius

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

weirdan avatar Jan 03 '22 17:01 weirdan

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

Ocramius avatar Jan 03 '22 17:01 Ocramius