[wp-trac] [WordPress Trac] #43150: Update Emoji build step to follow WP Coding Standards.
WordPress Trac
noreply at wordpress.org
Wed Jan 24 23:27:49 UTC 2018
#43150: Update Emoji build step to follow WP Coding Standards.
------------------------------+-------------------------------
Reporter: peterwilsoncc | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 5.0
Component: Build/Test Tools | Version:
Severity: normal | Resolution:
Keywords: has-patch | Focuses: coding-standards
------------------------------+-------------------------------
Comment (by netweb):
Replying to [comment:6 jrf]:
> @netweb FYI, you can combine several disables in one command, so the
comment block above the arrays could look like this:
>
> {{{#!php
> <?php
> /*
> * Don't format the array across 4000 lines.
> * phpcs:disable
WordPress.Arrays.ArrayDeclarationSpacing.ArrayItemNoNewLine,WordPress.Arrays.CommaAfterArrayItem.NoSpaceAfterComma
> *
> * N.B.: Do not remove the START/END comments - they're used to
find where to insert the arrays.
> */
> }}}
Neat, thanks @jrf, I went searching the PHPCS docs to find some
documentation or examples of multiline `phpcs:disable` and didn't find
any, this is much neater and will keep this in mind for the future +1
> As a side-note: as this is a non-keyed array, as far as I can see, WPCS
wouldn't be throwing the
`WordPress.Arrays.ArrayDeclarationSpacing.ArrayItemNoNewLine` error if the
array was passed like `array(....)` (no new line after opening bracket or
before closing bracket).
> The line is going to be ridiculously long anyway, so why have those two
new lines ?
>
> Similarly, as the line is so long, why not have the comma's after each
array item ?
>
> Having said that, you may not need to use the `phpcs:disable` comments
at all to still comply with the standards.
Patch [attachment:43150.3.diff] implements @jrf's approach above, no
`phpcs:disable` comments are required in `src/wp-includes/formatting.php`
and is now formatted as:
{{{#!php
<?php
function _wp_emoji_list( $type = 'entities' ) {
// Do not remove the START/END comments - they're used to find
where to insert the arrays.
// START: emoji arrays
$entities = array(
'👩‍❤️‍💋‍👩',
'👩‍❤️‍💋‍👨',
'👨 ...
$partials = array( '🀄', '🃏', '🅰',
'🅱', '🅾', '🅿', '🆎', '🆑',
'🆒', '🆓', '🆔', '🆕', '...
// END: emoji arrays
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/43150#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list