Make WordPress Core

Changeset 60511


Ignore:
Timestamp:
07/25/2025 02:57:09 PM (7 months ago)
Author:
johnbillion
Message:

Docs: Improve the documented return type for parsed blocks.

The blockName property can be null, for example when a section of HTML outside of a block is encountered. This corrects the docs to reflect that.

Props jeremyfelt, pmbaldha, johnbillion.

Fixes #63663

Location:
trunk/src/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/blocks.php

    r60402 r60511  
    16771677 *     An associative array of a single parsed block object. See WP_Block_Parser_Block.
    16781678 *
    1679  *     @type string  $blockName    Name of block.
    1680  *     @type array    $attrs        Attributes from block comment delimiters.
    1681  *     @type array[]  $innerBlocks  List of inner blocks. An array of arrays that
    1682  *                                  have the same structure as this one.
    1683  *     @type string   $innerHTML    HTML from inside block comment delimiters.
    1684  *     @type array    $innerContent List of string fragments and null markers where
    1685  *                                  inner blocks were found.
     1679 *     @type string|null $blockName    Name of block.
     1680 *     @type array       $attrs        Attributes from block comment delimiters.
     1681 *     @type array[]     $innerBlocks  List of inner blocks. An array of arrays that
     1682 *                                     have the same structure as this one.
     1683 *     @type string      $innerHTML    HTML from inside block comment delimiters.
     1684 *     @type array       $innerContent List of string fragments and null markers where
     1685 *                                     inner blocks were found.
    16861686 * }
    16871687 * @return string String of rendered HTML.
     
    17181718 *         An associative array of a single parsed block object. See WP_Block_Parser_Block.
    17191719 *
    1720  *         @type string  $blockName    Name of block.
    1721  *         @type array    $attrs        Attributes from block comment delimiters.
    1722  *         @type array[]  $innerBlocks  List of inner blocks. An array of arrays that
    1723  *                                      have the same structure as this one.
    1724  *         @type string   $innerHTML    HTML from inside block comment delimiters.
    1725  *         @type array    $innerContent List of string fragments and null markers where
    1726  *                                      inner blocks were found.
     1720 *         @type string|null $blockName    Name of block.
     1721 *         @type array       $attrs        Attributes from block comment delimiters.
     1722 *         @type array[]     $innerBlocks  List of inner blocks. An array of arrays that
     1723 *                                         have the same structure as this one.
     1724 *         @type string      $innerHTML    HTML from inside block comment delimiters.
     1725 *         @type array       $innerContent List of string fragments and null markers where
     1726 *                                         inner blocks were found.
    17271727 *     }
    17281728 * }
     
    22452245 *     An associative array of the block being rendered. See WP_Block_Parser_Block.
    22462246 *
    2247  *     @type string  $blockName    Name of block.
    2248  *     @type array    $attrs        Attributes from block comment delimiters.
    2249  *     @type array[]  $innerBlocks  List of inner blocks. An array of arrays that
    2250  *                                  have the same structure as this one.
    2251  *     @type string   $innerHTML    HTML from inside block comment delimiters.
    2252  *     @type array    $innerContent List of string fragments and null markers where
    2253  *                                  inner blocks were found.
     2247 *     @type string|null $blockName    Name of block.
     2248 *     @type array       $attrs        Attributes from block comment delimiters.
     2249 *     @type array[]     $innerBlocks  List of inner blocks. An array of arrays that
     2250 *                                     have the same structure as this one.
     2251 *     @type string      $innerHTML    HTML from inside block comment delimiters.
     2252 *     @type array       $innerContent List of string fragments and null markers where
     2253 *                                     inner blocks were found.
    22542254 * }
    22552255 * @return string String of rendered HTML.
     
    22692269     *     An associative array of the block being rendered. See WP_Block_Parser_Block.
    22702270     *
    2271      *     @type string  $blockName    Name of block.
    2272      *     @type array    $attrs        Attributes from block comment delimiters.
    2273      *     @type array[]  $innerBlocks  List of inner blocks. An array of arrays that
    2274      *                                  have the same structure as this one.
    2275      *     @type string   $innerHTML    HTML from inside block comment delimiters.
    2276      *     @type array    $innerContent List of string fragments and null markers where
    2277      *                                  inner blocks were found.
     2271     *     @type string|null $blockName    Name of block.
     2272     *     @type array       $attrs        Attributes from block comment delimiters.
     2273     *     @type array[]     $innerBlocks  List of inner blocks. An array of arrays that
     2274     *                                     have the same structure as this one.
     2275     *     @type string      $innerHTML    HTML from inside block comment delimiters.
     2276     *     @type array       $innerContent List of string fragments and null markers where
     2277     *                                     inner blocks were found.
    22782278     * }
    22792279     * @param WP_Block|null $parent_block If this is a nested block, a reference to the parent block.
     
    22952295     *     An associative array of the block being rendered. See WP_Block_Parser_Block.
    22962296     *
    2297      *     @type string  $blockName    Name of block.
    2298      *     @type array    $attrs        Attributes from block comment delimiters.
    2299      *     @type array[]  $innerBlocks  List of inner blocks. An array of arrays that
    2300      *                                  have the same structure as this one.
    2301      *     @type string   $innerHTML    HTML from inside block comment delimiters.
    2302      *     @type array    $innerContent List of string fragments and null markers where
    2303      *                                  inner blocks were found.
     2297     *     @type string|null $blockName    Name of block.
     2298     *     @type array       $attrs        Attributes from block comment delimiters.
     2299     *     @type array[]     $innerBlocks  List of inner blocks. An array of arrays that
     2300     *                                     have the same structure as this one.
     2301     *     @type string      $innerHTML    HTML from inside block comment delimiters.
     2302     *     @type array       $innerContent List of string fragments and null markers where
     2303     *                                     inner blocks were found.
    23042304     * }
    23052305     * @param array         $source_block {
     
    23072307     *     See WP_Block_Parser_Block.
    23082308     *
    2309      *     @type string  $blockName    Name of block.
    2310      *     @type array    $attrs        Attributes from block comment delimiters.
    2311      *     @type array[]  $innerBlocks  List of inner blocks. An array of arrays that
    2312      *                                  have the same structure as this one.
    2313      *     @type string   $innerHTML    HTML from inside block comment delimiters.
    2314      *     @type array    $innerContent List of string fragments and null markers where
    2315      *                                  inner blocks were found.
     2309     *     @type string|null $blockName    Name of block.
     2310     *     @type array       $attrs        Attributes from block comment delimiters.
     2311     *     @type array[]     $innerBlocks  List of inner blocks. An array of arrays that
     2312     *                                     have the same structure as this one.
     2313     *     @type string      $innerHTML    HTML from inside block comment delimiters.
     2314     *     @type array       $innerContent List of string fragments and null markers where
     2315     *                                     inner blocks were found.
    23162316     * }
    23172317     * @param WP_Block|null $parent_block If this is a nested block, a reference to the parent block.
     
    23432343     *     An associative array of the block being rendered. See WP_Block_Parser_Block.
    23442344     *
    2345      *     @type string  $blockName    Name of block.
    2346      *     @type array    $attrs        Attributes from block comment delimiters.
    2347      *     @type array[]  $innerBlocks  List of inner blocks. An array of arrays that
    2348      *                                  have the same structure as this one.
    2349      *     @type string   $innerHTML    HTML from inside block comment delimiters.
    2350      *     @type array    $innerContent List of string fragments and null markers where
    2351      *                                  inner blocks were found.
     2345     *     @type string|null $blockName    Name of block.
     2346     *     @type array       $attrs        Attributes from block comment delimiters.
     2347     *     @type array[]     $innerBlocks  List of inner blocks. An array of arrays that
     2348     *                                     have the same structure as this one.
     2349     *     @type string      $innerHTML    HTML from inside block comment delimiters.
     2350     *     @type array       $innerContent List of string fragments and null markers where
     2351     *                                     inner blocks were found.
    23522352     * }
    23532353     * @param WP_Block|null $parent_block If this is a nested block, a reference to the parent block.
     
    23722372 *         An associative array of a single parsed block object. See WP_Block_Parser_Block.
    23732373 *
    2374  *         @type string  $blockName    Name of block.
    2375  *         @type array    $attrs        Attributes from block comment delimiters.
    2376  *         @type array[]  $innerBlocks  List of inner blocks. An array of arrays that
    2377  *                                      have the same structure as this one.
    2378  *         @type string   $innerHTML    HTML from inside block comment delimiters.
    2379  *         @type array    $innerContent List of string fragments and null markers where
    2380  *                                      inner blocks were found.
     2374 *         @type string|null $blockName    Name of block.
     2375 *         @type array       $attrs        Attributes from block comment delimiters.
     2376 *         @type array[]     $innerBlocks  List of inner blocks. An array of arrays that
     2377 *                                         have the same structure as this one.
     2378 *         @type string      $innerHTML    HTML from inside block comment delimiters.
     2379 *         @type array       $innerContent List of string fragments and null markers where
     2380 *                                         inner blocks were found.
    23812381 *     }
    23822382 * }
  • trunk/src/wp-includes/class-wp-block.php

    r60325 r60511  
    3030     *
    3131     * @since 5.5.0
    32      * @var string
     32     * @var string|null
    3333     */
    3434    public $name;
     
    115115     *     An associative array of a single parsed block object. See WP_Block_Parser_Block.
    116116     *
    117      *     @type string  $blockName    Name of block.
    118      *     @type array    $attrs        Attributes from block comment delimiters.
    119      *     @type array    $innerBlocks  List of inner blocks. An array of arrays that
    120      *                                  have the same structure as this one.
    121      *     @type string   $innerHTML    HTML from inside block comment delimiters.
    122      *     @type array    $innerContent List of string fragments and null markers where inner blocks were found.
     117     *     @type string|null $blockName    Name of block.
     118     *     @type array       $attrs        Attributes from block comment delimiters.
     119     *     @type array       $innerBlocks  List of inner blocks. An array of arrays that
     120     *                                     have the same structure as this one.
     121     *     @type string      $innerHTML    HTML from inside block comment delimiters.
     122     *     @type array       $innerContent List of string fragments and null markers where inner blocks were found.
    123123     * }
    124124     * @param array                  $available_context Optional array of ancestry context values.
Note: See TracChangeset for help on using the changeset viewer.