Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions PHPCompatibilityWP/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@
* str_starts_with(): since WP 5.9.0
* str_ends_with(): since WP 5.9.0
* array_is_list(): since WP 6.5.0
* IMAGETYPE_AVIF and IMG_AVIF: since WP 6.5.0
* array_find(): since WP 6.8.0
* array_find_key(): since WP 6.8.0
* array_any(): since WP 6.8.0
* array_all(): since WP 6.8.0
* array_first(): since WP 6.9.0
* array_last(): since WP 6.9.0
* IMAGETYPE_HEIF: since WP 6.9.0
-->
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.hash_hmacFound"/>
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.json_encodeFound"/>
Expand All @@ -55,6 +63,15 @@
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.str_starts_withFound"/>
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.str_ends_withFound"/>
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.array_is_listFound"/>
<exclude name="PHPCompatibility.Constants.NewConstants.imagetype_avifFound"/>
<exclude name="PHPCompatibility.Constants.NewConstants.img_avifFound"/>
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.array_findFound"/>
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.array_find_keyFound"/>
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.array_anyFound"/>
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.array_allFound"/>
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.array_firstFound"/>
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.array_lastFound"/>
<exclude name="PHPCompatibility.Constants.NewConstants.imagetype_heifFound"/>

<!--
Contained in /wp-includes/spl-autoload-compat.php.
Expand Down
12 changes: 12 additions & 0 deletions Test/WPTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,15 @@ class ABC implements JsonSerializable {}
echo IMAGETYPE_WEBP, IMG_WEBP;

if (array_is_list($array)) {}

echo IMAGETYPE_AVIF, IMG_AVIF;

$first_match = array_find( $array, $callback );
$first_match_key = array_find_key( $array, $callback );
if ( array_any( $array, $callback ) ) {}
if ( array_all( $array, $callback ) ) {}

$first_element = array_first( $array );
$last_element = array_last( $array );

echo IMAGETYPE_HEIF;