Skip to content

Commit

Permalink
Merge pull request #35 from PHPCompatibility/feature/update-for-wp-5.9
Browse files Browse the repository at this point in the history
WP 5.9: account for new function polyfills
  • Loading branch information
wimg authored Dec 30, 2021
2 parents ab5a0e6 + cff118c commit d752c8a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
10 changes: 10 additions & 0 deletions PHPCompatibilityWP/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@
* is_iterable(): since WP 4.9.6
* is_countable(): since WP 4.9.6
* IMAGETYPE_WEBP and IMG_WEBP: since WP 5.8.0.
* array_key_first(): since WP 5.9.0
* array_key_last(): since WP 5.9.0
* str_contains(): since WP 5.9.0
* str_starts_with(): since WP 5.9.0
* str_ends_with(): since WP 5.9.0
-->
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.hash_hmacFound"/>
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.json_encodeFound"/>
Expand All @@ -40,6 +45,11 @@
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.is_countableFound"/>
<exclude name="PHPCompatibility.Constants.NewConstants.imagetype_webpFound"/>
<exclude name="PHPCompatibility.Constants.NewConstants.img_webpFound"/>
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.array_key_firstFound"/>
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.array_key_lastFound"/>
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.str_containsFound"/>
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.str_starts_withFound"/>
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.str_ends_withFound"/>

<!--
Contained in /wp-includes/spl-autoload-compat.php.
Expand Down
7 changes: 7 additions & 0 deletions Test/WPTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,11 @@ class ABC implements JsonSerializable {}

$a = mysql_to_rfc3339();

if (array_key_first($array)
|| array_key_last($array)) {}

$a = str_contains($haystack, $needle);
$a = str_starts_with( $haystack, $needle );
$a = str_ends_with( $haystack, $needle );

echo IMAGETYPE_WEBP, IMG_WEBP;

0 comments on commit d752c8a

Please sign in to comment.