Opened 5 weeks ago
Closed 5 weeks ago
#66162 closed enhancement (fixed)
Code Quality: Fix redundant null coalescing in block style variation
| Reported by: | arshidkv12 | Owned by: | westonruter |
|---|---|---|---|
| Priority: | normal | Milestone: | 7.2 |
| Component: | General | Version: | |
| Severity: | normal | Keywords: | has-patch commit |
| Cc: | Focuses: |
Description (last modified by )
This change removes the redundant null coalescing operator from wp_get_block_style_variation_name_from_class() in src/wp-includes/block-supports/block-style-variations.php.
The preg_match_all() always initializes $matches[1] as an array, even when no matches are found, so ?? null is unnecessary. The corresponding PHPStan baseline entry is also removed.
Change History (7)
This ticket was mentioned in PR #13673 on WordPress/wordpress-develop by @arshidkv12.
5 weeks ago
#1
- Keywords has-patch has-unit-tests added
@arshidkv12 commented on PR #13673:
5 weeks ago
#4
Thanks @arshidkv12 for the PR!
You are welcome
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
This change removes the redundant null coalescing operator from
wp_get_block_style_variation_name_from_class()insrc/wp-includes/block-supports/block-style-variations.php.preg_match_all()always initializes$matches[1]as an array, even when no matches are found, so?? nullis unnecessary. The corresponding PHPStan baseline entry is also removed.Trac ticket: https://core.trac.wordpress.org/ticket/66162
Use of AI Tools
AI assistance: Yes
Tool(s): ChatGPT
Model(s): GPT-5.6 Luna
Used for: Reviewing the PHPStan warning and discussing possible implementation approaches; the final change and code were reviewed and edited by me.