|
| 1 | +<?xml version="1.0"?> |
| 2 | +<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="PHPCompatibilityWP" xsi:noNamespaceSchemaLocation="https://schema.phpcodesniffer.com/phpcs.xsd"> |
| 3 | + |
| 4 | + <description>WordPress specific ruleset which checks for PHP cross version compatibility.</description> |
| 5 | + <!-- Once PHPCompatibility/PHPCompatibilityWP supports the targeted versions of PHP, this config file can be updated accordingly. --> |
| 6 | + |
| 7 | + <!-- Test PHP 7.4 thru 8.4 --> |
| 8 | + <config name="testVersion" value="7.4-8.4"/> |
| 9 | + <file>.</file> |
| 10 | + <arg name="extensions" value="php,inc" /> |
| 11 | + |
| 12 | + <rule ref="PHPCompatibility"> |
| 13 | + <!-- |
| 14 | + Contained in /wp-includes/compat.php. |
| 15 | +
|
| 16 | + History of the polyfills in WP: |
| 17 | + * hash_hmac(): since WP 3.2.0. |
| 18 | + * json_encode() and json_decode(): since unknown. |
| 19 | + * hash_equals(): since WP 3.9.2. |
| 20 | + * JSON_PRETTY_PRINT: since WP 4.1.0. |
| 21 | + * json_last_error_msg(): since WP 4.4.0. |
| 22 | + * JsonSerializable: since WP 4.4.0. |
| 23 | + * array_replace_recursive(): since WP 4.5.3 up to 5.2.x. The polyfill was removed in WP 5.3. |
| 24 | + * is_iterable(): since WP 4.9.6 |
| 25 | + * is_countable(): since WP 4.9.6 |
| 26 | + * IMAGETYPE_WEBP and IMG_WEBP: since WP 5.8.0. |
| 27 | + * array_key_first(): since WP 5.9.0 |
| 28 | + * array_key_last(): since WP 5.9.0 |
| 29 | + * str_contains(): since WP 5.9.0 |
| 30 | + * str_starts_with(): since WP 5.9.0 |
| 31 | + * str_ends_with(): since WP 5.9.0 |
| 32 | + * array_is_list(): since WP 6.5.0 |
| 33 | + --> |
| 34 | + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.hash_hmacFound"/> |
| 35 | + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.json_encodeFound"/> |
| 36 | + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.json_decodeFound"/> |
| 37 | + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.hash_equalsFound"/> |
| 38 | + <exclude name="PHPCompatibility.Constants.NewConstants.json_pretty_printFound"/> |
| 39 | + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.json_last_error_msgFound"/> |
| 40 | + <exclude name="PHPCompatibility.Interfaces.NewInterfaces.jsonserializableFound"/> |
| 41 | + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.array_replace_recursiveFound"/> |
| 42 | + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.is_iterableFound"/> |
| 43 | + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.is_countableFound"/> |
| 44 | + <exclude name="PHPCompatibility.Constants.NewConstants.imagetype_webpFound"/> |
| 45 | + <exclude name="PHPCompatibility.Constants.NewConstants.img_webpFound"/> |
| 46 | + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.array_key_firstFound"/> |
| 47 | + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.array_key_lastFound"/> |
| 48 | + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.str_containsFound"/> |
| 49 | + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.str_starts_withFound"/> |
| 50 | + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.str_ends_withFound"/> |
| 51 | + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.array_is_listFound"/> |
| 52 | + |
| 53 | + <!-- |
| 54 | + Contained in /wp-includes/spl-autoload-compat.php. |
| 55 | +
|
| 56 | + History of the polyfills in WP: |
| 57 | + * spl_autoload_register(), spl_autoload_unregister() and spl_autoload_functions() were |
| 58 | + introduced in WP 4.6.0 and available up to WP 5.2.x. The polyfills were removed in WP 5.3. |
| 59 | + --> |
| 60 | + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.spl_autoload_registerFound"/> |
| 61 | + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.spl_autoload_unregisterFound"/> |
| 62 | + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.spl_autoload_functionsFound"/> |
| 63 | + </rule> |
| 64 | + |
| 65 | +</ruleset> |
0 commit comments