site-kit-wp
site-kit-wp copied to clipboard
Upgrade PHPCS standards
Feature Description
In order to support compatibility with newer versions of PHP, we need to upgrade some of our tooling for compatibility, such as PHPCS.
WPCS recently released a long-awaited major release (v3) which adds needed compatibility with PHP 8.
Similarly, the WP VIP coding standards automattic/vipwpcs also released a new matching major version.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
wp-coding-standards/wpcsandautomattic/vipwpcsshould be upgraded to their latest versions- The PHPCS configuration should be updated as necessary to preserve compatibility with our current rules
- Simple fixes that can be applied automatically by PHPCS should be included
- anything requiring substantial manual updating/review should be excluded temporarily and a follow-up issue opened to address
Implementation Brief
- Update
wp-coding-standards/wpcsandautomattic/vipwpcsto^3incomposer.jsonand upgrade these with Composer to install the latest (including their dependencies) - This issue is largely about applying automatic fixes working through the failures raised and updating configuration as necessary
- E.g. The WP core rule
WordPress.PHP.DisallowShortTernaryno longer exists and has been replaced by theUniversal.Operators.DisallowShortTernaryrule, so some reworking of the PHPCS configuration file is needed. This isn't very intuitive and can result in many more errors raised if done incorrectly.
- E.g. The WP core rule
Test Coverage
- No changes in coverage
QA Brief
No QA needed as this is purely a code style/formatting change.
Changelog entry
- N/A
@aaemnnosttv I hope https://github.com/google/site-kit-wp/pull/8757 is helpful. I haven't addressed any errors aside from updating the obsolete sniff names. Please feel free to decide which sniffs you want to run on this code (report summary added in the PR description), and I can take care of the remaining fixes.
IB ✔️
Moving directly to Approval since no QA is needed for this one 🙂