From 05b21b57ae03c86303cfeacdc2bc079e947d996b Mon Sep 17 00:00:00 2001 From: Dovid Levine Date: Wed, 27 Mar 2024 17:51:50 +0200 Subject: [PATCH] fix: `get_allowed_block_types()` can return `bool` (#212) --- .changeset/neat-ties-prove.md | 5 +++++ includes/Registry/Registry.php | 2 +- phpstan-baseline.neon | 5 ----- 3 files changed, 6 insertions(+), 6 deletions(-) create mode 100644 .changeset/neat-ties-prove.md diff --git a/.changeset/neat-ties-prove.md b/.changeset/neat-ties-prove.md new file mode 100644 index 00000000..5bd6aaaa --- /dev/null +++ b/.changeset/neat-ties-prove.md @@ -0,0 +1,5 @@ +--- +"@wpengine/wp-graphql-content-blocks": patch +--- + +fix: Update parameter type for `$supported_blocks_for_post_type_context` in `wpgraphql_content_blocks_should_apply_post_type_editor_blocks_interfaces` to support boolean values diff --git a/includes/Registry/Registry.php b/includes/Registry/Registry.php index 1bf42ab3..66c6fca8 100644 --- a/includes/Registry/Registry.php +++ b/includes/Registry/Registry.php @@ -116,7 +116,7 @@ public function get_block_context_interfaces( string $block_name ): array { * @param \WP_Block_Editor_Context $block_editor_context The context of the Block Editor * @param \WP_Post_Type $post_type The Post Type an Interface might be applied to the block for * @param array $all_registered_blocks Array of all registered blocks - * @param array $supported_blocks_for_post_type_context Array of all supported blocks for the context + * @param array|bool $supported_blocks_for_post_type_context Array of all supported blocks for the context * @param array $block_and_graphql_enabled_post_types Array of Post Types that have block editor and GraphQL support */ $should_apply_post_type_editor_block_interface = apply_filters( 'wpgraphql_content_blocks_should_apply_post_type_editor_blocks_interfaces', true, $block_name, $block_editor_context, $post_type, $all_registered_blocks, $supported_blocks_for_post_type_context, $block_and_graphql_enabled_post_types ); diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 10974b32..c5b9aa58 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -35,11 +35,6 @@ parameters: count: 1 path: includes/Field/BlockSupports/Anchor.php - - - message: "#^@param array \\$supported_blocks_for_post_type_context does not accept actual type of parameter\\: array\\\\|bool\\.$#" - count: 1 - path: includes/Registry/Registry.php - - message: "#^Parameter \\#2 \\$block_spec of static method WPGraphQL\\\\ContentBlocks\\\\Field\\\\BlockSupports\\\\Anchor\\:\\:get_block_attributes_interfaces\\(\\) expects WP_Block_Type, WP_Block_Type\\|null given\\.$#" count: 1