Skip to content

Commit

Permalink
Correct @SInCE version for block parser package (#24819)
Browse files Browse the repository at this point in the history
Fixes #22050

The @SInCE values in packages/block-serialization-default-parser/parser.php (converted to class-wp-block-parser.php in WordPress core) were all set to the version of Gutenberg that they were introduced in, rather than the version of WordPress they were introduced in.

In this patch those version values are properly set to 5.0.0 - the version of WordPress in which they were introduced.

Props: @JustinyAhin
  • Loading branch information
JustinyAhin committed Aug 31, 2020
1 parent 90da808 commit c47ba60
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions packages/block-serialization-default-parser/parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
*
* Holds the block structure in memory
*
* @since 3.8.0
* @since 5.0.0
*/
class WP_Block_Parser_Block {
/**
* Name of block
*
* @example "core/paragraph"
*
* @since 3.8.0
* @since 5.0.0
* @var string
*/
public $blockName;
Expand All @@ -29,15 +29,15 @@ class WP_Block_Parser_Block {
* @example null
* @example array( 'columns' => 3 )
*
* @since 3.8.0
* @since 5.0.0
* @var array|null
*/
public $attrs;

/**
* List of inner blocks (of this same class)
*
* @since 3.8.0
* @since 5.0.0
* @var WP_Block_Parser_Block[]
*/
public $innerBlocks;
Expand All @@ -48,7 +48,7 @@ class WP_Block_Parser_Block {
*
* @example "...Just <!-- wp:test /--> testing..." -> "Just testing..."
*
* @since 3.8.0
* @since 5.0.0
* @var string
*/
public $innerHTML;
Expand All @@ -72,7 +72,7 @@ class WP_Block_Parser_Block {
*
* Will populate object properties from the provided arguments.
*
* @since 3.8.0
* @since 5.0.0
*
* @param string $name Name of block.
* @param array $attrs Optional set of attributes from block comment delimiters.
Expand All @@ -95,29 +95,29 @@ function __construct( $name, $attrs, $innerBlocks, $innerHTML, $innerContent ) {
* Holds partial blocks in memory while parsing
*
* @internal
* @since 3.8.0
* @since 5.0.0
*/
class WP_Block_Parser_Frame {
/**
* Full or partial block
*
* @since 3.8.0
* @since 5.0.0
* @var WP_Block_Parser_Block
*/
public $block;

/**
* Byte offset into document for start of parse token
*
* @since 3.8.0
* @since 5.0.0
* @var int
*/
public $token_start;

/**
* Byte length of entire parse token string
*
* @since 3.8.0
* @since 5.0.0
* @var int
*/
public $token_length;
Expand All @@ -126,15 +126,15 @@ class WP_Block_Parser_Frame {
* Byte offset into document for after parse token ends
* (used during reconstruction of stack into parse production)
*
* @since 3.8.0
* @since 5.0.0
* @var int
*/
public $prev_offset;

/**
* Byte offset into document where leading HTML before token starts
*
* @since 3.8.0
* @since 5.0.0
* @var int
*/
public $leading_html_start;
Expand All @@ -144,7 +144,7 @@ class WP_Block_Parser_Frame {
*
* Will populate object properties from the provided arguments.
*
* @since 3.8.0
* @since 5.0.0
*
* @param WP_Block_Parser_Block $block Full or partial block.
* @param int $token_start Byte offset into document for start of parse token.
Expand All @@ -166,7 +166,7 @@ function __construct( $block, $token_start, $token_length, $prev_offset = null,
*
* Parses a document and constructs a list of parsed block objects
*
* @since 3.8.0
* @since 5.0.0
* @since 4.0.0 returns arrays not objects, all attributes are arrays
*/
class WP_Block_Parser {
Expand All @@ -175,31 +175,31 @@ class WP_Block_Parser {
*
* @example "Pre-text\n<!-- wp:paragraph -->This is inside a block!<!-- /wp:paragraph -->"
*
* @since 3.8.0
* @since 5.0.0
* @var string
*/
public $document;

/**
* Tracks parsing progress through document
*
* @since 3.8.0
* @since 5.0.0
* @var int
*/
public $offset;

/**
* List of parsed blocks
*
* @since 3.8.0
* @since 5.0.0
* @var WP_Block_Parser_Block[]
*/
public $output;

/**
* Stack of partially-parsed structures in memory during parse
*
* @since 3.8.0
* @since 5.0.0
* @var WP_Block_Parser_Frame[]
*/
public $stack;
Expand All @@ -219,7 +219,7 @@ class WP_Block_Parser {
* parse. In contrast to the specification parser this does not
* return an error on invalid inputs.
*
* @since 3.8.0
* @since 5.0.0
*
* @param string $document Input document being parsed.
* @return WP_Block_Parser_Block[]
Expand Down Expand Up @@ -249,7 +249,7 @@ function parse( $document ) {
* or breaking out of a level of nesting.
*
* @internal
* @since 3.8.0
* @since 5.0.0
* @return bool
*/
function proceed() {
Expand Down Expand Up @@ -394,7 +394,7 @@ function proceed() {
* Returns the type of the find: kind of find, block information, attributes
*
* @internal
* @since 3.8.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
*/
Expand Down Expand Up @@ -482,7 +482,7 @@ function freeform( $innerHTML ) {
* to the output list as a freeform block.
*
* @internal
* @since 3.8.0
* @since 5.0.0
* @param null $length how many bytes of document text to output.
*/
function add_freeform( $length = null ) {
Expand All @@ -500,7 +500,7 @@ function add_freeform( $length = null ) {
* a new block to the output list.
*
* @internal
* @since 3.8.0
* @since 5.0.0
* @param WP_Block_Parser_Block $block The block to add to the output.
* @param int $token_start Byte offset into the document where the first token for the block starts.
* @param int $token_length Byte length of entire block from start of opening token to end of closing token.
Expand All @@ -524,7 +524,7 @@ function add_inner_block( WP_Block_Parser_Block $block, $token_start, $token_len
* Pushes the top block from the parsing stack to the output list.
*
* @internal
* @since 3.8.0
* @since 5.0.0
* @param int|null $end_offset byte offset into document for where we should stop sending text output as HTML.
*/
function add_block_from_stack( $end_offset = null ) {
Expand Down

0 comments on commit c47ba60

Please sign in to comment.