willdurand / Negotiation

Content Negotiation tools for PHP.
https://williamdurand.fr/Negotiation/
MIT License
1.41k stars 62 forks source link

Add support for PHP 8 #106

Closed pierredup closed 3 years ago

pierredup commented 4 years ago

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.

esbobkov commented 4 years ago

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

esbobkov commented 4 years ago

How to move it forward?

stephanvierkant commented 3 years ago

Ping @willdurand

willdurand commented 3 years ago

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 commented 3 years ago

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.

pierredup commented 3 years ago

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 commented 3 years ago

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

pierredup commented 3 years ago

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

gnutix commented 3 years ago

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

willdurand commented 3 years ago

dev-master only