A set of sniffs for PHP_CodeSniffer that checks PHP code for cross-version compatibility.
PHPCompatibility is a coding standard for PHP_CodeSniffer that analyzes PHP code for compatibility across different PHP versions. It helps developers ensure their code works correctly when migrating between PHP versions, preventing issues in production environments.
PHP developers and teams maintaining or upgrading PHP applications, especially those working with legacy codebases or needing to support multiple PHP versions.
Developers choose PHPCompatibility for its comprehensive detection of compatibility issues across PHP versions (from 5.0 to latest), consistent results regardless of the PHP runtime version, and framework-specific rulesets for ecosystems like WordPress and Joomla.
PHP Compatibility check for PHP_CodeSniffer
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Detects compatibility issues from PHP 5.0 to the latest releases, as the README states it aims to cover all changes since PHP 5.0, facilitating smooth upgrades.
Supports checking against specific versions, ranges, or open-ended ranges (e.g., 7.0-) via the --runtime-set testVersion parameter, allowing precise analysis.
Includes dedicated rulesets for ecosystems like WordPress, Joomla, and polyfill libraries, enhancing relevance for specific projects as listed in the README.
Designed to provide consistent results regardless of the PHP version used to run PHP_CodeSniffer, ensuring reliable analysis in any environment.
Requires PHP_CodeSniffer 4.0.1+ and Composer for installation, adding complexity and potentially conflicting with existing linting workflows.
The README admits coverage is not 100%, especially for pre-PHP 5.1 changes, which may miss edge cases in legacy code.
Version 10.0.0 dropped support for older PHP and PHP_CodeSniffer versions, necessitating careful upgrades and potentially breaking existing setups.