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

Add support for PHP 8 #106

Merged
merged 5 commits into from
Sep 25, 2020
Merged

Add support for PHP 8 #106

merged 5 commits into from
Sep 25, 2020

Conversation

pierredup
Copy link
Contributor

The biggest change to support PHP 8 is the Match class which fails due to the new match expression (match is now a reserved keyword).

This PR also adds PHP nightly on Travis in order to run the unit tests on PHP 8. This requires an upgrade on PHPUnit to 9.3-dev which is the only version to support PHP 8. But this means PHP 7.0 - 7.2 support needs to be dropped (7.2 is in security-fix for the next 3 months only).

An alternative option to keep support for PHP < 7.3 is to install different PHPUnit versions in Travis for each build. If you want to go that route then I'll update the PR accordingly.

src/Negotiation/Matched.php Outdated Show resolved Hide resolved
.travis.yml Outdated Show resolved Hide resolved
@esbobkov
Copy link

esbobkov commented Aug 7, 2020

Would like to test, but unfortunately @willdurand will back only 7th September

@esbobkov
Copy link

How to move it forward?

@stephanvierkant
Copy link

Ping @willdurand

@willdurand
Copy link
Owner

Hey, sorry about that. I can review this patch, although I haven' done any PHP in years. Can someone else also review this PR please?

@willdurand
Copy link
Owner

The biggest change to support PHP 8 is the Match class which fails due to the new match expression (match is now a reserved keyword).

Woah, ok. That's good to know, this will require a new major release then.

Copy link
Owner

@willdurand willdurand left a comment

Choose a reason for hiding this comment

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

An alternative option to keep support for PHP < 7.3 is to install different PHPUnit versions in Travis for each build. If you want to go that route then I'll update the PR accordingly.

Would you have a link to the version calendar? Are PHP 7.1 and 7.2 still supported? What about usage?

.travis.yml Outdated Show resolved Hide resolved
- hhvm

matrix:
allow_failures:
- php: hhvm

before_script:
- composer self-update
- composer install --prefer-dist --no-interaction
- composer self-update --2
Copy link
Owner

Choose a reason for hiding this comment

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

What does --2 mean?

Choose a reason for hiding this comment

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

Force update composer to 2.0.0-RC1.

.travis.yml Outdated Show resolved Hide resolved
@@ -83,7 +83,7 @@ public function getOrderedElements($header)
$qB = $b[0];

if ($qA == $qB) {
return $a[1] > $b[1];
return $a[1] <=> $b[1];
Copy link
Owner

Choose a reason for hiding this comment

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

I don't think this is a very useful change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This just changes the return value from a boolean (which then gets converted to an int) to the proper expected return value (E.G -1, 0 or 1)

@pierredup
Copy link
Contributor Author

Would you have a link to the version calendar? Are PHP 7.1 and 7.2 still supported? What about usage?

PHP 7.1 is not supported anymore, and PHP 7.2 is in security-fix only, which will end in November of this year (https://www.php.net/supported-versions.php).

Based on https://blog.packagist.com/php-versions-stats-2020-1-edition/ (as of May this year), PHP 7.2 usage is still quite high (almost 30%), but seeing as it will be unsupported in a couple months, it might be good to drop support for it now.

@pierredup
Copy link
Contributor Author

I can review this patch, although I haven' done any PHP in years. Can someone else also review this PR please?

Maybe @dunglas? I know ApiPlatform uses this package

composer.json Outdated Show resolved Hide resolved
src/Negotiation/AbstractNegotiator.php Show resolved Hide resolved
@pierredup
Copy link
Contributor Author

I've added Symfony PHPUnit bridge and re-added PHP 7.1 and 7.2 to Travis, so I think this is now ready.
I'll add return types to another PR as it's not related to this changes

composer.json Outdated Show resolved Hide resolved
@gnutix
Copy link

gnutix commented Oct 13, 2020

Is this fix available in any release? (or only dev-master ?)

@willdurand
Copy link
Owner

dev-master only

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.

7 participants