PHPCompatibility / PHPCompatibility

PHP Compatibility check for PHP_CodeSniffer

Home Page:http://techblog.wimgodden.be/tag/codesniffer/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Should I use develop or 9.3.5 sniffs?

MrJnrman opened this issue · comments

First off, thank you @jrfnl and others for the herculean effort that has been put into this project!

I work on the QIT which is a tool that provides managed automated test for WooCommerce extension developers and I think PHPCompatibility tests would be a great addition to to our platform, so I’m reaching out to get thoughts on on a potential approach we’re thinking about taking.

Since there’s an effort underway to bring in support for PHP 8 code, I’m considering whether I should use PHPCompatibility’s latest release, 9.3.5, or if I should use the develop branch.

I like the idea of using develop for two reasons:

  • To avoid false-positives when scanning PHP 8 syntax, such as Enums, etc.
  • To flag the usage of PHP 8 syntax in plugins that should also support PHP 7

I’ve been considering two possibilities:

  1. Use the develop branch and lock the scans to PHP 7.4 or lower, just to leverage the updated sniffs that can parse PHP 8 and avoid false positives.
  2. Or I allow devs to set the scan for any PHP version, including 8.0/8.1/8.2 as their target maximum version.

I’ve seen the issues for adding support for PHP 8.0/8.1/8.2, and I see that a lot of work has been done on these versions. My question is, do you think I could use the PHP 8+ sniffs, or should I limit it to PHP 7.4?

My question is, do you think I could use the PHP 8+ sniffs, or should I limit it to PHP 7.4?

PHPCompatibility develop is perfectly stable, but not all sniffs have been updated yet for PHP 8.0+ syntaxes, so you might see false positives/negatives due to that. About 50% of them have been updated so far.
If you find false positives/negatives, please do report them as it will help us to make sure those issues will be addressed before the 10.0 release.

The new sniffs checking for PHP 8.x issues are, generally speaking, not afflicted in the same way as most of those were written when there was awareness of the new syntaxes coming in.

Does that answer your question ?

P.S.: as your project appears to be in the WP-sphere, you may want to consider using PHPCompatibilityWP (in combination with PHPCompatibility develop as 9.9.99)

@MrJnrman Did the above answer your question sufficiently ?

Yes it does! We will be going forward with the develop branch paired with PHPCompatibilityWP. We will also ensure to report any false positives and encourage our users to do the same.

Thanks for the quick turnaround on this!

Glad to hear it. I'll close this issue in that case.