|
| 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 | + PHPCompatibilityParagonieRandomCompat prevents false positives in `random_compat`. |
| 45 | + However, because these files are included in a non-standard path, false positives are triggered in WordPress Core. |
| 46 | + --> |
| 47 | + <rule ref="PHPCompatibility.IniDirectives.RemovedIniDirectives.mbstring_func_overloadDeprecated"> |
| 48 | + <exclude-pattern>/random_compat/byte_safe_strings\.php$</exclude-pattern> |
| 49 | + </rule> |
| 50 | + <rule ref="PHPCompatibility.Constants.RemovedConstants.mcrypt_dev_urandomDeprecatedRemoved"> |
| 51 | + <exclude-pattern>/random_compat/random_bytes_mcrypt\.php$</exclude-pattern> |
| 52 | + </rule> |
| 53 | + <rule ref="PHPCompatibility.Extensions.RemovedExtensions.mcryptDeprecatedRemoved"> |
| 54 | + <exclude-pattern>/random_compat/random_bytes_mcrypt\.php$</exclude-pattern> |
| 55 | + </rule> |
| 56 | + <rule ref="PHPCompatibility.FunctionUse.RemovedFunctions.mcrypt_create_ivDeprecatedRemoved"> |
| 57 | + <exclude-pattern>/random_compat/random_bytes_mcrypt\.php$</exclude-pattern> |
| 58 | + </rule> |
| 59 | + |
| 60 | + <!-- Whitelist the WP DB Class for use of `mysql_` extension in PHP < 7.0. --> |
| 61 | + <rule ref="PHPCompatibility.Extensions.RemovedExtensions"> |
| 62 | + <exclude-pattern>/src/wp-includes/wp-db\.php</exclude-pattern> |
| 63 | + </rule> |
| 64 | +</ruleset> |
0 commit comments