Build/Tools: Update PHPCompatibilityWP to 3.0.0-alpha2#11217
Build/Tools: Update PHPCompatibilityWP to 3.0.0-alpha2#11217rodrigoprimo wants to merge 5 commits intoWordPress:trunkfrom
Conversation
Update the PHPCompatibilityWP dependency from `~2.1.3` to `3.0.0-alpha2`. This brings in PHPCompatibility 10.0.0-alpha2 which adds sniffs for PHP 8.0 through 8.5. PHPCompatibilityWP's own dependencies (PHPCompatibility and PHPCompatibilityParagonie) are explicitly pinned in `require-dev` to allow Composer to install the alpha versions without needing to set `minimum-stability` to `dev` for the entire project. Ref: https://github.com/PHPCompatibility/PHPCompatibilityWP/releases/tag/3.0.0-alpha2
…ty v10. PHPCompatibility v10 adds data about functions, constants, and ini directives that were removed in PHP 8+. Those that were previously only known to be deprecated now correctly show as both deprecated and removed, which changes the error code from `*Deprecated` to `*DeprecatedRemoved`. Update the existing exclusion rules to match.
…y v10. Remove the workaround for PHPCompatibility/PHPCompatibility 1481, which is fixed in v10. Add a rule-level exclusion for: - NewAttributes.PHPNativeAttributeFound: the `#[\SensitiveParameter]` attribute is used intentionally. See https://core.trac.wordpress.org/ticket/57304. Add file-level exclusions for violations in third-party bundled libraries. I'm assuming file-level exclusions are preferred over inline `phpcs:ignore` annotations for third-party bundled libraries based on https://core.trac.wordpress.org/ticket/63168#comment:16. - SimplePie: `strftime`, `RemovedCallingDestructAfterConstructorExit`, `curl_close`, `xml_parser_free`. - getID3: `libxml_disable_entity_loader`. - Snoopy: `socket_set_timeout` (not maintained and deprecated since WP 3.0). - PHP AI Client (Nyholm/Psr7): `RemovedTriggerErrorLevel` (version-guarded, unreachable on PHP 7.4+).
…ity v10. Update existing annotations where error codes changed in v10: - `mbstring_func_overloadDeprecated` to `mbstring_func_overloadDeprecatedRemoved` in `functions.php` and `pomo/streams.php`. Add new phpcs:ignore annotations for violations surfaced by the updated sniffs: - Version-guarded deprecated no-op calls: curl_close, imagedestroy, finfo_close, xml_parser_free, libxml_disable_entity_loader. - function_exists/defined-guarded new function and constant usage: imageavif, imagecreatefromavif, IMG_WEBP_LOSSLESS. - Deprecated ini directive `auto_detect_line_endings` in pomo/po.php (kept intentionally, see comment in the file).
…tickets. - Exclude NewHTMLEntitiesFlagsDefault.NotSet while waiting for https://core.trac.wordpress.org/ticket/53465. - Add phpcs:ignore annotations for utf8_encode in export.php and image.php (https://core.trac.wordpress.org/ticket/55603). This is just a temporary commit for the build to pass. The plan is to wait for a decision on https://core.trac.wordpress.org/ticket/53465 and https://core.trac.wordpress.org/ticket/55603 before updating PHPCompatibilityWP.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
This PR updates the PHPCompatibilityWP Composer dependency from ~2.1.3 to 3.0.0-alpha2 (which includes PHPCompatibility 10.0.0-alpha2) and addresses the new violations surfaced by the updated sniffs.
Changes are split into separate commits for easier review:
composer.jsonchanges with explicit version pins forphpcompatibility/php-compatibility-wp,phpcompatibility/php-compatibilityandphpcompatibility/phpcompatibility-paragonie.phpcompat.xml.disterror codes: PHPCompatibility v10 adds removal data for functions/constants/directives removed in PHP 8+, changing their error codes from*Deprecatedto*DeprecatedRemoved. Update the existing exclusion rules to match.phpcompat.xml.distexclusions: Add file-level exclusions for third-party bundled libraries (SimplePie, getID3, Snoopy, PHP AI Client) following the approach used in https://core.trac.wordpress.org/ticket/63168#comment:16. Also add a rule-level exclusion for the intentional use of#[\SensitiveParameter](https://core.trac.wordpress.org/ticket/57304) and remove the workaround for PHPCompatibility#1481.phpcs:ignoreannotations: Add or update annotations in WordPress Core files for version-guarded deprecated function calls andfunction_exists/defined-guarded new function usage.NewHTMLEntitiesFlagsDefault.NotSet(waiting for https://core.trac.wordpress.org/ticket/53465) and addsphpcs:ignoreannotations forutf8_encode(https://core.trac.wordpress.org/ticket/55603). This commit should not be merged as-is; the plan is to wait for a decision on https://core.trac.wordpress.org/ticket/53465 and https://core.trac.wordpress.org/ticket/55603 before updating PHPCompatibilityWP.Trac ticket: https://core.trac.wordpress.org/ticket/64634
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.