Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct the documented return type for WP_Block_Parser::render() #42642

Merged
merged 1 commit into from
Jul 25, 2022

Conversation

johnbillion
Copy link
Member

@johnbillion johnbillion commented Jul 22, 2022

What?

This fixes an inline documentation error for the WP_Block_Parser::render() method.

Why?

This method returns an array of arrays, not an array of WP_Block_Parser_Block instances. The proceed() method always casts the WP_Block_Parser_Block instance to an array.

Testing Instructions

  1. Call the parse_blocks() function with some post content that contains blocks
  2. Observe that an array of arrays is returned

@johnbillion johnbillion requested a review from dmsnell as a code owner July 22, 2022 18:19
@johnbillion johnbillion added [Type] Bug An existing feature does not function as intended [Type] Developer Documentation Documentation for developers [Feature] Parsing Related to efforts to improving the parsing of a string of data and converting it into a different f labels Jul 22, 2022
Copy link
Member

@dmsnell dmsnell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch @johnbillion - though I believe that the PR description and title (and also in the commit message) don't reflect the changes here. This is the parse() method on the WP_Block_parser class. I'm guessing it started as one thing and then turned into another? Would be great if we updated the title to reflect the fix so we don't confuse ourselves in the future when reading the history.

@johnbillion johnbillion changed the title Correct the documented return type for WP_Block_Parser_Block::render() Correct the documented return type for WP_Block_Parser::render() Jul 24, 2022
@johnbillion johnbillion force-pushed the wp-block-parser-block-render branch from 394de8a to d071363 Compare July 24, 2022 13:37
@johnbillion
Copy link
Member Author

Cheers Dennis, fixed.

@Mamaduka Mamaduka merged commit 7d77a24 into trunk Jul 25, 2022
@Mamaduka Mamaduka deleted the wp-block-parser-block-render branch July 25, 2022 05:40
@github-actions github-actions bot added this to the Gutenberg 13.8 milestone Jul 25, 2022
@dmsnell
Copy link
Member

dmsnell commented Jul 26, 2022

Oops, looks like the fixes didn't make it into the merge as it still shows in the commit message the wrong method name. Oh well 🤷‍♂️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Parsing Related to efforts to improving the parsing of a string of data and converting it into a different f [Type] Bug An existing feature does not function as intended [Type] Developer Documentation Documentation for developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants