Skip to content

Commit

Permalink
Implement fix; make test pass
Browse files Browse the repository at this point in the history
  • Loading branch information
ockham committed Oct 18, 2023
1 parent bebd976 commit 1de1b5e
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/wp-includes/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -1052,18 +1052,20 @@ function traverse_and_serialize_block( $block, $pre_callback = null, $post_callb
);
}

$block_content .= traverse_and_serialize_block( $inner_block, $pre_callback, $post_callback );

if ( is_callable( $post_callback ) ) {
$next = count( $block['innerBlocks'] ) - 1 === $block_index
? null
: $block['innerBlocks'][ $block_index + 1 ];

$block_content .= call_user_func_array(
$post_markup = call_user_func_array(
$post_callback,

Check failure on line 1061 in src/wp-includes/blocks.php

View workflow job for this annotation

GitHub Actions / PHP coding standards

Multi-line function call not indented correctly; expected 24 spaces but found 20
array( &$inner_block, $block, $next )

Check failure on line 1062 in src/wp-includes/blocks.php

View workflow job for this annotation

GitHub Actions / PHP coding standards

Multi-line function call not indented correctly; expected 24 spaces but found 20
);

Check failure on line 1063 in src/wp-includes/blocks.php

View workflow job for this annotation

GitHub Actions / PHP coding standards

Multi-line function call not indented correctly; expected 20 spaces but found 16
}

$block_content .= traverse_and_serialize_block( $inner_block, $pre_callback, $post_callback );
$block_content .= isset( $post_markup ) ? $post_markup : '';

++$block_index;
}
}
Expand Down Expand Up @@ -1125,18 +1127,19 @@ function traverse_and_serialize_blocks( $blocks, $pre_callback = null, $post_cal
);
}

$result .= traverse_and_serialize_block( $block, $pre_callback, $post_callback );

if ( is_callable( $post_callback ) ) {
$next = count( $blocks ) - 1 === $index
? null
: $blocks[ $index + 1 ];

$result .= call_user_func_array(
$post_markup = call_user_func_array(
$post_callback,
array( &$block, null, $next ) // At the top level, there is no parent block to pass to the callback.
);
}

$result .= traverse_and_serialize_block( $block, $pre_callback, $post_callback );
$result .= isset( $post_markup ) ? $post_markup : '';
}

return $result;
Expand Down

0 comments on commit 1de1b5e

Please sign in to comment.