Docs: Correct @return type for WP_Block_Parser::parse().

This affects:
* `WP_Block_Parser::parse()`
* `WP_Block_Parser::$output`

Both the method and the property are documented as returning `WP_Block_Parser_Block[]` (an array of `WP_Block_Parser_Block` objects), but the result is in fact an array of arrays of various values, so `array[]` is the correct notation.

Follow-up to [43751] for the 5.0 branch, [44116] for trunk.

Props Chouby.
Fixes #56581.
Built from https://develop.svn.wordpress.org/trunk@54194


git-svn-id: http://core.svn.wordpress.org/trunk@53753 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2022-09-17 17:13:11 +00:00
parent 6435a4c9c7
commit e076ee2ee1
2 changed files with 9 additions and 7 deletions

View File

@ -62,7 +62,7 @@ class WP_Block_Parser_Block {
* 'innerContent' => array( 'Before', null, 'Inner', null, 'After' ), * 'innerContent' => array( 'Before', null, 'Inner', null, 'After' ),
* ) * )
* *
* @since 5.0.0 * @since 4.2.0
* @var array * @var array
*/ */
public $innerContent; public $innerContent;
@ -164,9 +164,10 @@ class WP_Block_Parser_Frame {
/** /**
* Class WP_Block_Parser * Class WP_Block_Parser
* *
* Parses a document and constructs a list of parsed blocks. * Parses a document and constructs a list of parsed block objects
* *
* @since 5.0.0 * @since 5.0.0
* @since 4.0.0 returns arrays not objects, all attributes are arrays
*/ */
class WP_Block_Parser { class WP_Block_Parser {
/** /**
@ -191,7 +192,7 @@ class WP_Block_Parser {
* List of parsed blocks * List of parsed blocks
* *
* @since 5.0.0 * @since 5.0.0
* @var WP_Block_Parser_Block[] * @var array[]
*/ */
public $output; public $output;
@ -206,7 +207,7 @@ class WP_Block_Parser {
/** /**
* Empty associative array, here due to PHP quirks * Empty associative array, here due to PHP quirks
* *
* @since 5.0.0 * @since 4.4.0
* @var array empty associative array * @var array empty associative array
*/ */
public $empty_attrs; public $empty_attrs;
@ -221,7 +222,7 @@ class WP_Block_Parser {
* @since 5.0.0 * @since 5.0.0
* *
* @param string $document Input document being parsed. * @param string $document Input document being parsed.
* @return WP_Block_Parser_Block[] * @return array[]
*/ */
function parse( $document ) { function parse( $document ) {
$this->document = $document; $this->document = $document;
@ -394,6 +395,7 @@ class WP_Block_Parser {
* *
* @internal * @internal
* @since 5.0.0 * @since 5.0.0
* @since 4.6.1 fixed a bug in attribute parsing which caused catastrophic backtracking on invalid block comments
* @return array * @return array
*/ */
function next_token() { function next_token() {
@ -466,7 +468,7 @@ class WP_Block_Parser {
* Returns a new block object for freeform HTML * Returns a new block object for freeform HTML
* *
* @internal * @internal
* @since 5.0.0 * @since 3.9.0
* *
* @param string $innerHTML HTML content of block. * @param string $innerHTML HTML content of block.
* @return WP_Block_Parser_Block freeform block object. * @return WP_Block_Parser_Block freeform block object.

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.1-alpha-54193'; $wp_version = '6.1-alpha-54194';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.