Fix most Psalm/PHPStan issues #25
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This MR does a few things:
Looking at the primary complaints in #22, it appears that mostly these had to do with PHPStan not accepting bound template types in the PHPDoc comments. This would be something along the lines of
where
fis a bound template, as it is defined in terms of the bound type termsaandb. Again, PHPStan does not currently support this.I also noted a couple of other issues with the types presented which required more than just documentation fixes, so I decided to ensure I was running the unit tests to ensure I didn't break anything. This required me to update the version of PHPUnit in the project, as I only have recent versions of PHP installed and the version in the project did not run in recent versions of PHP. This in turn also required updates to php-cs-fixer and eris.
Once I had that all updated, I installed PHPStan and Psalm as dev dependencies so they could be run against the project to ensure that everything worked properly.
I did discover a few points where either (or neither) PHPStan or Psalm could not correctly deduce what was going on; for example, anything to do with the
curryNfunction immediately becomes super difficult for static analysis to follow. For these issues, I've added them to the respective baseline error files so that anyone who wants to have a crack at getting Psalm/PHPStan to understand what's going on can do so, without having these tools display errors where there aren't any.I've also corralled all of the respective cache files/directories into a single ignored
/.cachedirectory, simply to keep things centralized but not in the root of the project getting in everyone's way.