Skip to content

Commit

Permalink
Make linter happy
Browse files Browse the repository at this point in the history
Try again
  • Loading branch information
aaronrobertshaw committed Aug 25, 2023
1 parent 16f5b8d commit d04f562
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions lib/block-supports/pattern.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ function gutenberg_register_pattern_support( $block_type ) {
$block_type->uses_context = array();
}

if ( ! in_array( 'patternId', $block_type->uses_context ) ) {
if ( ! in_array( 'patternId', $block_type->uses_context, true ) ) {
$block_type->uses_context[] = 'patternId';
}

if ( ! in_array( 'dynamicContent', $block_type->uses_context ) ) {
if ( ! in_array( 'dynamicContent', $block_type->uses_context, true ) ) {
$block_type->uses_context[] = 'dynamicContent';
}
}
Expand All @@ -35,10 +35,10 @@ function gutenberg_register_pattern_support( $block_type ) {
* Creates an HTML tag processor based off the block's content and selector
* for the pattern sourced attribute.
*
* @param string $block_content
* @param string $selector
* @param string $block_content Block markup.
* @param string $selector Attribute's CSS selector.
*
* @return void
* @return WP_HTML_Tag_Processor HTML tag processor having matched on attribute's selector.
*/
function gutenberg_create_pattern_content_processor( $block_content, $selector ) {
if ( ! $selector ) {
Expand All @@ -52,7 +52,7 @@ function gutenberg_create_pattern_content_processor( $block_content, $selector )
// TODO: The retrieval via selector could do with some work.
$found = $tags->next_tag( array( 'tag_name' => $selector ) );

return $found ? $tags : false;
return $found ? $tags : null;
}

$found = false;
Expand All @@ -75,9 +75,19 @@ function gutenberg_create_pattern_content_processor( $block_content, $selector )
$tags = new WP_HTML_Tag_Processor( $block_content );
}

return $found ? $tags : false;
return $found ? $tags : null;
}

/**
* Renders pattern data into the final block markup for block's within
* partially synced patterns.
*
* @param string $block_content Block Content.
* @param array $block Block attributes.
* @param WP_Block $block_instance The block instance.
*
* @return string
*/
function gutenberg_render_block_pattern_data( $block_content, $block, $block_instance ) {
$block_type = $block_instance->block_type;

Expand Down

0 comments on commit d04f562

Please sign in to comment.