Skip to content

Commit

Permalink
Framework: Disable PHPCS rule for snake case property
Browse files Browse the repository at this point in the history
`providesContext` is a property of the block type which applies in both a server and browser context. Based on precedent (`styleVariations`, `textDomain`), it is optimized to use camel-case.
  • Loading branch information
aduth committed Apr 10, 2020
1 parent 3950a85 commit 0d47558
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/compat.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,15 @@ function gutenberg_provide_render_callback_with_block_object( $pre_render, $next
$_block_context['postId'] = $post->ID;
}

/* phpcs:disable WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase */
if ( ! empty( $block_type->providesContext ) && is_array( $block_type->providesContext ) ) {
foreach ( $block_type->providesContext as $context_name => $attribute_name ) {
if ( isset( $block['attrs'][ $attribute_name ] ) ) {
$_block_context[ $context_name ] = $block['attrs'][ $attribute_name ];
}
}
}
/* phpcs:enable */

foreach ( $block['innerContent'] as $chunk ) {
$block_content .= is_string( $chunk ) ?
Expand Down

0 comments on commit 0d47558

Please sign in to comment.