[wp-trac] [WordPress Trac] #59650: Coding Standards fixes for WP 6.5
WordPress Trac
noreply at wordpress.org
Sat Nov 4 00:24:48 UTC 2023
#59650: Coding Standards fixes for WP 6.5
----------------------------+-------------------------------
Reporter: hellofromTonya | Owner: (none)
Type: task (blessed) | Status: new
Priority: normal | Milestone: 6.5
Component: General | Version:
Severity: normal | Resolution:
Keywords: has-patch | Focuses: coding-standards
----------------------------+-------------------------------
Comment (by SergeyBiryukov):
In [changeset:"57061" 57061]:
{{{
#!CommitTicketReference repository="" revision="57061"
Coding Standards: Remove unnecessary ignore annotations in `dbDelta()`.
It is perfectly possible to write a commented regex with layout for
readability by using the `x` modifier.
As per the manual:
> x (`PCRE_EXTENDED`)
>
> If this modifier is set, whitespace data characters in the pattern are
totally ignored except when escaped or inside a character class, and
characters between an unescaped # outside a character class and the next
newline character, inclusive, are also ignored. This is equivalent to
Perl's /x modifier, and makes it possible to include commentary inside
complicated patterns.
>
> Note, however, that this applies only to data characters. Whitespace
characters may never appear within special character sequences in a
pattern, for example within the sequence (?( which introduces a
conditional subpattern.
Reference:
[https://www.php.net/manual/en/reference.pcre.pattern.modifiers.php PHP
Manual: Pattern Modifiers].
This commit rewrites these two regexes to use the `x` modifier and gets
rid of the unnecessary `phpcs:disable` comments.
The tests in the `tests/phpunit/tests/db/dbDelta.php` file cover this
change.
Follow-up to [42249].
Props jrf.
See #59650.
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/59650#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list