From cff118cd8cd8d64f206aead43e6d794016f064aa Mon Sep 17 00:00:00 2001 From: jrfnl Date: Wed, 29 Dec 2021 20:44:22 +0100 Subject: [PATCH] WP 5.9: account for new function polyfills WP 5.9 contains polyfills for five new PHP native functions: * `array_key_first()` and `array_key_last()`, which were both introduced in PHP 7.3. * `str_contains()`, `str_starts_with()` and `str_ends_with()`, which were introduced in PHP 8.0. While the PHP 8.0 functions are not yet flagged by the latest release of PHPCompatibility, they will be once PHPCompatibility 10.0 comes out. As `exclude`-ing error codes which don't exist yet does not lead to errors in PHPCS, we may as well add the exclusions for all WP 5.9 polyfills in one go. Refs: * https://core.trac.wordpress.org/changeset/52038 * https://core.trac.wordpress.org/changeset/52039 * https://core.trac.wordpress.org/changeset/52040 * https://core.trac.wordpress.org/browser/trunk/src/wp-includes/compat.php#L398-L479 --- PHPCompatibilityWP/ruleset.xml | 10 ++++++++++ Test/WPTest.php | 7 +++++++ 2 files changed, 17 insertions(+) diff --git a/PHPCompatibilityWP/ruleset.xml b/PHPCompatibilityWP/ruleset.xml index b451c71..4d92d8b 100644 --- a/PHPCompatibilityWP/ruleset.xml +++ b/PHPCompatibilityWP/ruleset.xml @@ -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 --> @@ -40,6 +45,11 @@ + + + + +