Skip to content

Commit

Permalink
Merge pull request #37 from Yoast/feature/phpcs-fix-phpcompatibility
Browse files Browse the repository at this point in the history
PHPCS: use PHPCompatibility proper, not PHPCompatibilityWP
  • Loading branch information
jrfnl committed Jun 16, 2021
2 parents 985d7a8 + 52adc1d commit 8dedf60
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .phpcs.xml.dist
Expand Up @@ -50,6 +50,14 @@
<exclude name="WordPress.Security"/>
<exclude name="WordPress.WP"/>
<exclude name="Yoast.Yoast.AlternativeFunctions"/>
</rule>

<!-- While PHPCompatibility is already included in the Yoast ruleset, it uses
the PHPCompatibilityWP ruleset, which excludes rules polyfilled by WP.
Setting the severity for all PHPCompatibility rules to 5 prevents WP
polyfilled functionality from not being flagged in this repo. -->
<rule ref="PHPCompatibility">
<severity>5</severity>

<!-- These PHP 7.0+ classes are polyfilled for this repo. -->
<exclude name="PHPCompatibility.Classes.NewClasses.errorFound"/>
Expand Down
2 changes: 2 additions & 0 deletions src/Polyfills/AssertIsType.php
Expand Up @@ -155,6 +155,7 @@ public static function assertIsCallable( $actual, $message = '' ) {
public static function assertIsIterable( $actual, $message = '' ) {
if ( \function_exists( 'is_iterable' ) === true ) {
// PHP >= 7.1.
// phpcs:ignore PHPCompatibility.FunctionUse.NewFunctions.is_iterableFound
static::assertTrue( \is_iterable( $actual ), $message );
}
else {
Expand Down Expand Up @@ -302,6 +303,7 @@ public static function assertIsNotCallable( $actual, $message = '' ) {
public static function assertIsNotIterable( $actual, $message = '' ) {
if ( \function_exists( 'is_iterable' ) === true ) {
// PHP >= 7.1.
// phpcs:ignore PHPCompatibility.FunctionUse.NewFunctions.is_iterableFound
static::assertFalse( \is_iterable( $actual ), $message );
}
else {
Expand Down

0 comments on commit 8dedf60

Please sign in to comment.