| 1 | <?xml version="1.0"?> |
|---|
| 2 | <ruleset name="WordPress PHP Compatibility"> |
|---|
| 3 | <description>Apply PHP compatibility checks to all WordPress Core files</description> |
|---|
| 4 | |
|---|
| 5 | <rule ref="PHPCompatibilityWP"/> |
|---|
| 6 | |
|---|
| 7 | <!-- WordPress Core currently supports PHP 5.6+. --> |
|---|
| 8 | <config name="testVersion" value="5.6-"/> |
|---|
| 9 | |
|---|
| 10 | <!-- Only scan PHP files. --> |
|---|
| 11 | <arg name="extensions" value="php"/> |
|---|
| 12 | |
|---|
| 13 | <!-- Whenever possible, cache the scan results and re-use those for unchanged files on the next scan. --> |
|---|
| 14 | <arg name="cache"/> |
|---|
| 15 | |
|---|
| 16 | <!-- Set the memory limit to 256M. |
|---|
| 17 | For most standard PHP configurations, this means the memory limit will temporarily be raised. |
|---|
| 18 | Ref: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Advanced-Usage#specifying-phpini-settings |
|---|
| 19 | --> |
|---|
| 20 | <ini name="memory_limit" value="256M"/> |
|---|
| 21 | |
|---|
| 22 | <!-- Strip the filepaths down to the relevant bit. --> |
|---|
| 23 | <arg name="basepath" value="./"/> |
|---|
| 24 | |
|---|
| 25 | <!-- Check up to 20 files simultaneously. --> |
|---|
| 26 | <arg name="parallel" value="20"/> |
|---|
| 27 | |
|---|
| 28 | <!-- Show sniff codes in all reports. --> |
|---|
| 29 | <arg value="ps"/> |
|---|
| 30 | |
|---|
| 31 | <!-- For now, only the files in src are scanned. --> |
|---|
| 32 | <file>./src/</file> |
|---|
| 33 | |
|---|
| 34 | <!-- Code which doesn't go into production may have different requirements. --> |
|---|
| 35 | <exclude-pattern>/node_modules/*</exclude-pattern> |
|---|
| 36 | |
|---|
| 37 | <!-- |
|---|
| 38 | Currently, there are no dependencies managed by Composer. |
|---|
| 39 | This will need to be modified when that changes to ensure external packages meet compatibility requirements. |
|---|
| 40 | --> |
|---|
| 41 | <exclude-pattern>/vendor/*</exclude-pattern> |
|---|
| 42 | |
|---|
| 43 | <!-- |
|---|
| 44 | PHPCompatibilityParagonieSodiumCompat prevents false positives in `sodium_compat`. |
|---|
| 45 | However, because these files are included in a non-standard path, false positives are triggered in WordPress Core. |
|---|
| 46 | --> |
|---|
| 47 | <exclude-pattern>src/wp-includes/sodium_compat/lib/php72compat_const\.php$</exclude-pattern> |
|---|
| 48 | |
|---|
| 49 | <rule ref="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_sign_keypair_from_secretkey_and_publickeyFound"> |
|---|
| 50 | <exclude-pattern>/sodium_compat/src/Compat\.php$</exclude-pattern> |
|---|
| 51 | </rule> |
|---|
| 52 | <rule ref="PHPCompatibility.FunctionUse.NewFunctions.sodium_padFound"> |
|---|
| 53 | <exclude-pattern>/sodium_compat/src/Compat\.php$</exclude-pattern> |
|---|
| 54 | </rule> |
|---|
| 55 | <rule ref="PHPCompatibility.FunctionUse.NewFunctions.sodium_unpadFound"> |
|---|
| 56 | <exclude-pattern>/sodium_compat/src/Compat\.php$</exclude-pattern> |
|---|
| 57 | </rule> |
|---|
| 58 | |
|---|
| 59 | <!-- |
|---|
| 60 | PHPCompatibilityParagonieRandomCompat prevents false positives in `random_compat`. |
|---|
| 61 | However, because these files are included in a non-standard path, false positives are triggered in WordPress Core. |
|---|
| 62 | --> |
|---|
| 63 | <rule ref="PHPCompatibility.IniDirectives.RemovedIniDirectives.mbstring_func_overloadDeprecated"> |
|---|
| 64 | <exclude-pattern>/random_compat/byte_safe_strings\.php$</exclude-pattern> |
|---|
| 65 | </rule> |
|---|
| 66 | <rule ref="PHPCompatibility.Constants.RemovedConstants.mcrypt_dev_urandomDeprecatedRemoved"> |
|---|
| 67 | <exclude-pattern>/random_compat/random_bytes_mcrypt\.php$</exclude-pattern> |
|---|
| 68 | </rule> |
|---|
| 69 | <rule ref="PHPCompatibility.Extensions.RemovedExtensions.mcryptDeprecatedRemoved"> |
|---|
| 70 | <exclude-pattern>/random_compat/random_bytes_mcrypt\.php$</exclude-pattern> |
|---|
| 71 | </rule> |
|---|
| 72 | <rule ref="PHPCompatibility.FunctionUse.RemovedFunctions.mcrypt_create_ivDeprecatedRemoved"> |
|---|
| 73 | <exclude-pattern>/random_compat/random_bytes_mcrypt\.php$</exclude-pattern> |
|---|
| 74 | </rule> |
|---|
| 75 | |
|---|
| 76 | <!-- Whitelist the WP DB Class for use of `mysql_` extension in PHP < 7.0. --> |
|---|
| 77 | <rule ref="PHPCompatibility.Extensions.RemovedExtensions.mysql_DeprecatedRemoved"> |
|---|
| 78 | <exclude-pattern>/src/wp-includes/wp-db\.php</exclude-pattern> |
|---|
| 79 | </rule> |
|---|
| 80 | </ruleset> |
|---|