diff --git a/src/wp-includes/class-wp-block-parser-block.php b/src/wp-includes/class-wp-block-parser-block.php index 97dd687c1ffe1..8fbeedd14bec9 100644 --- a/src/wp-includes/class-wp-block-parser-block.php +++ b/src/wp-includes/class-wp-block-parser-block.php @@ -14,12 +14,12 @@ */ class WP_Block_Parser_Block { /** - * Name of block + * Name of block, or `null` when the block is top-level freeform HTML content. * * @example "core/paragraph" * * @since 5.0.0 - * @var string + * @var string|null */ public $blockName; // phpcs:ignore WordPress.NamingConventions.ValidVariableName @@ -74,11 +74,11 @@ class WP_Block_Parser_Block { * * @since 5.0.0 * - * @param string $name Name of block. - * @param array $attrs Optional set of attributes from block comment delimiters. - * @param array $inner_blocks List of inner blocks (of this same class). - * @param string $inner_html Resultant HTML from inside block comment delimiters after removing inner blocks. - * @param array $inner_content List of string fragments and null markers where inner blocks were found. + * @param string|null $name Name of block, or `null` for freeform HTML content. + * @param array $attrs Optional set of attributes from block comment delimiters. + * @param array $inner_blocks List of inner blocks (of this same class). + * @param string $inner_html Resultant HTML from inside block comment delimiters after removing inner blocks. + * @param array $inner_content List of string fragments and null markers where inner blocks were found. */ public function __construct( $name, $attrs, $inner_blocks, $inner_html, $inner_content ) { $this->blockName = $name; // phpcs:ignore WordPress.NamingConventions.ValidVariableName diff --git a/src/wp-includes/class-wp-block-parser.php b/src/wp-includes/class-wp-block-parser.php index 06342fc5acb64..7671442a446e3 100644 --- a/src/wp-includes/class-wp-block-parser.php +++ b/src/wp-includes/class-wp-block-parser.php @@ -35,6 +35,8 @@ class WP_Block_Parser { /** * List of parsed blocks * + * See WP_Block_Parser_Block for the structure of each block. + * * @since 5.0.0 * @var array[] */ @@ -68,7 +70,22 @@ class WP_Block_Parser { * @since 5.0.0 * * @param string $document Input document being parsed. - * @return array[] + * @return array[] { + * Array of block structures. + * + * @type array ...$0 { + * An associative array of a single parsed block object. See WP_Block_Parser_Block. + * + * @type string|null $blockName Name of block, or `null` when the block is + * top-level freeform HTML content. + * @type array $attrs Attributes from block comment delimiters. + * @type array[] $innerBlocks List of inner blocks. An array of arrays that + * have the same structure as this one. + * @type string $innerHTML HTML from inside block comment delimiters. + * @type array $innerContent List of string fragments and null markers where + * inner blocks were found. + * } + * } */ public function parse( $document ) { $this->document = $document; diff --git a/tests/phpstan/baselines/argument.type.neon b/tests/phpstan/baselines/argument.type.neon index 4441460ac0799..1e3390226e752 100644 --- a/tests/phpstan/baselines/argument.type.neon +++ b/tests/phpstan/baselines/argument.type.neon @@ -673,11 +673,6 @@ parameters: identifier: argument.type count: 1 path: ../../../src/wp-includes/capabilities.php - - - message: '#^Parameter \#1 \$name of class WP_Block_Parser_Block constructor expects string, null given\.$#' - identifier: argument.type - count: 1 - path: ../../../src/wp-includes/class-wp-block-parser.php - message: '#^Parameter \#1 \$ajax_message of method WP_Customize_Manager\:\:wp_die\(\) expects string\|WP_Error, int given\.$#' identifier: argument.type