Skip to content

Commit

Permalink
fix: make get_block_attribute_fields() $prefix param non-nullable (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
justlevine authored Apr 4, 2024
1 parent bc0de59 commit 7bf6bcb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/great-pans-poke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@wpengine/wp-graphql-content-blocks": patch
---

fix: Change Block:get_block_attribute_fields()`$prefix parameter be an optional`string`.
6 changes: 3 additions & 3 deletions includes/Blocks/Block.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,10 @@ private function get_attribute_type( $name, $attribute, $prefix ) {
/**
* Gets the WPGraphQL field registration config for the block attributes.
*
* @param ?array $block_attributes The block attributes.
* @param string|null $prefix The current prefix string to use for the get_query_type
* @param ?array $block_attributes The block attributes.
* @param string $prefix The current prefix string to use for the get_query_type
*/
private function get_block_attribute_fields( ?array $block_attributes, $prefix = '' ): array {
private function get_block_attribute_fields( ?array $block_attributes, string $prefix = '' ): array {
$fields = [];

// Bail early if no attributes are defined.
Expand Down
5 changes: 0 additions & 5 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ parameters:
count: 1
path: includes/Blocks/Block.php

-
message: "#^Parameter \\#3 \\$prefix of method WPGraphQL\\\\ContentBlocks\\\\Blocks\\\\Block\\:\\:get_attribute_type\\(\\) expects string, string\\|null given\\.$#"
count: 1
path: includes/Blocks/Block.php

-
message: "#^Call to an undefined method DiDom\\\\Element\\|DOMElement\\:\\:html\\(\\)\\.$#"
count: 1
Expand Down

0 comments on commit 7bf6bcb

Please sign in to comment.