TomasVotruba / unused-public

Find Unused Public Elements in Your Code
https://tomasvotruba.com/blog/can-phpstan-find-dead-public-methods/
MIT License
151 stars 12 forks source link

ignore getter/setter methods #113

Closed staabm closed 7 months ago

staabm commented 7 months ago

I can see devs spending an enourmous amount of time re-validating whether unused-public really is correct about a certain super simple setter and/or getter method is really unused (because e.g. some framework magic might be involved unused-public cannot know about).

IMO hunting within a codebase for a unused simple getter and/or setter is not worth the time doing so.

what do you think about ignoring trivial setters/getters like

class X {
  public function setY($y) {
    $this->y = $y;
  }
  public function getY() {
    return $this->y;
  }
}

?

it could either be a new option or maybe done by default... wdyt?

TomasVotruba commented 7 months ago

This actually showed some properties unused as well, as none were used.

This package should be raw as possible. Adding more custom conditions would make it far way from the simple idea.