Non-issue: Update project dependencies and use new PHP features
Description
I have removed old unsupported versions of PHP and updated code with few features, namely native strict typing. I've considered to use PHP 8.0 as minimal required version of PHP, but since per https://www.php.net/supported-versions.php this version is now only receiving critical security patches (and only for next 7 months), I have decided to go with only PHP 8.1 and 8.2.
I would also like to add static code analysis if you are interested, so please let me know if I should added into this PR or if I should send it as a separate PR, since is not exactly related to updating PHP versions.
Motivation and context
I want to use this package in my project and I would like to benefit from strict native PHP types, which is not possible while supporting old PHP 5.
How has this been tested?
Since I didn't change any logic, existing tests should provide enough assurance.
Types of changes
What types of changes does your code introduce? Put an x in all the boxes that apply:
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [x] Breaking change (fix or feature that would cause existing functionality to change)
Checklist:
Go over all the following points, and put an x in all the boxes that apply.
- [x] I have read the CONTRIBUTING document.
- [x] My pull request addresses exactly one patch/feature.
- [x] I have created a branch for this patch/feature.
- [ ] Each individual commit in the pull request is meaningful.
- [ ] I have added tests to cover my changes.
- [ ] If my change requires a change to the documentation, I have updated it accordingly.
If you're unsure about any of these, don't hesitate to ask. We're here to help!
Sorry for reply late. @jakubskrz
I'm glad that there are different usage needs in the community, I think it makes sense to follow the active version of PHP.
But this is a compatibility-breaking feature, so this affects many legacy projects. I will start a new 2.x branch for this PR.
Regarding code static analysis, I think this code base is currently very simple, and the cost/benefit ratio of doing static analysis on it is very low, so I don't recommend it.
Also, please fix error in CI test first, and set strict_types=1 for examples & benchmark.
Thanks a lot for your contributions!
I get error below when I want to update dependencies, please take a look.
Loading composer repositories with package information Updating dependencies Your requirements could not be resolved to an installable set of packages.
Problem 1 - phpunit/phpunit[10.0.0, ..., 10.1.0] require phpunit/php-text-template ^3.0 -> found phpunit/php-text-template[dev-main, 3.0.x-dev (alias of dev-main)] but it does not match your minimum-stability. - Root composer.json requires phpunit/phpunit >=10.0 -> satisfiable by phpunit/phpunit[10.0.0, ..., 10.1.0].
Hi, I'm also sorry for late reply :D I didn't have much time lately to get back to this PR, hopefully I will have some over weekend or next week.
I'll look into those failing tests, it looks that code coverage config needs to be updated for new version of Phpunit.
Regarding that problem with updating Composer dependencies, I have no idea what happend. Maybe that package had released version with broken deps for a moment? 🤷 When I was preparing PR, I did not encounter any issues and now it's working. And also during CI build packages got installed correctly.
Hi, I'm also sorry for late reply :D I didn't have much time lately to get back to this PR, hopefully I will have some over weekend or next week.
I'll look into those failing tests, it looks that code coverage config needs to be updated for new version of Phpunit.
Regarding that problem with updating Composer dependencies, I have no idea what happend. Maybe that package had released version with broken deps for a moment? 🤷 When I was preparing PR, I did not encounter any issues and now it's working. And also during CI build packages got installed correctly.
Hi @jakubskrz Sounds great to me!
I'll look into those failing tests, it looks that code coverage config needs to be updated for new version of Phpunit.
LGTM
Maybe that package had released version with broken deps for a moment?
It's possible, could we allow the 9.x as minimum version dependence of PHPUnit? Maybe it' could avoid that composer update error.
I did not encounter any issues and now it's working. And also during CI build packages got installed correctly.
Maybe we could retry CI test again first.
Please take a look at the review comments when you have time to re-join this thread.
Still, I'm appreciate your contribution and precious time! 🥂