php-resque icon indicating copy to clipboard operation
php-resque copied to clipboard

feat: support for PHP 8.1

Open TorstenDittmann opened this issue 2 years ago • 14 comments

I used main as the base branch, since it appeared to be more up2date. If that was a mistake I'll gladly fix that and work from develop.

Opened this PR as draft - since I wasn't able to test it completely on my machine and would like to rely on the CI at this stage. Especially since I cannot test multiple PHP versions that easily.

Depends on #56

Changes

  • bumps phpunit/phpunit to ^8.5
  • replaces deprecated strftime($format) with date($format, time())
  • adapts test classes that extend the PHPUnit Testcase to new version
    • using PHPUnit\Framework\TestCase over PHPUnit_Framework_TestCase
    • adds parameters to some test classes*
    • replaces PHPDoc comments for expecting exceptions with $this->expectException(Exception::class)
    • replaces $this->assertInternalType('array', $array) with $this->assertIsArray($array)

* According to PHP 8.0 backward compatible changes => call_user_func_array() array keys will now be interpreted as parameter names, instead of being silently ignored.

TorstenDittmann avatar Mar 17 '22 13:03 TorstenDittmann

Your requirements could not be resolved to an installable set of packages.

php-resque still supports PHP 5.6, and the newer phpunit versions all require a newer one.

My idea was to get the namespace changes in first (#56), since that is something that is still supported by 5.6, release that and do breaking changes for PHP 7/8 support after. Not sure what @danhunsaker 's plans are though :)

pprkut avatar Mar 17 '22 15:03 pprkut

Your requirements could not be resolved to an installable set of packages.

php-resque still supports PHP 5.6, and the newer phpunit versions all require a newer one.

My idea was to get the namespace changes in first (#56), since that is something that is still supported by 5.6, release that and do breaking changes for PHP 7/8 support after. Not sure what @danhunsaker 's plans are though :)

Yeah, that makes sense 👍🏻

In my opinion 5.x shouldn't be a priority at this point anyway, since it is a blocker for teams/people using this library to adapt more recent versions of PHP.

I'll be more than happy to help out for this transition wherever possible 🙂

TorstenDittmann avatar Mar 17 '22 15:03 TorstenDittmann

I used main as the base branch, since it appeared to be more up2date.

Yeah, I need to fix the branches. PR target should always be develop, but let me update it before you switch targets.

Not sure what @danhunsaker 's plans are though :)

Exactly that, actually! Just gotta finish the work involved.

danhunsaker avatar Mar 17 '22 16:03 danhunsaker

Exactly that, actually! Just gotta finish the work involved.

Awesome, feel free to reach out if you need a set of helping hands 🙂

TorstenDittmann avatar Mar 17 '22 17:03 TorstenDittmann

Awesome, feel free to reach out if you need a set of helping hands slightly_smiling_face

The pull request for that is actually pretty complete already, from a functional perspective. A minor code refactor and documentation update is all that's missing and then it should be ready. I plan to tackle that this weekend.

What would be really appreciated though is testing. I updated all the existing unit tests and they pass, but "existing" is the watchword :) Not all functionality is covered by unit tests yet and unit tests themselves aren't perfect either. So while they pass, it might very well be that some odd thing here and there fell through the cracks and testing the code will expose that. If you want, you could take a stab at that, though it's probably a bit easier if you wait until I made the last small refactor.

pprkut avatar Mar 17 '22 19:03 pprkut

@danhunsaker what if I create a partial PR only replacing the deprecated strftime($format) with date($format, time()) - which should in theory work for all supported versions including 5.6. We could already have compatibility for PHP 8.1 with the next version. Obviously not officially because of missing tests.

Depending on the ETA for the namespace changes - our team could already move to PHP 8.1 👍🏻

TorstenDittmann avatar Mar 18 '22 10:03 TorstenDittmann

Yeah, that seems straightforward enough.

danhunsaker avatar Mar 18 '22 11:03 danhunsaker

hey guys, very welcome changes. Any ETA for a new tag? 😄

thedotedge avatar Apr 13 '22 07:04 thedotedge

@danhunsaker what if I create a partial PR only replacing the deprecated strftime($format) with date($format, time()) - which should in theory work for all supported versions including 5.6. We could already have compatibility for PHP 8.1 with the next version. Obviously not officially because of missing tests.

Depending on the ETA for the namespace changes - our team could already move to PHP 8.1 👍🏻

I had created a PR doing exactly that. I closed it on seeing this PR. Shall I re-open it?

JoyceBabu avatar Aug 22 '22 16:08 JoyceBabu

@JoyceBabu Yes, I think that makes sense. I'm not sure of what's planned for everything that's in this PR, but that change alone should be fairly easy to merge, so a separate PR should be fine :slightly_smiling_face:

pprkut avatar Aug 25 '22 06:08 pprkut

I have reopened the PR. https://github.com/resque/php-resque/pull/66

JoyceBabu avatar Aug 25 '22 08:08 JoyceBabu

Can anyone provide me an ETA on when this PR gonna be merged?

Avinash-Ravula avatar Apr 25 '23 11:04 Avinash-Ravula

@TorstenDittmann Ok, go ahead and rebase against develop at your earliest convenience.

danhunsaker avatar Jul 13 '23 19:07 danhunsaker

It's great to see activity here. This looks good and would be great to have it released. Puts it closer to full support to 8.x.

fersk avatar Aug 26 '23 10:08 fersk