Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non-issue: Update project dependencies and use new PHP features #28

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jakubskrz
Copy link

@jakubskrz jakubskrz commented Apr 15, 2023

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)
  • 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.

  • I have read the CONTRIBUTING document.
  • My pull request addresses exactly one patch/feature.
  • 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!

- Versions of PHP with currently active support per https://www.php.net/supported-versions.php are only 8.1 and 8.2
- Update matrix with PHP versions for CI workflow
- Dropping support for PHP 5.x means that paragonie/random_compat dependency can be removed
- Minimum required versions of composer dependencies were bumped up to current versions
@hidehalo
Copy link
Owner

hidehalo commented Apr 18, 2023

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!

@hidehalo hidehalo changed the title Update project dependencies and use new PHP features Non-issue: Update project dependencies and use new PHP features Apr 18, 2023
@hidehalo
Copy link
Owner

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].

@jakubskrz
Copy link
Author

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.

@hidehalo
Copy link
Owner

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! 🥂

@@ -12,7 +12,7 @@ jobs:
strategy:
matrix:
operating-system: ['ubuntu-latest', 'macos-latest']
php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1']
php-versions: ['8.1', '8.2']

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
php-versions: ['8.1', '8.2']
php-versions: ['8.1', '8.3']

by now it can be lower/upper set to 8.3

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.

None yet

3 participants