Code Quality: Correct @param annotation for variadic parameter in WP_Block_Processor::opens_block() - #13500
Conversation
…Block_Processor::opens_block(). Corrects the @PARAM annotation for $block_type in WP_Block_Processor::opens_block(), which documented the parameter as string[] instead of string ...$block_type. This empties tests/phpstan/baselines/parameter.phpDocType.neon. As the baseline header directs, the file is deleted along with its includes entry in phpstan.neon.dist. The baseline was regenerated with: composer phpstan:baselines -- --identifier=parameter.phpDocType Follow-up to r60939. See #65817.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
The
@paramannotation for$block_typeinWP_Block_Processor::opens_block()documents the type asstring[]. However, the method signature declares a variadic parameter:string ...$block_type.Per WordPress inline documentation standards, variadic parameters should document the element type followed by
...$parameter_name(@param string ...$block_type). Because of thestring[]notation, PHPStan flags this asparameter.phpDocType:Updating the annotation resolves this incompatibility and empties
tests/phpstan/baselines/parameter.phpDocType.neon. As the baseline header directs, the file is deleted along with itsincludesentry inphpstan.neon.dist. The baseline was regenerated with:Background
WP_Block_Processorwas introduced in [60939] (Trac #61401). The docblock has carried thestring[]notation since its introduction and was baselined when PHPStan rule levels were bumped to 5.Testing Instructions
composer phpstan:baselines -- --identifier=parameter.phpDocType. The baseline empties out and the file is deleted along with its reference inphpstan.neon.dist.composer run phpstan -- src/wp-includes/class-wp-block-processor.php. Reports[OK] No errors.vendor/bin/phpcs src/wp-includes/class-wp-block-processor.phpis clean.Documentation-only change; no runtime behaviour is affected.
Follow-up to r60939.
Trac ticket: https://core.trac.wordpress.org/ticket/65817
Use of AI Tools
AI assistance: Yes
Model(s): Gemini 3.8 Flash High
Used for: Locating the occurrence via the PHPStan
parameter.phpDocTypebaseline,git log -Larchaeology identifying [60939] as the origin, and drafting this description. The docblock correction, baseline regeneration viacomposer phpstan:baselines, and verification against full PHPStan and PHPCS runs were reviewed and confirmed by me in a local development environment.This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.