Skip to content

Commit f79f7ee

Browse files
committed
Ruleset: document which WP versions contain which polyfill
WP 5.3 will drop a number of polyfills. To allow this ruleset to still be used by projects supporting older WP versions as well as newer WP versions, they will - for now - not be removed from the ruleset. However, documenting what WP version introduced certain polyfills and where applicable in what version of WP they were removed, seems prudent. Note: the JSON related polyfills will most likely also be removed in WP 5.3, but those changes haven't been committed yet.
1 parent f52e64f commit f79f7ee

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

PHPCompatibilityWP/ruleset.xml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,20 @@
1313
-->
1414

1515
<rule ref="PHPCompatibility">
16-
<!-- Contained in /wp-includes/compat.php. -->
16+
<!--
17+
Contained in /wp-includes/compat.php.
18+
19+
History of the polyfills in WP:
20+
* hash_hmac(): since WP 3.2.0.
21+
* json_encode() and json_decode(): since unknown.
22+
* hash_equals(): since WP 3.9.2.
23+
* JSON_PRETTY_PRINT: since WP 4.1.0.
24+
* json_last_error_msg(): since WP 4.4.0.
25+
* JsonSerializable: since WP 4.4.0.
26+
* array_replace_recursive(): since WP 4.5.3 up to 5.2.x. The polyfill was removed in WP 5.3.
27+
* is_iterable(): since WP 4.9.6
28+
* is_countable(): since WP 4.9.6
29+
-->
1730
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.hash_hmacFound"/>
1831
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.json_encodeFound"/>
1932
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.json_decodeFound"/>
@@ -25,7 +38,13 @@
2538
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.is_iterableFound"/>
2639
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.is_countableFound"/>
2740

28-
<!-- Contained in /wp-includes/spl-autoload-compat.php. -->
41+
<!--
42+
Contained in /wp-includes/spl-autoload-compat.php.
43+
44+
History of the polyfills in WP:
45+
* spl_autoload_register(), spl_autoload_unregister() and spl_autoload_functions() were
46+
introduced in WP 4.6.0 and available up to WP 5.2.x. The polyfills were removed in WP 5.3.
47+
-->
2948
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.spl_autoload_registerFound"/>
3049
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.spl_autoload_unregisterFound"/>
3150
<exclude name="PHPCompatibility.FunctionUse.NewFunctions.spl_autoload_functionsFound"/>

0 commit comments

Comments
 (0)