[wp-trac] [WordPress Trac] #64238: PHPStan code quality improvements for 7.0

WordPress Trac noreply at wordpress.org
Wed May 13 19:29:46 UTC 2026


#64238: PHPStan code quality improvements for 7.0
--------------------------------------+-------------------------------
 Reporter:  SergeyBiryukov            |       Owner:  (none)
     Type:  task (blessed)            |      Status:  closed
 Priority:  normal                    |   Milestone:  7.0
Component:  General                   |     Version:
 Severity:  normal                    |  Resolution:  fixed
 Keywords:  has-patch has-unit-tests  |     Focuses:  coding-standards
--------------------------------------+-------------------------------

Comment (by westonruter):

 In [changeset:"62359" 62359]:
 {{{
 #!CommitTicketReference repository="" revision="62359"
 Block Supports: Improve performance and hardening of block-level custom
 CSS rendering.

 Short-circuits the custom CSS support filter before the more expensive
 lookups so blocks without custom CSS return faster.

 Replaces the regex class name parsing in
 `wp_render_custom_css_class_name()` with a cheap `str_contains()` guard
 followed by an HTML spec-compliant `strtok()` walk over the className
 tokens. This avoids the regex engine for the common case where no `wp-
 custom-css-` class is present, and correctly handles tab/form-feed/CR/LF
 separators as well as classes such as `my-wp-custom-css-*` that merely
 contain the prefix as a substring after a hyphen.

 Also hardens both functions against malformed parsed blocks (non-string
 `className`, missing keys), tightens `@phpstan-param` array shapes, and
 corrects the `block_has_support()` `@param` to allow `WP_Block_Type|null`.
 Lastly, a `@return Generator<int, non-empty-string>` phpdoc tag is added
 to `WP_HTML_Tag_Processor::class_list()`.

 Developed in https://github.com/WordPress/wordpress-develop/pull/11686 and
 https://github.com/WordPress/gutenberg/pull/78217

 Follow-up to r61678.

 Props mukesh27, westonruter, ramonopoly, jonsurrell.
 See #64544, #64238.
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/64238#comment:127>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list