chore: improve static analysis, bump min PHP to 7.4, support PHP 8.2
Proposed changes
- Adds a lot of new tooling for static analysis
- Bumps the minimum PHP version to 7.4
- Supports PHP 8.1 and 8.2
- Runs CI builds on PHP versions 7.4 through 8.2
Since this adds parameter types and return types in many places where there were none, this can break BC for applications using this and extending classes or passing the wrong values into methods. As such, I recommend bumping the package's major version when doing the next release (after this is merged).
🚨 This stands to cause a lot of merge conflicts with #26. I'm not sure how we want to handle that. Which should we merge first?
How to test
composer test
Unit Tests
- [x] This PR has unit tests: updates to the unit tests, as needed
- [ ] This PR does not have unit tests: why?
@ramsey please release PR #26. I think it's more important to add support of federation v2 rather than analytic and support of php 8.1.
@ramsey my two cents, #26 should go first given it's been open for a really long time and will get even more delayed if there are merge conflicts. Also, +1 to @Makapashev's comment.
@ramsey You may add code coverage baseline to control that it is not downgraded with new PRs :)
https://github.com/Aeliot-Tm/phpunit-codecoverage-baseline
@Aeliot-Tm would you consider such code coverage baseline a blocker for getting this PR in a mergeable state? or could it be handled through a follow-up?
@ramsey any reason why both PHPStan and Psalm as static code analysis tools are added? Yes they can capture marginally different things, but solely starting with PHPStan with a baseline file might be a more controllable way of adding static analysis (e.g. as all future contributors will also have to work with it)?