Skip to content

Conversation

@athrawes
Copy link

This MR does a few things:

  1. Updates the require-dev dependencies to allow users running PHP 8+ to run tests and static analysis
  2. Adds Psalm and PHPStan as dev dependencies to the project.
  3. Fixes many of the Psalm/PHPStan issues noted in PHPStan fails to compile #22.

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

/**
 * @template a
 * @template b
 * @template f of callable(a): b
 */

where f is a bound template, as it is defined in terms of the bound type terms a and b. 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 curryN function 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 /.cache directory, simply to keep things centralized but not in the root of the project getting in everyone's way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant