phpcompat
phpcompat copied to clipboard
Add PHP 7.4 Support
This patch adds support for PHP 7.4 compatibility checking. To test it, add this function to your theme/plugin:
function ternary_deprecation() {
return 1 ? 2 : 3 ? 4 : 5; // deprecated in 7.4
}
and run the plugin.
It looks like the Travis configuration needs to be updated with an image that includes PHP 7.4.
It looks like the Travis configuration needs to be updated with an image that includes PHP 7.4.
Yes, Travis has been very slow with that. For now you can use the unofficial "7.4snapshot"
image which was created by one of the PHP core devs.
It seems you can make it work with Travis now without 7.4snapshot
.
Please check this github issue & pull request of Google's site kit WP plugin.
@kazazor Correct, Travis added a workable 7.4
image last week.
Thanks @jrfnl ! Would be great to have the ability to check for php 7.4 on my website (https://tachlescalcala.com/) once this will be merged :)
@kazazor Well, you already can using the underlying software: https://github.com/PHPCompatibility/PHPCompatibilityWP
@jrfnl well I'm using this plugin but it does not currently have 7.4 option in it. This is how I ended up in this PR :) It points here
@kazazor I understand. I just meant to point out that this plugin is a wrapper around other software and that that original software already has the PHP 7.4 checks in place.
@anthonyburchell Thanks. I've removed the rest of the 7.4snapshot references and updated the 7.4 multisite test to use WP 5.3. We'll see how that goes. My suspicion is that the problem is actually a problem between the version of PHP CodeSniffer we're using and PHP 7.4. Going to try to play with that a bit tonight to confirm.
FYI:
- Correct: WP itself wasn't fully compatible with PHP 7.4 until WP 5.3.
- PHPCS is compatible with PHP 7.4 as of version 3.5.0.
Also: PHPCompatibility 9.3.5 has been released in the mean time, as well as version 0.6.2
of the dealerdirect/phpcodesniffer-composer-installer
package (needs a change in the composer.json
as Composer treats minors < 1.0.0 as majors).
Thanks @jrfnl ! @shawnhooper thanks for those updates! We're getting closer! I'm seeing that sniffs are failing and my best guess is that given the info in the comment above, the php_codesniffer package should be changed to 3.5.0
.
It probably wouldn't hurt to change phpcodesniffer-composer-installer to 0.6.2
as well as they are likely very compatible with each other. :)
I believe we'll need an updated composer.lock as well after these changes. With those changes, I believe we'll be passing all tests and ready to merge.
@anthonyburchell Right now we're on PHP CodeSniffer 2.9.2, which is the last version of the 2.x branch. Support for PHP 7.4 was introduced in PHPCodeSniffer 3.5.0.
The upgrade from PHPCS 2.x to 3.x has breaking changes, including that the PHP_CodeSniffer_CLI class no longer exists. It looks like we have to use the new \PHP_CodeSniffer\Runner() class instead. Haven't got that working yet (this isn't a documented use, so it's reading through the PHPCS code to trying things)
Yeah looks like it does need to use the runner class. I found this gist that shows how they are structured now if that's helpful: https://gist.github.com/gsherwood/aafd2c16631a8a872f0c4a23916962ac
Hello, any updates on this? since 1 year already from the initial commit, 8.0 already released but we still waiting for 7.4 support. Could you prioritize this please?