wpcompatibility/wp-compatibility

WPCompatibility has a collection of PHPCS sniffs which will tell you if your plugin/theme code is compatible with a specific wordpress version

Installs: 2

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 1

Forks: 0

Open Issues: 0

Type:phpcodesniffer-standard

0.0.3 2024-06-01 04:42 UTC

This package is auto-updated.

Last update: 2024-06-04 01:52:30 UTC


README

wpcompatibility is a collection of PHP_CodeSniffer (PHPCS) sniffs designed to check if your WordPress plugin/theme code is compatible with specific WordPress versions.

Table of Contents

Installation:

composer require wpcompatibility/wp-compatibility 

Usage:

Command

# For single wp version
WP_COMPAT_PHPCS_SUPPORTED_VERSIONS='5.0.0' vendor/bin/phpcs --standard=WPCompatibility your-plugin-or-theme-folder/

# To test against multiple wp versions you can separate versions by comma
WP_COMPAT_PHPCS_SUPPORTED_VERSIONS='5.0.1,6.0' vendor/bin/phpcs --standard=WPCompatibility your-plugin-or-theme-folder/

Ruleset File

<rule ref="WPCompatibility.Signature.Function">
    <properties>
        <property name="versions" value="4.3,6.1" />
    </properties>
</rule>

Functions

  • Detect if a wordpress function is present in specific version. For example if you have a plugin file with the below code which is set to be compatible with 5.0, this will throw an error
<?php wp_date(); ?>
Function: wp_date is not available in wordpress version 5.0.0
  • Verify wordpress function signature, if you pass less number of arguments to a wordpress function then it will raise an error.

Buy me a coffee ☕

F_TwK0vbIAAShWP