Skip to content

Commit d752c8a

Browse files
authored
Merge pull request #35 from PHPCompatibility/feature/update-for-wp-5.9
WP 5.9: account for new function polyfills
2 parents ab5a0e6 + cff118c commit d752c8a

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

PHPCompatibilityWP/ruleset.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@
2727
* is_iterable(): since WP 4.9.6
2828
* is_countable(): since WP 4.9.6
2929
* IMAGETYPE_WEBP and IMG_WEBP: since WP 5.8.0.
30+
* array_key_first(): since WP 5.9.0
31+
* array_key_last(): since WP 5.9.0
32+
* str_contains(): since WP 5.9.0
33+
* str_starts_with(): since WP 5.9.0
34+
* str_ends_with(): since WP 5.9.0
3035
-->
3136
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.hash_hmacFound"/>
3237
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.json_encodeFound"/>
@@ -40,6 +45,11 @@
4045
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.is_countableFound"/>
4146
<exclude name="PHPCompatibility.Constants.NewConstants.imagetype_webpFound"/>
4247
<exclude name="PHPCompatibility.Constants.NewConstants.img_webpFound"/>
48+
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.array_key_firstFound"/>
49+
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.array_key_lastFound"/>
50+
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.str_containsFound"/>
51+
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.str_starts_withFound"/>
52+
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.str_ends_withFound"/>
4353

4454
<!--
4555
Contained in /wp-includes/spl-autoload-compat.php.

Test/WPTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,11 @@ class ABC implements JsonSerializable {}
2525

2626
$a = mysql_to_rfc3339();
2727

28+
if (array_key_first($array)
29+
|| array_key_last($array)) {}
30+
31+
$a = str_contains($haystack, $needle);
32+
$a = str_starts_with( $haystack, $needle );
33+
$a = str_ends_with( $haystack, $needle );
34+
2835
echo IMAGETYPE_WEBP, IMG_WEBP;

0 commit comments

Comments
 (0)