phpstan-src icon indicating copy to clipboard operation
phpstan-src copied to clipboard

[WIP] Add ParametersRedefinitionRule

Open javaDeveloperKid opened this issue 3 years ago • 0 comments

Implement ParametersRedefinitionRule. PR follow of https://github.com/phpstan/phpstan/issues/8025

Ondrej's hints from the issue comment:

  • [ ] Research what PHP version considers this as an error. I remember a situation that such code was present in a library (React.PHP maybe) and it started failing only on PHP 8.0 or so.
  • [ ] This needs to be checked for class methods, functions, closures and arrow functions. FunctionDefinitionCheck is the ideal place to implement this.
  • [ ] There are other similar issues that we're currently definitely missing and that should be checked:
  • [ ] Multiple variadic parameters in a single signature
  • [ ] Parameter named $this
  • [ ] Same name for closure parameter as for used variable
  • [ ] Only the last parameter can be variadic
  • [ ] Optional parameter before another required parameter (maybe already implemented - needs to be checked)
  • [ ] Maybe something about byRef (&) parameters is also limited, I don't know

This is my first PR so please tell me if you allow WIP pull requests. If yes, please tell how and who to ping for another rounds of review because not every push will be intended to review and I don't want to acquire you attention unnecessary. I also don't know how to structure the files in the repo directories so please correct me when needed during reviews.

javaDeveloperKid avatar Sep 22 '22 16:09 javaDeveloperKid