[wp-trac] [WordPress Trac] #56791: Coding Standards fixes for WP 6.2
WordPress Trac
noreply at wordpress.org
Wed Jan 25 01:39:15 UTC 2023
#56791: Coding Standards fixes for WP 6.2
----------------------------+-------------------------------
Reporter: desrosj | Owner: (none)
Type: task (blessed) | Status: new
Priority: normal | Milestone: 6.2
Component: General | Version:
Severity: normal | Resolution:
Keywords: has-patch | Focuses: coding-standards
----------------------------+-------------------------------
Comment (by SergeyBiryukov):
In [changeset:"55136" 55136]:
{{{
#!CommitTicketReference repository="" revision="55136"
Coding Standards: Allow some parameters with reserved keywords in `wp-
includes/compat.php`.
Parameter names for PHP polyfills in WordPress core need to 100% match the
native PHP parameter names. Otherwise using named parameters with those
functions could cause fatal errors for installations where the polyfills
kick in.
This commit adds inline comments instructing PHPCS to ignore parameters
with reserved keywords in the affected functions that should not be
renamed:
* `$string` parameter in `mb_substr()` and `mb_strlen()`
* `$array` parameter in `array_key_first()` and `array_key_last()`
This resolves a few WPCS warnings along the lines of:
{{{
It is recommended not to use reserved keyword "string" as function
parameter name. Found: $string
}}}
Follow-up to [7140], [10707], [17603], [17621], [32114], [52038], [53365].
Props jrf.
See #56788, #56791.
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/56791#comment:35>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list