Skip to content

Commit 31330ad

Browse files
committed
CS: start using PHPCompatibility 10
Long anticipated, finally here: PHPCompatibility 10.0.0-alpha1/alpha2 🎉 PHPCompatibility 10.0.0 brings huge improvements in both what is being detected (> 50 new sniffs), as well as the detection accuracy for pre-existing sniffs. Even though still "unstable", it is stable enough for our purposes and the advantages of using it outweigh the disadvantage of it being an unstable version. By setting the `minimum-stability` and `prefer-stable` settings in the `composer.json`, we can ensure that we don't get the `dev-develop` branch, but rather get a `10.0.0` tag, unstable or not. And what with the improved detection, a number of php incompatibilities previously not flagged, are now flagged, even though we already handle them correctly via conditions. So this commit also adds a few selective ignore comments for those few situations where they are needed. Includes adding one ignore annotation. Ref: * https://github.com/PHPCompatibility/PHPCompatibility/wiki/Upgrading-to-PHPCompatibility-10.0 * https://github.com/PHPCompatibility/PHPCompatibility/releases/tag/10.0.0-alpha1 * https://github.com/PHPCompatibility/PHPCompatibility/releases/tag/10.0.0-alpha2
1 parent 1f17809 commit 31330ad

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@
3333
},
3434
"require-dev": {
3535
"phpunit/phpunit": "^8.5.52 || ^9.6.34",
36-
"phpcompatibility/php-compatibility": "^9.3.0",
37-
"dealerdirect/phpcodesniffer-composer-installer": "^1.0.0"
36+
"phpcompatibility/php-compatibility": "^10.0.0@alpha"
3837
},
3938
"autoload": {
4039
"psr-4": {

tests/cases/unit/Api/FunctionsTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,7 @@ public function testStubsEscapeFunctionsNoUrlNoSql()
363363
Functions\stubEscapeFunctions();
364364

365365
$lorem = '<b>Lorem ipsum</b>';
366+
// phpcs:ignore PHPCompatibility.ParameterValues.NewHTMLEntitiesFlagsDefault.NotSet -- This is deliberate as WP doesn't set the parameter.
366367
$escaped = htmlspecialchars($lorem);
367368

368369
static::assertSame($escaped, esc_html($lorem));

0 commit comments

Comments
 (0)