From a9f570d285e1a2c1af3de045ad7ab1008345a992 Mon Sep 17 00:00:00 2001 From: Dovid Levine Date: Sat, 28 Dec 2024 16:36:26 +0200 Subject: [PATCH 01/26] fix: wrong number of `$accepted_args` on `add_filter()` calls --- lib/block-supports/block-style-variations.php | 2 +- lib/experimental/kses-allowed-html.php | 2 +- lib/rest-api.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/block-supports/block-style-variations.php b/lib/block-supports/block-style-variations.php index b1f3243bfd04d1..5f7d02007ed396 100644 --- a/lib/block-supports/block-style-variations.php +++ b/lib/block-supports/block-style-variations.php @@ -273,7 +273,7 @@ function gutenberg_enqueue_block_style_variation_styles() { } // Add Gutenberg filters and action. -add_filter( 'render_block_data', 'gutenberg_render_block_style_variation_support_styles', 10, 2 ); +add_filter( 'render_block_data', 'gutenberg_render_block_style_variation_support_styles' ); add_filter( 'render_block', 'gutenberg_render_block_style_variation_class_name', 10, 2 ); add_action( 'wp_enqueue_scripts', 'gutenberg_enqueue_block_style_variation_styles', 1 ); diff --git a/lib/experimental/kses-allowed-html.php b/lib/experimental/kses-allowed-html.php index 122faef7b4ca2c..9a4f2e7c614b80 100644 --- a/lib/experimental/kses-allowed-html.php +++ b/lib/experimental/kses-allowed-html.php @@ -40,4 +40,4 @@ function gutenberg_kses_allowed_html( $allowedtags ) { ); return $allowedtags; } -add_filter( 'wp_kses_allowed_html', 'gutenberg_kses_allowed_html', 10, 2 ); +add_filter( 'wp_kses_allowed_html', 'gutenberg_kses_allowed_html' ); diff --git a/lib/rest-api.php b/lib/rest-api.php index 424927acf1f4a0..783abc24d3ee38 100644 --- a/lib/rest-api.php +++ b/lib/rest-api.php @@ -26,7 +26,7 @@ function gutenberg_override_global_styles_endpoint( array $args ): array { return $args; } -add_filter( 'register_wp_global_styles_post_type_args', 'gutenberg_override_global_styles_endpoint', 10, 2 ); +add_filter( 'register_wp_global_styles_post_type_args', 'gutenberg_override_global_styles_endpoint' ); /** * Registers the Edit Site Export REST API routes. From 41f1e8d47743dfe878972409bda69f52a16294fe Mon Sep 17 00:00:00 2001 From: Dovid Levine Date: Sat, 28 Dec 2024 16:37:07 +0200 Subject: [PATCH 02/26] chore (phpstan): specifiy possible return values for `get_wp_templates_original_source_field` --- .../class-gutenberg-rest-templates-controller-6-7.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/compat/wordpress-6.7/class-gutenberg-rest-templates-controller-6-7.php b/lib/compat/wordpress-6.7/class-gutenberg-rest-templates-controller-6-7.php index e5f6eb126f2a6a..34c2c2a4db52d6 100644 --- a/lib/compat/wordpress-6.7/class-gutenberg-rest-templates-controller-6-7.php +++ b/lib/compat/wordpress-6.7/class-gutenberg-rest-templates-controller-6-7.php @@ -92,7 +92,7 @@ public function prepare_item_for_response( $item, $request ) { * Returns the source from where the template originally comes from. * * @param WP_Block_Template $template_object Template instance. - * @return string Original source of the template one of theme, plugin, site, or user. + * @return 'theme'|'plugin'|'site'|'user' Original source of the template one of theme. */ // @core-merge: Changed the comments format (from inline to multi-line) in the entire function. private static function get_wp_templates_original_source_field( $template_object ) { From bdf378e862d21834ffac93b37af7da21a37f3f1a Mon Sep 17 00:00:00 2001 From: Dovid Levine Date: Sat, 28 Dec 2024 16:37:58 +0200 Subject: [PATCH 03/26] phpstan: level 1 checkpoint --- tools/phpstan/baseline/level-1.php | 36 ------------------------------ 1 file changed, 36 deletions(-) diff --git a/tools/phpstan/baseline/level-1.php b/tools/phpstan/baseline/level-1.php index dd401074da9444..2ad1e5aea506b7 100644 --- a/tools/phpstan/baseline/level-1.php +++ b/tools/phpstan/baseline/level-1.php @@ -1,48 +1,12 @@ '#^Function remove_filter invoked with 4 parameters, 2\\-3 required\\.$#', - 'count' => 4, - 'path' => __DIR__ . '/../../../lib/block-supports/elements.php', -]; -$ignoreErrors[] = [ - // identifier: arguments.count - 'message' => '#^Function remove_filter invoked with 4 parameters, 2\\-3 required\\.$#', - 'count' => 3, - 'path' => __DIR__ . '/../../../lib/block-supports/layout.php', -]; -$ignoreErrors[] = [ - // identifier: arguments.count - 'message' => '#^Function remove_filter invoked with 4 parameters, 2\\-3 required\\.$#', - 'count' => 2, - 'path' => __DIR__ . '/../../../lib/block-supports/settings.php', -]; $ignoreErrors[] = [ // identifier: variable.undefined 'message' => '#^Variable \\$filter_id might not be defined\\.$#', 'count' => 1, 'path' => __DIR__ . '/../../../lib/class-wp-duotone-gutenberg.php', ]; -$ignoreErrors[] = [ - // identifier: isset.variable - 'message' => '#^Variable \\$area in isset\\(\\) always exists and is not nullable\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.6/block-template-utils.php', -]; -$ignoreErrors[] = [ - // identifier: arguments.count - 'message' => '#^Class WP_Webfonts constructor invoked with 1 parameter, 0 required\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../lib/experimental/font-face/bc-layer/webfonts-deprecations.php', -]; -$ignoreErrors[] = [ - // identifier: arguments.count - 'message' => '#^Function gutenberg_url invoked with 2 parameters, 1 required\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../lib/experimental/posts/load.php', -]; $ignoreErrors[] = [ // identifier: variable.undefined 'message' => '#^Variable \\$cache_key might not be defined\\.$#', From d0684a0e6075b6c01ae56ded9207afe333948f1e Mon Sep 17 00:00:00 2001 From: Dovid Levine Date: Sat, 28 Dec 2024 18:41:25 +0200 Subject: [PATCH 04/26] chore: regenerate baselines --- tools/phpstan/baseline/level-0.php | 42 ----- tools/phpstan/baseline/level-2.php | 36 +--- tools/phpstan/baseline/level-3.php | 36 ---- tools/phpstan/baseline/level-4.php | 18 +- tools/phpstan/baseline/level-5.php | 6 - tools/phpstan/baseline/level-6.php | 268 +++++++++++++++-------------- tools/phpstan/baseline/level-7.php | 66 +++---- 7 files changed, 179 insertions(+), 293 deletions(-) diff --git a/tools/phpstan/baseline/level-0.php b/tools/phpstan/baseline/level-0.php index 71a6c918451e3b..1a8510b0f056e3 100644 --- a/tools/phpstan/baseline/level-0.php +++ b/tools/phpstan/baseline/level-0.php @@ -1,30 +1,12 @@ '#^Callback expects 1 parameter, \\$accepted_args is set to 2\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../lib/block-supports/block-style-variations.php', -]; $ignoreErrors[] = [ // identifier: return.missing 'message' => '#^Function gutenberg_tinycolor_string_to_rgb\\(\\) should return array but return statement is missing\\.$#', 'count' => 1, 'path' => __DIR__ . '/../../../lib/block-supports/duotone.php', ]; -$ignoreErrors[] = [ - // identifier: return.missing - 'message' => '#^Method WP_Duotone_Gutenberg\\:\\:get_selector\\(\\) should return string but return statement is missing\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../lib/class-wp-duotone-gutenberg.php', -]; -$ignoreErrors[] = [ - // identifier: return.missing - 'message' => '#^Method WP_Theme_JSON_Gutenberg\\:\\:should_override_preset\\(\\) should return bool but return statement is missing\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../lib/class-wp-theme-json-gutenberg.php', -]; $ignoreErrors[] = [ // identifier: phpDoc.parseError 'message' => '#^One or more @param tags has an invalid name or invalid syntax\\.$#', @@ -37,29 +19,5 @@ 'count' => 1, 'path' => __DIR__ . '/../../../lib/client-assets.php', ]; -$ignoreErrors[] = [ - // identifier: new.static - 'message' => '#^Unsafe usage of new static\\(\\)\\.$#', - 'count' => 2, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.6/class-gutenberg-token-map-6-6.php', -]; -$ignoreErrors[] = [ - // identifier: return.missing - 'message' => '#^Method Gutenberg_REST_Templates_Controller_6_7\\:\\:get_wp_templates_author_text_field\\(\\) should return string but return statement is missing\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.7/class-gutenberg-rest-templates-controller-6-7.php', -]; -$ignoreErrors[] = [ - // identifier: arguments.count - 'message' => '#^Callback expects 1 parameter, \\$accepted_args is set to 2\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../lib/experimental/kses-allowed-html.php', -]; -$ignoreErrors[] = [ - // identifier: arguments.count - 'message' => '#^Callback expects 1 parameter, \\$accepted_args is set to 2\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../lib/rest-api.php', -]; return ['parameters' => ['ignoreErrors' => $ignoreErrors]]; diff --git a/tools/phpstan/baseline/level-2.php b/tools/phpstan/baseline/level-2.php index 3ff6a0742837e2..584a88c7b4f84e 100644 --- a/tools/phpstan/baseline/level-2.php +++ b/tools/phpstan/baseline/level-2.php @@ -115,24 +115,12 @@ 'count' => 1, 'path' => __DIR__ . '/../../../lib/class-wp-theme-json-resolver-gutenberg.php', ]; -$ignoreErrors[] = [ - // identifier: parameter.notFound - 'message' => '#^PHPDoc tag @param references unknown parameter\\: \\$source_args$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.6/block-bindings/pattern-overrides.php', -]; $ignoreErrors[] = [ // identifier: parameter.notFound 'message' => '#^PHPDoc tag @param references unknown parameter\\: \\$settings$#', 'count' => 1, 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.7/block-bindings.php', ]; -$ignoreErrors[] = [ - // identifier: property.notFound - 'message' => '#^Access to an undefined property WP_Block_Template\\:\\:\\$plugin\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.7/class-gutenberg-rest-templates-controller-6-7.php', -]; $ignoreErrors[] = [ // identifier: property.notFound 'message' => '#^Access to an undefined property WP_Token_Map\\:\\:\\$groups\\.$#', @@ -163,18 +151,6 @@ 'count' => 2, 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.7/class-gutenberg-token-map-6-7.php', ]; -$ignoreErrors[] = [ - // identifier: property.notFound - 'message' => '#^Access to an undefined property WP_Block_Template\\:\\:\\$plugin\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.7/class-wp-block-templates-registry.php', -]; -$ignoreErrors[] = [ - // identifier: property.notFound - 'message' => '#^Access to an undefined property WP_Block_Template\\:\\:\\$plugin\\.$#', - 'count' => 5, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.7/compat.php', -]; $ignoreErrors[] = [ // identifier: property.notFound 'message' => '#^Access to an undefined property object\\:\\:\\$slug\\.$#', @@ -193,18 +169,18 @@ 'count' => 1, 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.7/compat.php', ]; -$ignoreErrors[] = [ - // identifier: property.notFound - 'message' => '#^Access to an undefined property WP_Block_Template\\:\\:\\$plugin\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.7/rest-api.php', -]; $ignoreErrors[] = [ // identifier: method.notFound 'message' => '#^Call to an undefined method object\\:\\:set\\(\\)\\.$#', 'count' => 1, 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.8/block-comments.php', ]; +$ignoreErrors[] = [ + // identifier: property.notFound + 'message' => '#^Access to an undefined property object\\:\\:\\$ID\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.8/class-gutenberg-hierarchical-sort.php', +]; $ignoreErrors[] = [ // identifier: property.notFound 'message' => '#^Access to an undefined property WP_Post\\:\\:\\$content\\.$#', diff --git a/tools/phpstan/baseline/level-3.php b/tools/phpstan/baseline/level-3.php index 6bb509f3d6e2fb..99f178e68e45e5 100644 --- a/tools/phpstan/baseline/level-3.php +++ b/tools/phpstan/baseline/level-3.php @@ -19,12 +19,6 @@ 'count' => 1, 'path' => __DIR__ . '/../../../lib/blocks.php', ]; -$ignoreErrors[] = [ - // identifier: return.type - 'message' => '#^Method WP_Duotone_Gutenberg\\:\\:get_selector\\(\\) should return string but returns null\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../lib/class-wp-duotone-gutenberg.php', -]; $ignoreErrors[] = [ // identifier: method.childParameterType 'message' => '#^Parameter \\#1 \\$id \\(int\\) of method WP_REST_Global_Styles_Controller_Gutenberg\\:\\:prepare_links\\(\\) should be compatible with parameter \\$post \\(WP_Post\\) of method WP_REST_Posts_Controller\\:\\:prepare_links\\(\\)$#', @@ -79,36 +73,6 @@ 'count' => 1, 'path' => __DIR__ . '/../../../lib/class-wp-theme-json-resolver-gutenberg.php', ]; -$ignoreErrors[] = [ - // identifier: return.type - 'message' => '#^Function _gutenberg_get_block_templates_files\\(\\) should return array but returns null\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.6/block-template-utils.php', -]; -$ignoreErrors[] = [ - // identifier: return.type - 'message' => '#^Function gutenberg_replace_pattern_override_default_binding\\(\\) should return string but returns array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.6/blocks.php', -]; -$ignoreErrors[] = [ - // identifier: return.type - 'message' => '#^Method Gutenberg_Token_Map_6_6\\:\\:from_array\\(\\) should return WP_Token_Map\\|null but returns static\\(Gutenberg_Token_Map_6_6\\)\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.6/class-gutenberg-token-map-6-6.php', -]; -$ignoreErrors[] = [ - // identifier: return.type - 'message' => '#^Method Gutenberg_Token_Map_6_6\\:\\:from_precomputed_table\\(\\) should return WP_Token_Map but returns null\\.$#', - 'count' => 2, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.6/class-gutenberg-token-map-6-6.php', -]; -$ignoreErrors[] = [ - // identifier: return.type - 'message' => '#^Method Gutenberg_Token_Map_6_6\\:\\:from_precomputed_table\\(\\) should return WP_Token_Map but returns static\\(Gutenberg_Token_Map_6_6\\)\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.6/class-gutenberg-token-map-6-6.php', -]; $ignoreErrors[] = [ // identifier: offsetAssign.dimType 'message' => '#^Cannot assign offset \'_fields\' to WP_REST_Request\\\\.$#', diff --git a/tools/phpstan/baseline/level-4.php b/tools/phpstan/baseline/level-4.php index 98156dbcbf991e..e78dc15fc7419f 100644 --- a/tools/phpstan/baseline/level-4.php +++ b/tools/phpstan/baseline/level-4.php @@ -56,22 +56,22 @@ 'path' => __DIR__ . '/../../../lib/class-wp-theme-json-gutenberg.php', ]; $ignoreErrors[] = [ - // identifier: booleanAnd.leftAlwaysTrue - 'message' => '#^Left side of && is always true\\.$#', + // identifier: booleanNot.alwaysTrue + 'message' => '#^Negated boolean expression is always true\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.6/block-template-utils.php', + 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.7/class-wp-block-templates-registry.php', ]; $ignoreErrors[] = [ - // identifier: nullCoalesce.property - 'message' => '#^Property WP_Post_Type\\:\\:\\$template \\(array\\\\) on left side of \\?\\? is not nullable\\.$#', + // identifier: empty.offset + 'message' => '#^Offset \'rendered\' on array\\{raw\\: mixed\\} in empty\\(\\) does not exist\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.6/rest-api.php', + 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.8/blocks.php', ]; $ignoreErrors[] = [ - // identifier: booleanNot.alwaysTrue - 'message' => '#^Negated boolean expression is always true\\.$#', + // identifier: deadCode.unreachable + 'message' => '#^Unreachable statement \\- code above always terminates\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.7/class-wp-block-templates-registry.php', + 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.8/blocks.php', ]; $ignoreErrors[] = [ // identifier: return.unusedType diff --git a/tools/phpstan/baseline/level-5.php b/tools/phpstan/baseline/level-5.php index da16d8ccd17106..adda2291e59d2a 100644 --- a/tools/phpstan/baseline/level-5.php +++ b/tools/phpstan/baseline/level-5.php @@ -49,12 +49,6 @@ 'count' => 2, 'path' => __DIR__ . '/../../../lib/client-assets.php', ]; -$ignoreErrors[] = [ - // identifier: argument.type - 'message' => '#^Parameter \\#1 \\$str of function strtoupper expects string, bool given\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.6/class-gutenberg-token-map-6-6.php', -]; $ignoreErrors[] = [ // identifier: argument.type 'message' => '#^Parameter \\#2 \\$value of method WP_HTTP_Response\\:\\:header\\(\\) expects string, int given\\.$#', diff --git a/tools/phpstan/baseline/level-6.php b/tools/phpstan/baseline/level-6.php index a81fe413982bfb..73be2599a0f3f0 100644 --- a/tools/phpstan/baseline/level-6.php +++ b/tools/phpstan/baseline/level-6.php @@ -349,287 +349,293 @@ 'count' => 1, 'path' => __DIR__ . '/../../../lib/compat/plugin/fonts.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Function gutenberg_admin_bar_edit_site_menu\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.6/admin-bar.php', -]; $ignoreErrors[] = [ // identifier: missingType.parameter - 'message' => '#^Function gutenberg_block_bindings_pattern_overrides_callback\\(\\) has parameter \\$source_attrs with no type specified\\.$#', + 'message' => '#^Function gutenberg_add_can_update_block_bindings_editor_setting\\(\\) has parameter \\$editor_settings with no type specified\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.6/block-bindings/pattern-overrides.php', + 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.7/block-bindings.php', ]; $ignoreErrors[] = [ // identifier: missingType.return - 'message' => '#^Function gutenberg_register_block_bindings_pattern_overrides_source\\(\\) has no return type specified\\.$#', + 'message' => '#^Function gutenberg_bootstrap_server_block_bindings_sources\\(\\) has no return type specified\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.6/block-bindings/pattern-overrides.php', + 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.7/block-bindings.php', ]; $ignoreErrors[] = [ // identifier: missingType.generics - 'message' => '#^Method Gutenberg_REST_Global_Styles_Revisions_Controller_6_6\\:\\:prepare_item_for_response\\(\\) has parameter \\$request with generic class WP_REST_Request but does not specify its types\\: T$#', + 'message' => '#^Method Gutenberg_REST_Posts_Controller_6_7\\:\\:get_items\\(\\) has parameter \\$request with generic class WP_REST_Request but does not specify its types\\: T$#', 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.6/class-gutenberg-rest-global-styles-revisions-controller-6-6.php', + 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.7/class-gutenberg-rest-posts-controller-6-7.php', ]; $ignoreErrors[] = [ // identifier: missingType.generics - 'message' => '#^Method Gutenberg_REST_Templates_Controller_6_6\\:\\:get_item_permissions_check\\(\\) has parameter \\$request with generic class WP_REST_Request but does not specify its types\\: T$#', + 'message' => '#^Method Gutenberg_REST_Posts_Controller_6_7\\:\\:prepare_tax_query\\(\\) has parameter \\$request with generic class WP_REST_Request but does not specify its types\\: T$#', 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.6/class-gutenberg-rest-templates-controller-6-6.php', + 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.7/class-gutenberg-rest-posts-controller-6-7.php', ]; $ignoreErrors[] = [ // identifier: missingType.generics - 'message' => '#^Method Gutenberg_REST_Templates_Controller_6_6\\:\\:get_items\\(\\) has parameter \\$request with generic class WP_REST_Request but does not specify its types\\: T$#', + 'message' => '#^Method Gutenberg_REST_Templates_Controller_6_7\\:\\:get_item\\(\\) has parameter \\$request with generic class WP_REST_Request but does not specify its types\\: T$#', 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.6/class-gutenberg-rest-templates-controller-6-6.php', + 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.7/class-gutenberg-rest-templates-controller-6-7.php', ]; $ignoreErrors[] = [ // identifier: missingType.generics - 'message' => '#^Method Gutenberg_REST_Templates_Controller_6_6\\:\\:get_items_permissions_check\\(\\) has parameter \\$request with generic class WP_REST_Request but does not specify its types\\: T$#', + 'message' => '#^Method Gutenberg_REST_Templates_Controller_6_7\\:\\:prepare_item_for_response\\(\\) has parameter \\$request with generic class WP_REST_Request but does not specify its types\\: T$#', 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.6/class-gutenberg-rest-templates-controller-6-6.php', + 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.7/class-gutenberg-rest-templates-controller-6-7.php', ]; $ignoreErrors[] = [ - // identifier: missingType.generics - 'message' => '#^Method Gutenberg_REST_Templates_Controller_6_6\\:\\:get_template_fallback\\(\\) has parameter \\$request with generic class WP_REST_Request but does not specify its types\\: T$#', + // identifier: missingType.return + 'message' => '#^Method WP_Block_Templates_Registry\\:\\:get_by_query\\(\\) has no return type specified\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.6/class-gutenberg-rest-templates-controller-6-6.php', + 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.7/class-wp-block-templates-registry.php', ]; $ignoreErrors[] = [ - // identifier: missingType.generics - 'message' => '#^Method Gutenberg_REST_Templates_Controller_6_6\\:\\:prepare_item_for_response\\(\\) has parameter \\$request with generic class WP_REST_Request but does not specify its types\\: T$#', + // identifier: missingType.property + 'message' => '#^Property WP_Block_Templates_Registry\\:\\:\\$registered_templates has no type specified\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.6/class-gutenberg-rest-templates-controller-6-6.php', + 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.7/class-wp-block-templates-registry.php', ]; $ignoreErrors[] = [ // identifier: missingType.return - 'message' => '#^Function gutenberg_change_patterns_link_and_remove_template_parts_submenu_item\\(\\) has no return type specified\\.$#', + 'message' => '#^Function _gutenberg_add_block_template_plugin_attribute\\(\\) has no return type specified\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.6/compat.php', + 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.7/compat.php', ]; $ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Function gutenberg_update_initial_settings\\(\\) has no return type specified\\.$#', + // identifier: missingType.parameter + 'message' => '#^Function _gutenberg_add_block_template_plugin_attribute\\(\\) has parameter \\$block_template with no type specified\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.6/option.php', + 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.7/compat.php', ]; $ignoreErrors[] = [ - // identifier: missingType.parameter - 'message' => '#^Function gutenberg_update_initial_settings\\(\\) has parameter \\$args with no type specified\\.$#', + // identifier: missingType.return + 'message' => '#^Function gutenberg_post_format_rest_posts_controller\\(\\) has no return type specified\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.6/option.php', + 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.7/post-formats.php', ]; $ignoreErrors[] = [ // identifier: missingType.parameter - 'message' => '#^Function gutenberg_update_initial_settings\\(\\) has parameter \\$defaults with no type specified\\.$#', + 'message' => '#^Function gutenberg_post_format_rest_posts_controller\\(\\) has parameter \\$args with no type specified\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.6/option.php', + 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.7/post-formats.php', ]; $ignoreErrors[] = [ - // identifier: missingType.parameter - 'message' => '#^Function gutenberg_update_initial_settings\\(\\) has parameter \\$option_group with no type specified\\.$#', + // identifier: missingType.return + 'message' => '#^Function gutenberg_register_wp_rest_templates_controller_plugin_field\\(\\) has no return type specified\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.6/option.php', + 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.7/rest-api.php', ]; $ignoreErrors[] = [ - // identifier: missingType.parameter - 'message' => '#^Function gutenberg_update_initial_settings\\(\\) has parameter \\$option_name with no type specified\\.$#', + // identifier: missingType.return + 'message' => '#^Function gutenberg_a11y_script_module_html\\(\\) has no return type specified\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.6/option.php', + 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.7/script-modules.php', ]; $ignoreErrors[] = [ // identifier: missingType.return - 'message' => '#^Function gutenberg_add_excerpt_support_to_wp_block\\(\\) has no return type specified\\.$#', + 'message' => '#^Function exclude_block_comments_from_admin\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.8/block-comments.php', +]; +$ignoreErrors[] = [ + // identifier: missingType.parameter + 'message' => '#^Function exclude_block_comments_from_admin\\(\\) has parameter \\$query with no type specified\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.6/post.php', + 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.8/block-comments.php', ]; $ignoreErrors[] = [ // identifier: missingType.return - 'message' => '#^Function gutenberg_replace_pattern_blocks_patterns_endpoint\\(\\) has no return type specified\\.$#', + 'message' => '#^Function update_comment_type_in_rest_api_6_8\\(\\) has no return type specified\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.6/resolve-patterns.php', + 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.8/block-comments.php', ]; $ignoreErrors[] = [ // identifier: missingType.parameter - 'message' => '#^Function gutenberg_replace_pattern_blocks_patterns_endpoint\\(\\) has parameter \\$request with no type specified\\.$#', + 'message' => '#^Function update_comment_type_in_rest_api_6_8\\(\\) has parameter \\$prepared_comment with no type specified\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.6/resolve-patterns.php', + 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.8/block-comments.php', ]; $ignoreErrors[] = [ // identifier: missingType.parameter - 'message' => '#^Function gutenberg_replace_pattern_blocks_patterns_endpoint\\(\\) has parameter \\$result with no type specified\\.$#', + 'message' => '#^Function update_comment_type_in_rest_api_6_8\\(\\) has parameter \\$request with no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.8/block-comments.php', +]; +$ignoreErrors[] = [ + // identifier: missingType.return + 'message' => '#^Function update_get_avatar_comment_type\\(\\) has no return type specified\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.6/resolve-patterns.php', + 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.8/block-comments.php', ]; $ignoreErrors[] = [ // identifier: missingType.parameter - 'message' => '#^Function gutenberg_replace_pattern_blocks_patterns_endpoint\\(\\) has parameter \\$server with no type specified\\.$#', + 'message' => '#^Function update_get_avatar_comment_type\\(\\) has parameter \\$comment_type with no type specified\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.6/resolve-patterns.php', + 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.8/block-comments.php', ]; $ignoreErrors[] = [ // identifier: missingType.return - 'message' => '#^Function gutenberg_add_class_list_to_public_post_types\\(\\) has no return type specified\\.$#', + 'message' => '#^Function gutenberg_apply_block_hooks_to_post_content\\(\\) has no return type specified\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.6/rest-api.php', + 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.8/blocks.php', ]; $ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Function gutenberg_register_global_styles_revisions_endpoints\\(\\) has no return type specified\\.$#', + // identifier: missingType.parameter + 'message' => '#^Function gutenberg_apply_block_hooks_to_post_content\\(\\) has parameter \\$content with no type specified\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.6/rest-api.php', + 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.8/blocks.php', ]; $ignoreErrors[] = [ // identifier: missingType.return - 'message' => '#^Function gutenberg_register_wp_rest_post_types_controller_fields\\(\\) has no return type specified\\.$#', + 'message' => '#^Method Gutenberg_Hierarchical_Sort\\:\\:add_hierarchical_ids\\(\\) has no return type specified\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.6/rest-api.php', + 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.8/class-gutenberg-hierarchical-sort.php', ]; $ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Function gutenberg_register_wp_rest_themes_stylesheet_directory_uri_field\\(\\) has no return type specified\\.$#', + // identifier: missingType.parameter + 'message' => '#^Method Gutenberg_Hierarchical_Sort\\:\\:add_hierarchical_ids\\(\\) has parameter \\$children with no type specified\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.6/rest-api.php', + 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.8/class-gutenberg-hierarchical-sort.php', ]; $ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Function gutenberg_register_wp_rest_themes_template_directory_uri_field\\(\\) has no return type specified\\.$#', + // identifier: missingType.parameter + 'message' => '#^Method Gutenberg_Hierarchical_Sort\\:\\:add_hierarchical_ids\\(\\) has parameter \\$ids with no type specified\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.6/rest-api.php', + 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.8/class-gutenberg-hierarchical-sort.php', ]; $ignoreErrors[] = [ // identifier: missingType.parameter - 'message' => '#^Function gutenberg_add_can_update_block_bindings_editor_setting\\(\\) has parameter \\$editor_settings with no type specified\\.$#', + 'message' => '#^Method Gutenberg_Hierarchical_Sort\\:\\:add_hierarchical_ids\\(\\) has parameter \\$level with no type specified\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.7/block-bindings.php', + 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.8/class-gutenberg-hierarchical-sort.php', ]; $ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Function gutenberg_bootstrap_server_block_bindings_sources\\(\\) has no return type specified\\.$#', + // identifier: missingType.parameter + 'message' => '#^Method Gutenberg_Hierarchical_Sort\\:\\:add_hierarchical_ids\\(\\) has parameter \\$levels with no type specified\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.7/block-bindings.php', + 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.8/class-gutenberg-hierarchical-sort.php', ]; $ignoreErrors[] = [ - // identifier: missingType.generics - 'message' => '#^Method Gutenberg_REST_Posts_Controller_6_7\\:\\:get_items\\(\\) has parameter \\$request with generic class WP_REST_Request but does not specify its types\\: T$#', + // identifier: missingType.parameter + 'message' => '#^Method Gutenberg_Hierarchical_Sort\\:\\:add_hierarchical_ids\\(\\) has parameter \\$to_process with no type specified\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.7/class-gutenberg-rest-posts-controller-6-7.php', + 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.8/class-gutenberg-hierarchical-sort.php', ]; $ignoreErrors[] = [ - // identifier: missingType.generics - 'message' => '#^Method Gutenberg_REST_Posts_Controller_6_7\\:\\:prepare_tax_query\\(\\) has parameter \\$request with generic class WP_REST_Request but does not specify its types\\: T$#', + // identifier: missingType.return + 'message' => '#^Method Gutenberg_Hierarchical_Sort\\:\\:get_ancestor\\(\\) has no return type specified\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.7/class-gutenberg-rest-posts-controller-6-7.php', + 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.8/class-gutenberg-hierarchical-sort.php', ]; $ignoreErrors[] = [ - // identifier: missingType.generics - 'message' => '#^Method Gutenberg_REST_Templates_Controller_6_7\\:\\:get_item\\(\\) has parameter \\$request with generic class WP_REST_Request but does not specify its types\\: T$#', + // identifier: missingType.parameter + 'message' => '#^Method Gutenberg_Hierarchical_Sort\\:\\:get_ancestor\\(\\) has parameter \\$post_id with no type specified\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.7/class-gutenberg-rest-templates-controller-6-7.php', + 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.8/class-gutenberg-hierarchical-sort.php', ]; $ignoreErrors[] = [ - // identifier: missingType.generics - 'message' => '#^Method Gutenberg_REST_Templates_Controller_6_7\\:\\:prepare_item_for_response\\(\\) has parameter \\$request with generic class WP_REST_Request but does not specify its types\\: T$#', + // identifier: missingType.return + 'message' => '#^Method Gutenberg_Hierarchical_Sort\\:\\:get_instance\\(\\) has no return type specified\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.7/class-gutenberg-rest-templates-controller-6-7.php', + 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.8/class-gutenberg-hierarchical-sort.php', ]; $ignoreErrors[] = [ // identifier: missingType.return - 'message' => '#^Method WP_Block_Templates_Registry\\:\\:get_by_query\\(\\) has no return type specified\\.$#', + 'message' => '#^Method Gutenberg_Hierarchical_Sort\\:\\:get_levels\\(\\) has no return type specified\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.7/class-wp-block-templates-registry.php', + 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.8/class-gutenberg-hierarchical-sort.php', ]; $ignoreErrors[] = [ - // identifier: missingType.property - 'message' => '#^Property WP_Block_Templates_Registry\\:\\:\\$registered_templates has no type specified\\.$#', + // identifier: missingType.return + 'message' => '#^Method Gutenberg_Hierarchical_Sort\\:\\:get_post_ids\\(\\) has no return type specified\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.7/class-wp-block-templates-registry.php', + 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.8/class-gutenberg-hierarchical-sort.php', ]; $ignoreErrors[] = [ // identifier: missingType.return - 'message' => '#^Function _gutenberg_add_block_template_plugin_attribute\\(\\) has no return type specified\\.$#', + 'message' => '#^Method Gutenberg_Hierarchical_Sort\\:\\:run\\(\\) has no return type specified\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.7/compat.php', + 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.8/class-gutenberg-hierarchical-sort.php', ]; $ignoreErrors[] = [ // identifier: missingType.parameter - 'message' => '#^Function _gutenberg_add_block_template_plugin_attribute\\(\\) has parameter \\$block_template with no type specified\\.$#', + 'message' => '#^Method Gutenberg_Hierarchical_Sort\\:\\:run\\(\\) has parameter \\$args with no type specified\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.7/compat.php', + 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.8/class-gutenberg-hierarchical-sort.php', ]; $ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Function gutenberg_post_format_rest_posts_controller\\(\\) has no return type specified\\.$#', + // identifier: missingType.property + 'message' => '#^Property Gutenberg_Hierarchical_Sort\\:\\:\\$instance has no type specified\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.7/post-formats.php', + 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.8/class-gutenberg-hierarchical-sort.php', ]; $ignoreErrors[] = [ - // identifier: missingType.parameter - 'message' => '#^Function gutenberg_post_format_rest_posts_controller\\(\\) has parameter \\$args with no type specified\\.$#', + // identifier: missingType.property + 'message' => '#^Property Gutenberg_Hierarchical_Sort\\:\\:\\$levels has no type specified\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.7/post-formats.php', + 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.8/class-gutenberg-hierarchical-sort.php', ]; $ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Function gutenberg_register_wp_rest_templates_controller_plugin_field\\(\\) has no return type specified\\.$#', + // identifier: missingType.property + 'message' => '#^Property Gutenberg_Hierarchical_Sort\\:\\:\\$post_ids has no type specified\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.7/rest-api.php', + 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.8/class-gutenberg-hierarchical-sort.php', ]; $ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Function gutenberg_a11y_script_module_html\\(\\) has no return type specified\\.$#', + // identifier: missingType.generics + 'message' => '#^Method Gutenberg_REST_Comment_Controller_6_8\\:\\:create_item_permissions_check\\(\\) has parameter \\$request with generic class WP_REST_Request but does not specify its types\\: T$#', 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.7/script-modules.php', + 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.8/class-gutenberg-rest-comment-controller-6-8.php', ]; $ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Function exclude_block_comments_from_admin\\(\\) has no return type specified\\.$#', + // identifier: missingType.generics + 'message' => '#^Method Gutenberg_REST_Post_Types_Controller_6_8\\:\\:prepare_item_for_response\\(\\) has parameter \\$request with generic class WP_REST_Request but does not specify its types\\: T$#', 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.8/block-comments.php', + 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.8/class-gutenberg-rest-post-types-controller-6-8.php', ]; $ignoreErrors[] = [ - // identifier: missingType.parameter - 'message' => '#^Function exclude_block_comments_from_admin\\(\\) has parameter \\$query with no type specified\\.$#', + // identifier: missingType.generics + 'message' => '#^Function gutenberg_modify_user_query_args\\(\\) has parameter \\$request with generic class WP_REST_Request but does not specify its types\\: T$#', 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.8/block-comments.php', + 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.8/class-gutenberg-rest-user-controller.php', ]; $ignoreErrors[] = [ // identifier: missingType.return - 'message' => '#^Function update_comment_type_in_rest_api_6_8\\(\\) has no return type specified\\.$#', + 'message' => '#^Function gutenberg_add_post_type_rendering_mode\\(\\) has no return type specified\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.8/block-comments.php', + 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.8/rest-api.php', ]; $ignoreErrors[] = [ - // identifier: missingType.parameter - 'message' => '#^Function update_comment_type_in_rest_api_6_8\\(\\) has parameter \\$prepared_comment with no type specified\\.$#', + // identifier: missingType.return + 'message' => '#^Function gutenberg_respect_taxonomy_default_args_in_rest_api\\(\\) has no return type specified\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.8/block-comments.php', + 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.8/rest-api.php', ]; $ignoreErrors[] = [ // identifier: missingType.parameter - 'message' => '#^Function update_comment_type_in_rest_api_6_8\\(\\) has parameter \\$request with no type specified\\.$#', + 'message' => '#^Function gutenberg_respect_taxonomy_default_args_in_rest_api\\(\\) has parameter \\$args with no type specified\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.8/block-comments.php', + 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.8/rest-api.php', ]; $ignoreErrors[] = [ // identifier: missingType.return - 'message' => '#^Function update_get_avatar_comment_type\\(\\) has no return type specified\\.$#', + 'message' => '#^Function gutenberg_add_styles_submenu_item\\(\\) has no return type specified\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.8/block-comments.php', + 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.8/site-editor.php', ]; $ignoreErrors[] = [ - // identifier: missingType.parameter - 'message' => '#^Function update_get_avatar_comment_type\\(\\) has parameter \\$comment_type with no type specified\\.$#', + // identifier: missingType.return + 'message' => '#^Function gutenberg_get_site_editor_redirection\\(\\) has no return type specified\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.8/block-comments.php', + 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.8/site-editor.php', ]; $ignoreErrors[] = [ - // identifier: missingType.generics - 'message' => '#^Method Gutenberg_REST_Comment_Controller_6_8\\:\\:create_item_permissions_check\\(\\) has parameter \\$request with generic class WP_REST_Request but does not specify its types\\: T$#', + // identifier: missingType.return + 'message' => '#^Function gutenberg_redirect_site_editor_deprecated_urls\\(\\) has no return type specified\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.8/class-gutenberg-rest-comment-controller-6-8.php', + 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.8/site-editor.php', ]; $ignoreErrors[] = [ // identifier: missingType.return @@ -637,6 +643,18 @@ 'count' => 1, 'path' => __DIR__ . '/../../../lib/demo.php', ]; +$ignoreErrors[] = [ + // identifier: missingType.return + 'message' => '#^Function gutenberg_block_core_form_view_script_module\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../../lib/experimental/blocks.php', +]; +$ignoreErrors[] = [ + // identifier: missingType.parameter + 'message' => '#^Function gutenberg_block_core_form_view_script_module\\(\\) has parameter \\$data with no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../../lib/experimental/blocks.php', +]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method _WP_Editors\\:\\:editor\\(\\) has no return type specified\\.$#', @@ -901,12 +919,6 @@ 'count' => 1, 'path' => __DIR__ . '/../../../lib/experimental/navigation-theme-opt-in.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Function gutenberg_add_post_type_arg\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../lib/experimental/posts/load.php', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Function gutenberg_posts_dashboard\\(\\) has no return type specified\\.$#', diff --git a/tools/phpstan/baseline/level-7.php b/tools/phpstan/baseline/level-7.php index a695d67691c5b0..6de15e3cf3b433 100644 --- a/tools/phpstan/baseline/level-7.php +++ b/tools/phpstan/baseline/level-7.php @@ -19,6 +19,24 @@ 'count' => 1, 'path' => __DIR__ . '/../../../lib/block-supports/elements.php', ]; +$ignoreErrors[] = [ + // identifier: offsetAccess.notFound + 'message' => '#^Offset 1 does not exist on array\\{0\\?\\: string, 1\\?\\: non\\-falsy\\-string, 2\\?\\: non\\-falsy\\-string, 3\\?\\: non\\-falsy\\-string\\}\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../../lib/block-supports/layout.php', +]; +$ignoreErrors[] = [ + // identifier: offsetAccess.notFound + 'message' => '#^Offset 2 does not exist on array\\{0\\?\\: string, 1\\?\\: non\\-falsy\\-string, 2\\?\\: non\\-falsy\\-string, 3\\?\\: non\\-falsy\\-string\\}\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../../lib/block-supports/layout.php', +]; +$ignoreErrors[] = [ + // identifier: offsetAccess.notFound + 'message' => '#^Offset 3 does not exist on array\\{0\\?\\: string, 1\\?\\: non\\-falsy\\-string, 2\\?\\: non\\-falsy\\-string, 3\\?\\: non\\-falsy\\-string\\}\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../../lib/block-supports/layout.php', +]; $ignoreErrors[] = [ // identifier: encapsedStringPart.nonString 'message' => '#^Part \\$process_value \\(array\\\\|string\\) of encapsed string cannot be cast to string\\.$#', @@ -181,48 +199,6 @@ 'count' => 1, 'path' => __DIR__ . '/../../../lib/client-assets.php', ]; -$ignoreErrors[] = [ - // identifier: argument.type - 'message' => '#^Parameter \\#1 \\$post of function _build_block_template_result_from_post expects WP_Post, int\\|WP_Post given\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.6/block-template-utils.php', -]; -$ignoreErrors[] = [ - // identifier: argument.type - 'message' => '#^Parameter \\#2 \\$template_type of function _build_block_template_result_from_file expects \'wp_template\'\\|\'wp_template_part\', string given\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.6/block-template-utils.php', -]; -$ignoreErrors[] = [ - // identifier: property.notFound - 'message' => '#^Access to an undefined property WP_Error\\|WP_Post\\:\\:\\$ID\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.6/class-gutenberg-rest-global-styles-revisions-controller-6-6.php', -]; -$ignoreErrors[] = [ - // identifier: argument.type - 'message' => '#^Parameter \\#1 \\$theme_json of static method WP_Theme_JSON_Resolver_Gutenberg\\:\\:get_resolved_theme_uris\\(\\) expects WP_Theme_JSON_Gutenberg, array\\|WP_Theme_JSON_Gutenberg given\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.6/class-gutenberg-rest-global-styles-revisions-controller-6-6.php', -]; -$ignoreErrors[] = [ - // identifier: offsetAccess.nonOffsetAccessible - 'message' => '#^Cannot access offset 1 on array\\|false\\.$#', - 'count' => 8, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.6/class-gutenberg-token-map-6-6.php', -]; -$ignoreErrors[] = [ - // identifier: argument.type - 'message' => '#^Parameter \\#2 \\$callback of function usort expects callable\\(int\\|string, int\\|string\\)\\: int, \'static\\:\\:longest…\' given\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.6/class-gutenberg-token-map-6-6.php', -]; -$ignoreErrors[] = [ - // identifier: property.notFound - 'message' => '#^Access to an undefined property object\\:\\:\\$item_updated\\.$#', - 'count' => 2, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.6/post.php', -]; $ignoreErrors[] = [ // identifier: argument.type 'message' => '#^Parameter \\#2 \\$args of method WP_Block_Templates_Registry\\:\\:register\\(\\) expects array, array\\|string given\\.$#', @@ -307,6 +283,12 @@ 'count' => 1, 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.7/class-gutenberg-token-map-6-7.php', ]; +$ignoreErrors[] = [ + // identifier: argument.type + 'message' => '#^Parameter \\#1 \\$template_type of function _get_block_templates_files expects \'wp_template\'\\|\'wp_template_part\', string given\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.7/compat.php', +]; $ignoreErrors[] = [ // identifier: argument.type 'message' => '#^Parameter \\#1 \\$data of function wp_print_inline_script_tag expects string, string\\|false given\\.$#', From 146417eaedfa18ea9b8791f58518e9032fae2721 Mon Sep 17 00:00:00 2001 From: Dovid Levine Date: Sat, 28 Dec 2024 18:47:38 +0200 Subject: [PATCH 05/26] docs: fix missing filter `@param` names in WP_Theme_JSON_Resolver_Gutenberg --- lib/class-wp-theme-json-resolver-gutenberg.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/class-wp-theme-json-resolver-gutenberg.php b/lib/class-wp-theme-json-resolver-gutenberg.php index 1f45d897a77cc0..63f1e023a4d738 100644 --- a/lib/class-wp-theme-json-resolver-gutenberg.php +++ b/lib/class-wp-theme-json-resolver-gutenberg.php @@ -170,7 +170,7 @@ public static function get_core_data() { * * @since 6.1.0 * - * @param WP_Theme_JSON_Data_Gutenberg Class to access and update the underlying data. + * @param WP_Theme_JSON_Data_Gutenberg $instance Class to access and update the underlying data. */ $theme_json = apply_filters( 'wp_theme_json_data_default', new WP_Theme_JSON_Data_Gutenberg( $config, 'default' ) ); static::$core = $theme_json->get_theme_json(); @@ -276,7 +276,7 @@ public static function get_theme_data( $deprecated = array(), $options = array() * * @since 6.1.0 * - * @param WP_Theme_JSON_Data_Gutenberg Class to access and update the underlying data. + * @param WP_Theme_JSON_Data_Gutenberg $instance Class to access and update the underlying data. */ $theme_json = apply_filters( 'wp_theme_json_data_theme', new WP_Theme_JSON_Data_Gutenberg( $theme_json_data, 'theme' ) ); static::$theme = $theme_json->get_theme_json(); @@ -411,7 +411,7 @@ public static function get_block_data() { * * @since 6.1.0 * - * @param WP_Theme_JSON_Data_Gutenberg Class to access and update the underlying data. + * @param WP_Theme_JSON_Data_Gutenberg $instance Class to access and update the underlying data. */ $theme_json = apply_filters( 'wp_theme_json_data_blocks', new WP_Theme_JSON_Data_Gutenberg( $config, 'blocks' ) ); static::$blocks = $theme_json->get_theme_json(); @@ -544,7 +544,7 @@ public static function get_user_data() { * * @since 6.1.0 * - * @param WP_Theme_JSON_Data_Gutenberg Class to access and update the underlying data. + * @param WP_Theme_JSON_Data_Gutenberg $instance Class to access and update the underlying data. */ $theme_json = apply_filters( 'wp_theme_json_data_user', new WP_Theme_JSON_Data_Gutenberg( $config, 'custom' ) ); From ce085f9a8157c45d1b8470d8213bfec2a338bd5d Mon Sep 17 00:00:00 2001 From: Dovid Levine Date: Sat, 28 Dec 2024 19:00:59 +0200 Subject: [PATCH 06/26] fix: ensure `base_convert` is type `int` before division --- lib/block-supports/duotone.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/block-supports/duotone.php b/lib/block-supports/duotone.php index 98791fe05c1096..443093dc9c42c1 100644 --- a/lib/block-supports/duotone.php +++ b/lib/block-supports/duotone.php @@ -309,7 +309,7 @@ function gutenberg_tinycolor_string_to_rgb( $color_str ) { ); $rgb['a'] = gutenberg_tinycolor_bound_alpha( - base_convert( $match[4], 16, 10 ) / 255 + absint( base_convert( $match[4], 16, 10 ) ) / 255 ); return $rgb; @@ -341,7 +341,7 @@ function gutenberg_tinycolor_string_to_rgb( $color_str ) { ); $rgb['a'] = gutenberg_tinycolor_bound_alpha( - base_convert( $match[4] . $match[4], 16, 10 ) / 255 + absint( base_convert( $match[4] . $match[4], 16, 10 ) ) / 255 ); return $rgb; From ca4a3cbb4cd94589ecec74ca8cdcb29f4eb2b887 Mon Sep 17 00:00:00 2001 From: Dovid Levine Date: Sat, 28 Dec 2024 19:04:22 +0200 Subject: [PATCH 07/26] docs: fix param name in `gutenberg_add_can_update_block_bindings_editor_setting()` --- lib/compat/wordpress-6.7/block-bindings.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/compat/wordpress-6.7/block-bindings.php b/lib/compat/wordpress-6.7/block-bindings.php index 3cecb7fbc0985c..08608a8d394e72 100644 --- a/lib/compat/wordpress-6.7/block-bindings.php +++ b/lib/compat/wordpress-6.7/block-bindings.php @@ -32,7 +32,7 @@ function gutenberg_bootstrap_server_block_bindings_sources() { /** * Initialize `canUpdateBlockBindings` editor setting if it doesn't exist. By default, it is `true` only for admin users. * - * @param array $settings The block editor settings from the `block_editor_settings_all` filter. + * @param array $editor_settings The block editor settings from the `block_editor_settings_all` filter. * @return array The editor settings including `canUpdateBlockBindings`. */ function gutenberg_add_can_update_block_bindings_editor_setting( $editor_settings ) { From 86f329e40937b697cdbc14fe0e67ced5f47e5bc5 Mon Sep 17 00:00:00 2001 From: Dovid Levine Date: Sat, 28 Dec 2024 19:06:47 +0200 Subject: [PATCH 08/26] docs: fix doctype in _gutenberg_add_block_template_plugin_attribute() --- lib/compat/wordpress-6.7/compat.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/compat/wordpress-6.7/compat.php b/lib/compat/wordpress-6.7/compat.php index 33c123a14860d2..98ea34c813ae43 100644 --- a/lib/compat/wordpress-6.7/compat.php +++ b/lib/compat/wordpress-6.7/compat.php @@ -73,8 +73,8 @@ function ( $registered_template ) use ( $template_files ) { /** * Hooks into `get_block_template` to add the `plugin` property when necessary. * - * @param [WP_Block_Template|null] $block_template The found block template, or null if there isn’t one. - * @return [WP_Block_Template|null] The block template that was already found with the plugin property defined if it was registered by a plugin. + * @param WP_Block_Template|null $block_template The found block template, or null if there isn’t one. + * @return WP_Block_Template|null The block template that was already found with the plugin property defined if it was registered by a plugin. */ function _gutenberg_add_block_template_plugin_attribute( $block_template ) { if ( $block_template ) { From 02fd16c2e637a8f9e1dcbfcfd9399a9ac82e828a Mon Sep 17 00:00:00 2001 From: Dovid Levine Date: Sat, 28 Dec 2024 19:20:30 +0200 Subject: [PATCH 09/26] continue-fix: ensure `base_convert` is type `int` before division --- lib/class-wp-duotone-gutenberg.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/class-wp-duotone-gutenberg.php b/lib/class-wp-duotone-gutenberg.php index cc49c320da6506..8f7b34664d005a 100644 --- a/lib/class-wp-duotone-gutenberg.php +++ b/lib/class-wp-duotone-gutenberg.php @@ -206,7 +206,7 @@ private static function colord_parse_hex( $hex ) { 'r' => (int) base_convert( $hex[0] . $hex[0], 16, 10 ), 'g' => (int) base_convert( $hex[1] . $hex[1], 16, 10 ), 'b' => (int) base_convert( $hex[2] . $hex[2], 16, 10 ), - 'a' => 4 === strlen( $hex ) ? round( base_convert( $hex[3] . $hex[3], 16, 10 ) / 255, 2 ) : 1, + 'a' => 4 === strlen( $hex ) ? round( absint( base_convert( $hex[3] . $hex[3], 16, 10 ) ) / 255, 2 ) : 1, ); } From b463698cce79cf43822d81fd51fa8abadf2c3704 Mon Sep 17 00:00:00 2001 From: Dovid Levine Date: Sat, 28 Dec 2024 19:24:19 +0200 Subject: [PATCH 10/26] docs: fix retun type on gutenberg_get_typography_value_and_unit() --- lib/block-supports/typography.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/block-supports/typography.php b/lib/block-supports/typography.php index a4719b7bdd4099..5c101e843c7e16 100644 --- a/lib/block-supports/typography.php +++ b/lib/block-supports/typography.php @@ -277,7 +277,7 @@ function gutenberg_render_typography_support( $block_content, $block ) { * @type int $root_size_value Value of root font size for rem|em <-> px conversion. Default `16`. * @type array $acceptable_units An array of font size units. Default `[ 'rem', 'px', 'em' ]`; * } - * @return array An array consisting of `'value'` and `'unit'` properties. + * @return ?array An array consisting of `'value'` and `'unit'` properties. */ function gutenberg_get_typography_value_and_unit( $raw_value, $options = array() ) { if ( ! is_string( $raw_value ) && ! is_int( $raw_value ) && ! is_float( $raw_value ) ) { From dd0c1d23b8c86d9e282b682bfb9016b86f629d2f Mon Sep 17 00:00:00 2001 From: Dovid Levine Date: Sat, 28 Dec 2024 19:30:27 +0200 Subject: [PATCH 11/26] docs: fix missing `false` return type on gutenberg_register_block_module_id() --- lib/experimental/script-modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/experimental/script-modules.php b/lib/experimental/script-modules.php index 5a14e1418ed6de..9657fdad4a7254 100644 --- a/lib/experimental/script-modules.php +++ b/lib/experimental/script-modules.php @@ -55,7 +55,7 @@ function gutenberg_filter_block_type_metadata_settings_register_view_module( $se * @param string $field_name Field name to pick from metadata. * @param int $index Optional. Index of the script to register when multiple items passed. * Default 0. - * @return string Module ID. + * @return string|false Module ID. */ function gutenberg_register_block_module_id( $metadata, $field_name, $index = 0 ) { if ( empty( $metadata[ $field_name ] ) ) { From 36641f5cc46eefcac746f69b3ba312a8695c826f Mon Sep 17 00:00:00 2001 From: Dovid Levine Date: Sat, 28 Dec 2024 19:36:17 +0200 Subject: [PATCH 12/26] fix: check contents of `$matches[1]` in gutenberg_get_block_style_variation_name_from_class() --- lib/block-supports/block-style-variations.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/block-supports/block-style-variations.php b/lib/block-supports/block-style-variations.php index 5f7d02007ed396..dbc27af5ba922b 100644 --- a/lib/block-supports/block-style-variations.php +++ b/lib/block-supports/block-style-variations.php @@ -38,7 +38,7 @@ function gutenberg_get_block_style_variation_name_from_class( $class_string ) { } preg_match_all( '/\bis-style-(?!default)(\S+)\b/', $class_string, $matches ); - return $matches[1] ?? null; + return ! empty( $matches[1] ) ? $matches[1] : null; } /** From e3554f2090e6ca443849a84773d9b772a32cb5e4 Mon Sep 17 00:00:00 2001 From: Dovid Levine Date: Sat, 28 Dec 2024 19:40:11 +0200 Subject: [PATCH 13/26] fix: strict int to float comparison in gutenberg_tinycolor_bound01() --- lib/block-supports/duotone.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/block-supports/duotone.php b/lib/block-supports/duotone.php index 443093dc9c42c1..0f7573807dfab8 100644 --- a/lib/block-supports/duotone.php +++ b/lib/block-supports/duotone.php @@ -80,7 +80,7 @@ function gutenberg_tinycolor_bound01( $n, $max ) { _deprecated_function( __FUNCTION__, '6.3.0' ); - if ( 'string' === gettype( $n ) && str_contains( $n, '.' ) && 1 === (float) $n ) { + if ( 'string' === gettype( $n ) && str_contains( $n, '.' ) && 1.0 === (float) $n ) { $n = '100%'; } From dbd04826c324861bd80e31bf1f3e4781f1764718 Mon Sep 17 00:00:00 2001 From: Dovid Levine Date: Sat, 28 Dec 2024 19:46:53 +0200 Subject: [PATCH 14/26] chore: remove always-true from condition in `gutenberg_register_shadow_support()` --- lib/block-supports/shadow.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/block-supports/shadow.php b/lib/block-supports/shadow.php index 25c365067e0c32..501857cb715824 100644 --- a/lib/block-supports/shadow.php +++ b/lib/block-supports/shadow.php @@ -21,13 +21,13 @@ function gutenberg_register_shadow_support( $block_type ) { $block_type->attributes = array(); } - if ( $has_shadow_support && ! array_key_exists( 'style', $block_type->attributes ) ) { + if ( ! array_key_exists( 'style', $block_type->attributes ) ) { $block_type->attributes['style'] = array( 'type' => 'object', ); } - if ( $has_shadow_support && ! array_key_exists( 'shadow', $block_type->attributes ) ) { + if ( ! array_key_exists( 'shadow', $block_type->attributes ) ) { $block_type->attributes['shadow'] = array( 'type' => 'string', ); From 5536a3bed6720526bffd1a5e4b8dc8f87f3601b0 Mon Sep 17 00:00:00 2001 From: Dovid Levine Date: Sat, 28 Dec 2024 19:52:17 +0200 Subject: [PATCH 15/26] fix: undefined array key in WP_Duotone_Gutenberg::colord_parse_hue() --- lib/class-wp-duotone-gutenberg.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/class-wp-duotone-gutenberg.php b/lib/class-wp-duotone-gutenberg.php index 8f7b34664d005a..d48f3c358fd4c1 100644 --- a/lib/class-wp-duotone-gutenberg.php +++ b/lib/class-wp-duotone-gutenberg.php @@ -172,10 +172,8 @@ private static function colord_parse_hue( $value, $unit = 'deg' ) { 'rad' => 360 / ( M_PI * 2 ), ); - $factor = $angle_units[ $unit ]; - if ( ! $factor ) { - $factor = 1; - } + // If the unit is not recognized, default to degrees. + $factor = $angle_units[ $unit ] ?? 1; return (float) $value * $factor; } From 97a2c76a1d9afd7a95a6547d25a6d20852ee073b Mon Sep 17 00:00:00 2001 From: Dovid Levine Date: Sat, 28 Dec 2024 19:57:56 +0200 Subject: [PATCH 16/26] chore: remove dead code in WP_Theme_JSON_Gutenberg::get_block_nodes() --- lib/class-wp-theme-json-gutenberg.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/lib/class-wp-theme-json-gutenberg.php b/lib/class-wp-theme-json-gutenberg.php index 3af123d96bcc5a..737361ef590985 100644 --- a/lib/class-wp-theme-json-gutenberg.php +++ b/lib/class-wp-theme-json-gutenberg.php @@ -2823,12 +2823,6 @@ private static function get_block_nodes( $theme_json, $selectors = array(), $opt foreach ( static::VALID_ELEMENT_PSEUDO_SELECTORS[ $element ] as $pseudo_selector ) { if ( isset( $theme_json['styles']['blocks'][ $name ]['elements'][ $element ][ $pseudo_selector ] ) ) { $node_path = array( 'styles', 'blocks', $name, 'elements', $element ); - if ( $include_node_paths_only ) { - $nodes[] = array( - 'path' => $node_path, - ); - continue; - } $nodes[] = array( 'path' => $node_path, From 010a236b35f37a366ff20e1c63f1cfa9f8d93025 Mon Sep 17 00:00:00 2001 From: Dovid Levine Date: Sat, 28 Dec 2024 20:03:19 +0200 Subject: [PATCH 17/26] fix: incorrect conditional check in WP_Theme_JSON_Gutenberg::convert_variables_to_values() --- lib/class-wp-theme-json-gutenberg.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/class-wp-theme-json-gutenberg.php b/lib/class-wp-theme-json-gutenberg.php index 737361ef590985..26ca3875770679 100644 --- a/lib/class-wp-theme-json-gutenberg.php +++ b/lib/class-wp-theme-json-gutenberg.php @@ -4477,7 +4477,7 @@ private static function convert_variables_to_value( $styles, $values ) { continue; } - if ( 0 <= strpos( $style, 'var(' ) ) { + if ( false !== strpos( $style, 'var(' ) ) { // find all the variables in the string in the form of var(--variable-name, fallback), with fallback in the second capture group. $has_matches = preg_match_all( '/var\(([^),]+)?,?\s?(\S+)?\)/', $style, $var_parts ); From b0ed7bc9a2ba1e0069fdbe67cd9a406b2d51c3ba Mon Sep 17 00:00:00 2001 From: Dovid Levine Date: Sat, 28 Dec 2024 20:12:02 +0200 Subject: [PATCH 18/26] fix: check for `empty( $menu_items )` in gutenberg_remove_block_nav_menu_items() --- lib/experimental/navigation-theme-opt-in.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/experimental/navigation-theme-opt-in.php b/lib/experimental/navigation-theme-opt-in.php index 547aa8b88ea7d1..6c5dbbe78c3be9 100644 --- a/lib/experimental/navigation-theme-opt-in.php +++ b/lib/experimental/navigation-theme-opt-in.php @@ -155,8 +155,8 @@ function gutenberg_remove_block_nav_menu_items( $menu_items ) { // We should uncomment the line below when the block-nav-menus feature becomes stable. // @see https://github.com/WordPress/gutenberg/issues/34265. /*if ( current_theme_supports( 'block-nav-menus' ) ) {*/ - if ( false ) { - return $menu_items; + if ( empty( $menu_items ) ) { + return []; } return array_filter( From 968d248d4431f5b83d63a47dfd1a636ee7f48ab5 Mon Sep 17 00:00:00 2001 From: Dovid Levine Date: Sat, 28 Dec 2024 20:14:57 +0200 Subject: [PATCH 19/26] fix: cast `$parent_column_value` before exploding in gutenberg_render_layout_support_flag() --- lib/block-supports/layout.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/block-supports/layout.php b/lib/block-supports/layout.php index 7d63074ccb09bb..d00b130794fedd 100644 --- a/lib/block-supports/layout.php +++ b/lib/block-supports/layout.php @@ -656,7 +656,7 @@ function gutenberg_render_layout_support_flag( $block_content, $block ) { $column_start_number = floatval( $column_start ); $parent_column_width = $minimum_column_width ? $minimum_column_width : '12rem'; $parent_column_value = floatval( $parent_column_width ); - $parent_column_unit = explode( $parent_column_value, $parent_column_width ); + $parent_column_unit = explode( (string) $parent_column_value, $parent_column_width ); $num_cols_to_break_at = 2; if ( $column_span_number && $column_start_number ) { From a648cfdbfd288041657b559f266a5fbfd3fccd14 Mon Sep 17 00:00:00 2001 From: Dovid Levine Date: Sat, 28 Dec 2024 20:17:52 +0200 Subject: [PATCH 20/26] fix: cast `$match[1]` to float in WP_DuotoneGutenberg::colord_parse_hsla_string() --- lib/class-wp-duotone-gutenberg.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/class-wp-duotone-gutenberg.php b/lib/class-wp-duotone-gutenberg.php index d48f3c358fd4c1..69e5c452ef00af 100644 --- a/lib/class-wp-duotone-gutenberg.php +++ b/lib/class-wp-duotone-gutenberg.php @@ -408,7 +408,7 @@ private static function colord_parse_hsla_string( $input ) { $hsla = self::colord_clamp_hsla( array( - 'h' => self::colord_parse_hue( $match[1], $match[2] ), + 'h' => self::colord_parse_hue( (float) $match[1], $match[2] ), 's' => (float) $match[3], 'l' => (float) $match[4], 'a' => '' === $match[5] ? 1 : (float) $match[5] / ( $match[6] ? 100 : 1 ), From 7bb19e3969f28c2366ce7bf022c75a3d772b870f Mon Sep 17 00:00:00 2001 From: Dovid Levine Date: Sat, 28 Dec 2024 20:22:11 +0200 Subject: [PATCH 21/26] docs: fix $metadata param type in WP_Theme_JSON_Gutenberg::get_feature_declarations_for_node() --- lib/class-wp-theme-json-gutenberg.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/class-wp-theme-json-gutenberg.php b/lib/class-wp-theme-json-gutenberg.php index 26ca3875770679..68c03859314baa 100644 --- a/lib/class-wp-theme-json-gutenberg.php +++ b/lib/class-wp-theme-json-gutenberg.php @@ -4319,7 +4319,7 @@ protected static function get_block_element_selectors( $root_selector ) { * typography etc, that have custom selectors in their related block's * metadata. * - * @param object $metadata The related block metadata containing selectors. + * @param array $metadata The related block metadata containing selectors. * @param object $node A merged theme.json node for block or variation. * * @return array The style declarations for the node's features with custom From 62a39900f3381f279538258689061cdb8e0badc7 Mon Sep 17 00:00:00 2001 From: Dovid Levine Date: Sat, 28 Dec 2024 20:27:54 +0200 Subject: [PATCH 22/26] fix: invalid `_doing_it_wrong()` for `experimental-link-color` --- lib/class-wp-theme-json-resolver-gutenberg.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/class-wp-theme-json-resolver-gutenberg.php b/lib/class-wp-theme-json-resolver-gutenberg.php index 63f1e023a4d738..729c0c2014d416 100644 --- a/lib/class-wp-theme-json-resolver-gutenberg.php +++ b/lib/class-wp-theme-json-resolver-gutenberg.php @@ -359,7 +359,7 @@ public static function get_theme_data( $deprecated = array(), $options = array() } if ( current_theme_supports( 'experimental-link-color' ) ) { _doing_it_wrong( - current_theme_supports( 'experimental-link-color' ), + "add_theme_support( 'experimental-link-color' )", __( '`experimental-link-color` is no longer supported. Use `link-color` instead.', 'gutenberg' ), '6.3.0' ); From 08e20b401a649936d7bebc45dcbe5dac15feb314 Mon Sep 17 00:00:00 2001 From: Dovid Levine Date: Sat, 28 Dec 2024 20:29:49 +0200 Subject: [PATCH 23/26] fix: remove invalid param from wp_register_style() in gutenberg_enqueue_stored_styles() --- lib/client-assets.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/client-assets.php b/lib/client-assets.php index f95ac27f81d010..4a94ca212c3422 100644 --- a/lib/client-assets.php +++ b/lib/client-assets.php @@ -539,7 +539,7 @@ function gutenberg_enqueue_stored_styles( $options = array() ) { // Combines Core styles. if ( ! empty( $compiled_core_stylesheet ) ) { - wp_register_style( $style_tag_id, false, array(), true, true ); + wp_register_style( $style_tag_id, false, array(), true ); wp_add_inline_style( $style_tag_id, $compiled_core_stylesheet ); wp_enqueue_style( $style_tag_id ); } @@ -562,7 +562,7 @@ function gutenberg_enqueue_stored_styles( $options = array() ) { $styles = gutenberg_style_engine_get_stylesheet_from_context( $store_name, $options ); if ( ! empty( $styles ) ) { $key = "wp-style-engine-$store_name"; - wp_register_style( $key, false, array(), true, true ); + wp_register_style( $key, false, array(), true ); wp_add_inline_style( $key, $styles ); wp_enqueue_style( $key ); } From 2cdedf1ac58e537e80561f7aa74ec1ca7fc39ae1 Mon Sep 17 00:00:00 2001 From: Dovid Levine Date: Sat, 28 Dec 2024 20:32:52 +0200 Subject: [PATCH 24/26] fix: incorrect condiional check in Gutenberg_Token_Map_6_7::read_small_token() --- lib/compat/wordpress-6.7/class-gutenberg-token-map-6-7.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/compat/wordpress-6.7/class-gutenberg-token-map-6-7.php b/lib/compat/wordpress-6.7/class-gutenberg-token-map-6-7.php index a2142171ddc14f..d29cf159a9f103 100644 --- a/lib/compat/wordpress-6.7/class-gutenberg-token-map-6-7.php +++ b/lib/compat/wordpress-6.7/class-gutenberg-token-map-6-7.php @@ -607,7 +607,7 @@ private function read_small_token( string $text, int $offset = 0, &$matched_toke if ( $search_text[ $adjust ] !== $this->small_words[ $at + $adjust ] && - ( ! $ignore_case || strtoupper( $this->small_words[ $at + $adjust ] !== $search_text[ $adjust ] ) ) + ( ! $ignore_case || strtoupper( $this->small_words[ $at + $adjust ] ) !== $search_text[ $adjust ] ) ) { $at += $this->key_length + 1; continue 2; From 7b6b73527dd0cc2a1dca33a0dee9024bbf70fcc3 Mon Sep 17 00:00:00 2001 From: Dovid Levine Date: Sat, 28 Dec 2024 20:36:12 +0200 Subject: [PATCH 25/26] fix: setcookie() $value must be string in Gutenberg_HTTP_Signaling_Server::handle_read_pending_messages() --- .../sync/class-gutenberg-http-signaling-server.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/experimental/sync/class-gutenberg-http-signaling-server.php b/lib/experimental/sync/class-gutenberg-http-signaling-server.php index a41e26fdac163a..3448e82a4c31d0 100644 --- a/lib/experimental/sync/class-gutenberg-http-signaling-server.php +++ b/lib/experimental/sync/class-gutenberg-http-signaling-server.php @@ -172,7 +172,7 @@ private static function handle_read_pending_messages( $subscriber_to_messages_pa if ( ! $fd ) { $retries = isset( $_COOKIE['signaling_server_retries'] ) ? intval( $_COOKIE['signaling_server_retries'] ) : 0; $secure = ( 'https' === parse_url( home_url(), PHP_URL_SCHEME ) ); - setcookie( 'signaling_server_retries', $retries + 1, time() + DAY_IN_SECONDS, SITECOOKIEPATH, '', $secure ); + setcookie( 'signaling_server_retries', (string) ( $retries + 1 ), time() + DAY_IN_SECONDS, SITECOOKIEPATH, '', $secure ); echo 'id: ' . time() . PHP_EOL; echo 'event: error' . PHP_EOL; echo 'data: ' . 'Could not open required file.' . PHP_EOL . PHP_EOL; @@ -183,7 +183,7 @@ private static function handle_read_pending_messages( $subscriber_to_messages_pa if ( isset( $_COOKIE['signaling_server_retries'] ) ) { $secure = ( 'https' === parse_url( home_url(), PHP_URL_SCHEME ) ); // unset the cookie using a past expiration date. - setcookie( 'signaling_server_retries', 0, time() - DAY_IN_SECONDS, SITECOOKIEPATH, '', $secure ); + setcookie( 'signaling_server_retries', '0', time() - DAY_IN_SECONDS, SITECOOKIEPATH, '', $secure ); } echo 'retry: 3000' . PHP_EOL; From 3e4c5573156025ea1da70da844fcc987e2b15a7d Mon Sep 17 00:00:00 2001 From: Dovid Levine Date: Mon, 30 Dec 2024 13:14:07 +0200 Subject: [PATCH 26/26] [PHPStan]: generate baselines --- tools/phpstan/baseline/level-0.php | 6 - tools/phpstan/baseline/level-2.php | 60 --------- tools/phpstan/baseline/level-3.php | 49 ++++++-- tools/phpstan/baseline/level-4.php | 48 ------- tools/phpstan/baseline/level-5.php | 38 +----- tools/phpstan/baseline/level-6.php | 18 --- tools/phpstan/baseline/level-7.php | 18 ++- tools/phpstan/baseline/level-8.php | 194 +++++------------------------ 8 files changed, 83 insertions(+), 348 deletions(-) diff --git a/tools/phpstan/baseline/level-0.php b/tools/phpstan/baseline/level-0.php index 1a8510b0f056e3..7cf7bba9030a36 100644 --- a/tools/phpstan/baseline/level-0.php +++ b/tools/phpstan/baseline/level-0.php @@ -7,12 +7,6 @@ 'count' => 1, 'path' => __DIR__ . '/../../../lib/block-supports/duotone.php', ]; -$ignoreErrors[] = [ - // identifier: phpDoc.parseError - 'message' => '#^One or more @param tags has an invalid name or invalid syntax\\.$#', - 'count' => 4, - 'path' => __DIR__ . '/../../../lib/class-wp-theme-json-resolver-gutenberg.php', -]; $ignoreErrors[] = [ // identifier: class.notFound 'message' => '#^Call to static method get_stores\\(\\) on an unknown class WP_Style_Engine_CSS_Rules_Store_Gutenberg\\.$#', diff --git a/tools/phpstan/baseline/level-2.php b/tools/phpstan/baseline/level-2.php index 584a88c7b4f84e..b2ea164243ec6e 100644 --- a/tools/phpstan/baseline/level-2.php +++ b/tools/phpstan/baseline/level-2.php @@ -1,24 +1,12 @@ '#^Binary operation "/" between string and 255 results in an error\\.$#', - 'count' => 2, - 'path' => __DIR__ . '/../../../lib/block-supports/duotone.php', -]; $ignoreErrors[] = [ // identifier: method.void 'message' => '#^Result of method WP_HTML_Tag_Processor\\:\\:class_list\\(\\) \\(void\\) is used\\.$#', 'count' => 1, 'path' => __DIR__ . '/../../../lib/block-supports/layout.php', ]; -$ignoreErrors[] = [ - // identifier: binaryOp.invalid - 'message' => '#^Binary operation "/" between string and 255 results in an error\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../lib/class-wp-duotone-gutenberg.php', -]; $ignoreErrors[] = [ // identifier: staticClassAccess.privateMethod 'message' => '#^Unsafe call to private method WP_Theme_JSON_Gutenberg\\:\\:compute_spacing_sizes\\(\\) through static\\:\\:\\.$#', @@ -61,30 +49,6 @@ 'count' => 1, 'path' => __DIR__ . '/../../../lib/class-wp-theme-json-gutenberg.php', ]; -$ignoreErrors[] = [ - // identifier: phpDoc.parseError - 'message' => '#^PHPDoc tag @param has invalid value \\(WP_Theme_JSON_Data_Gutenberg Class to access and update the underlying data\\.\\)\\: Unexpected token "Class", expected variable at offset 148$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../lib/class-wp-theme-json-resolver-gutenberg.php', -]; -$ignoreErrors[] = [ - // identifier: phpDoc.parseError - 'message' => '#^PHPDoc tag @param has invalid value \\(WP_Theme_JSON_Data_Gutenberg Class to access and update the underlying data\\.\\)\\: Unexpected token "Class", expected variable at offset 154$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../lib/class-wp-theme-json-resolver-gutenberg.php', -]; -$ignoreErrors[] = [ - // identifier: phpDoc.parseError - 'message' => '#^PHPDoc tag @param has invalid value \\(WP_Theme_JSON_Data_Gutenberg Class to access and update the underlying data\\.\\)\\: Unexpected token "Class", expected variable at offset 155$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../lib/class-wp-theme-json-resolver-gutenberg.php', -]; -$ignoreErrors[] = [ - // identifier: phpDoc.parseError - 'message' => '#^PHPDoc tag @param has invalid value \\(WP_Theme_JSON_Data_Gutenberg Class to access and update the underlying data\\.\\)\\: Unexpected token "Class", expected variable at offset 156$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../lib/class-wp-theme-json-resolver-gutenberg.php', -]; $ignoreErrors[] = [ // identifier: staticClassAccess.privateMethod 'message' => '#^Unsafe call to private method WP_Theme_JSON_Resolver_Gutenberg\\:\\:inject_variations_from_block_style_variation_files\\(\\) through static\\:\\:\\.$#', @@ -115,12 +79,6 @@ 'count' => 1, 'path' => __DIR__ . '/../../../lib/class-wp-theme-json-resolver-gutenberg.php', ]; -$ignoreErrors[] = [ - // identifier: parameter.notFound - 'message' => '#^PHPDoc tag @param references unknown parameter\\: \\$settings$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.7/block-bindings.php', -]; $ignoreErrors[] = [ // identifier: property.notFound 'message' => '#^Access to an undefined property WP_Token_Map\\:\\:\\$groups\\.$#', @@ -151,24 +109,6 @@ 'count' => 2, 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.7/class-gutenberg-token-map-6-7.php', ]; -$ignoreErrors[] = [ - // identifier: property.notFound - 'message' => '#^Access to an undefined property object\\:\\:\\$slug\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.7/compat.php', -]; -$ignoreErrors[] = [ - // identifier: phpDoc.parseError - 'message' => '#^PHPDoc tag @param has invalid value \\(\\[WP_Block_Template\\|null\\] \\$block_template The found block template, or null if there isn’t one\\.\\)\\: Unexpected token "\\|", expected \'\\]\' at offset 115$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.7/compat.php', -]; -$ignoreErrors[] = [ - // identifier: phpDoc.parseError - 'message' => '#^PHPDoc tag @return has invalid value \\(\\[WP_Block_Template\\|null\\] The block template that was already found with the plugin property defined if it was registered by a plugin\\.\\)\\: Unexpected token "\\|", expected \'\\]\' at offset 223$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.7/compat.php', -]; $ignoreErrors[] = [ // identifier: method.notFound 'message' => '#^Call to an undefined method object\\:\\:set\\(\\)\\.$#', diff --git a/tools/phpstan/baseline/level-3.php b/tools/phpstan/baseline/level-3.php index 99f178e68e45e5..2f08875a49f680 100644 --- a/tools/phpstan/baseline/level-3.php +++ b/tools/phpstan/baseline/level-3.php @@ -7,12 +7,6 @@ 'count' => 1, 'path' => __DIR__ . '/../../../lib/block-supports/layout.php', ]; -$ignoreErrors[] = [ - // identifier: return.type - 'message' => '#^Function gutenberg_get_typography_value_and_unit\\(\\) should return array but returns null\\.$#', - 'count' => 3, - 'path' => __DIR__ . '/../../../lib/block-supports/typography.php', -]; $ignoreErrors[] = [ // identifier: return.empty 'message' => '#^Function _gutenberg_footnotes_force_filtered_html_on_import_filter\\(\\) should return string but empty return statement found\\.$#', @@ -37,12 +31,42 @@ 'count' => 1, 'path' => __DIR__ . '/../../../lib/class-wp-theme-json-gutenberg.php', ]; +$ignoreErrors[] = [ + // identifier: return.type + 'message' => '#^Method WP_Theme_JSON_Resolver_Gutenberg\\:\\:get_block_data\\(\\) should return WP_Theme_JSON_Gutenberg but returns WP_Theme_JSON\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../../lib/class-wp-theme-json-resolver-gutenberg.php', +]; +$ignoreErrors[] = [ + // identifier: return.type + 'message' => '#^Method WP_Theme_JSON_Resolver_Gutenberg\\:\\:get_core_data\\(\\) should return WP_Theme_JSON_Gutenberg but returns WP_Theme_JSON\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../../lib/class-wp-theme-json-resolver-gutenberg.php', +]; +$ignoreErrors[] = [ + // identifier: return.type + 'message' => '#^Method WP_Theme_JSON_Resolver_Gutenberg\\:\\:get_user_data\\(\\) should return WP_Theme_JSON_Gutenberg but returns WP_Theme_JSON\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../../lib/class-wp-theme-json-resolver-gutenberg.php', +]; +$ignoreErrors[] = [ + // identifier: assign.propertyType + 'message' => '#^Static property WP_Theme_JSON_Resolver_Gutenberg\\:\\:\\$blocks \\(WP_Theme_JSON_Gutenberg\\) does not accept WP_Theme_JSON\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../../lib/class-wp-theme-json-resolver-gutenberg.php', +]; $ignoreErrors[] = [ // identifier: assign.propertyType 'message' => '#^Static property WP_Theme_JSON_Resolver_Gutenberg\\:\\:\\$blocks \\(WP_Theme_JSON_Gutenberg\\) does not accept null\\.$#', 'count' => 1, 'path' => __DIR__ . '/../../../lib/class-wp-theme-json-resolver-gutenberg.php', ]; +$ignoreErrors[] = [ + // identifier: assign.propertyType + 'message' => '#^Static property WP_Theme_JSON_Resolver_Gutenberg\\:\\:\\$core \\(WP_Theme_JSON_Gutenberg\\) does not accept WP_Theme_JSON\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../../lib/class-wp-theme-json-resolver-gutenberg.php', +]; $ignoreErrors[] = [ // identifier: assign.propertyType 'message' => '#^Static property WP_Theme_JSON_Resolver_Gutenberg\\:\\:\\$core \\(WP_Theme_JSON_Gutenberg\\) does not accept null\\.$#', @@ -55,6 +79,12 @@ 'count' => 1, 'path' => __DIR__ . '/../../../lib/class-wp-theme-json-resolver-gutenberg.php', ]; +$ignoreErrors[] = [ + // identifier: assign.propertyType + 'message' => '#^Static property WP_Theme_JSON_Resolver_Gutenberg\\:\\:\\$theme \\(WP_Theme_JSON_Gutenberg\\) does not accept WP_Theme_JSON\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../../lib/class-wp-theme-json-resolver-gutenberg.php', +]; $ignoreErrors[] = [ // identifier: assign.propertyType 'message' => '#^Static property WP_Theme_JSON_Resolver_Gutenberg\\:\\:\\$theme \\(WP_Theme_JSON_Gutenberg\\) does not accept null\\.$#', @@ -91,11 +121,4 @@ 'count' => 1, 'path' => __DIR__ . '/../../../lib/experimental/media/class-gutenberg-rest-attachments-controller.php', ]; -$ignoreErrors[] = [ - // identifier: return.type - 'message' => '#^Function gutenberg_register_block_module_id\\(\\) should return string but returns false\\.$#', - 'count' => 2, - 'path' => __DIR__ . '/../../../lib/experimental/script-modules.php', -]; - return ['parameters' => ['ignoreErrors' => $ignoreErrors]]; diff --git a/tools/phpstan/baseline/level-4.php b/tools/phpstan/baseline/level-4.php index e78dc15fc7419f..7bc045b8d22ba2 100644 --- a/tools/phpstan/baseline/level-4.php +++ b/tools/phpstan/baseline/level-4.php @@ -7,54 +7,12 @@ 'count' => 1, 'path' => __DIR__ . '/../../../gutenberg.php', ]; -$ignoreErrors[] = [ - // identifier: nullCoalesce.offset - 'message' => '#^Offset 1 on array\\{array\\, array\\\\} on left side of \\?\\? always exists and is not nullable\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../lib/block-supports/block-style-variations.php', -]; -$ignoreErrors[] = [ - // identifier: booleanAnd.alwaysFalse - 'message' => '#^Result of && is always false\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../lib/block-supports/duotone.php', -]; -$ignoreErrors[] = [ - // identifier: identical.alwaysFalse - 'message' => '#^Strict comparison using \\=\\=\\= between 1 and float will always evaluate to false\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../lib/block-supports/duotone.php', -]; $ignoreErrors[] = [ // identifier: booleanOr.alwaysTrue 'message' => '#^Result of \\|\\| is always true\\.$#', 'count' => 1, 'path' => __DIR__ . '/../../../lib/block-supports/position.php', ]; -$ignoreErrors[] = [ - // identifier: booleanAnd.leftAlwaysTrue - 'message' => '#^Left side of && is always true\\.$#', - 'count' => 2, - 'path' => __DIR__ . '/../../../lib/block-supports/shadow.php', -]; -$ignoreErrors[] = [ - // identifier: booleanNot.alwaysFalse - 'message' => '#^Negated boolean expression is always false\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../lib/class-wp-duotone-gutenberg.php', -]; -$ignoreErrors[] = [ - // identifier: smallerOrEqual.alwaysTrue - 'message' => '#^Comparison operation "\\<\\=" between 0 and int\\<0, max\\>\\|false is always true\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../lib/class-wp-theme-json-gutenberg.php', -]; -$ignoreErrors[] = [ - // identifier: if.alwaysFalse - 'message' => '#^If condition is always false\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../lib/class-wp-theme-json-gutenberg.php', -]; $ignoreErrors[] = [ // identifier: booleanNot.alwaysTrue 'message' => '#^Negated boolean expression is always true\\.$#', @@ -79,12 +37,6 @@ 'count' => 1, 'path' => __DIR__ . '/../../../lib/experimental/navigation-theme-opt-in.php', ]; -$ignoreErrors[] = [ - // identifier: if.alwaysFalse - 'message' => '#^If condition is always false\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../lib/experimental/navigation-theme-opt-in.php', -]; $ignoreErrors[] = [ // identifier: if.alwaysTrue 'message' => '#^If condition is always true\\.$#', diff --git a/tools/phpstan/baseline/level-5.php b/tools/phpstan/baseline/level-5.php index adda2291e59d2a..0f566cc4068be9 100644 --- a/tools/phpstan/baseline/level-5.php +++ b/tools/phpstan/baseline/level-5.php @@ -1,24 +1,12 @@ '#^Parameter \\#1 \\$separator of function explode expects string, float given\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../lib/block-supports/layout.php', -]; $ignoreErrors[] = [ // identifier: argument.type 'message' => '#^Parameter \\#2 \\$args of function register_block_type expects array\\{api_version\\?\\: string, title\\?\\: string, category\\?\\: string\\|null, parent\\?\\: array\\\\|null, ancestor\\?\\: array\\\\|null, allowed_blocks\\?\\: array\\\\|null, icon\\?\\: string\\|null, description\\?\\: string, \\.\\.\\.\\}, array\\{category\\: \'widgets\', attributes\\: array\\{url\\: array\\{type\\: \'string\'\\}, service\\: array\\{type\\: \'string\', default\\: \'amazon\'\\|\'bandcamp\'\\|\'behance\'\\|\'chain\'\\|\'codepen\'\\|\'deviantart\'\\|\'dribbble\'\\|\'dropbox\'\\|\'etsy\'\\|\'facebook\'\\|\'feed\'\\|\'fivehundredpx\'\\|\'flickr\'\\|\'foursquare\'\\|\'github\'\\|\'goodreads\'\\|\'google\'\\|\'instagram\'\\|\'lastfm\'\\|\'linkedin\'\\|\'mail\'\\|\'mastodon\'\\|\'medium\'\\|\'meetup\'\\|\'pinterest\'\\|\'pocket\'\\|\'reddit\'\\|\'skype\'\\|\'snapchat\'\\|\'soundcloud\'\\|\'spotify\'\\|\'tumblr\'\\|\'twitch\'\\|\'twitter\'\\|\'vimeo\'\\|\'vk\'\\|\'wordpress\'\\|\'yelp\'\\|\'youtube\'\\}, label\\: array\\{type\\: \'string\'\\}\\}, render_callback\\: \'gutenberg_render…\'\\} given\\.$#', 'count' => 1, 'path' => __DIR__ . '/../../../lib/blocks.php', ]; -$ignoreErrors[] = [ - // identifier: argument.type - 'message' => '#^Parameter \\#1 \\$value of static method WP_Duotone_Gutenberg\\:\\:colord_parse_hue\\(\\) expects float, string given\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../lib/class-wp-duotone-gutenberg.php', -]; $ignoreErrors[] = [ // identifier: argument.type 'message' => '#^Parameter \\#1 \\$incoming of method WP_Theme_JSON\\:\\:merge\\(\\) expects WP_Theme_JSON, WP_Theme_JSON_Gutenberg given\\.$#', @@ -33,22 +21,10 @@ ]; $ignoreErrors[] = [ // identifier: argument.type - 'message' => '#^Parameter \\#1 \\$metadata of method WP_Theme_JSON_Gutenberg\\:\\:get_feature_declarations_for_node\\(\\) expects object, array given\\.$#', - 'count' => 2, - 'path' => __DIR__ . '/../../../lib/class-wp-theme-json-gutenberg.php', -]; -$ignoreErrors[] = [ - // identifier: argument.type - 'message' => '#^Parameter \\#1 \\$function_name of function _doing_it_wrong expects string, true given\\.$#', + 'message' => '#^Parameter \\#1 \\$incoming of method WP_Theme_JSON_Gutenberg\\:\\:merge\\(\\) expects WP_Theme_JSON_Gutenberg, WP_Theme_JSON given\\.$#', 'count' => 1, 'path' => __DIR__ . '/../../../lib/class-wp-theme-json-resolver-gutenberg.php', ]; -$ignoreErrors[] = [ - // identifier: argument.type - 'message' => '#^Parameter \\#5 \\$media of function wp_register_style expects string, true given\\.$#', - 'count' => 2, - 'path' => __DIR__ . '/../../../lib/client-assets.php', -]; $ignoreErrors[] = [ // identifier: argument.type 'message' => '#^Parameter \\#2 \\$value of method WP_HTTP_Response\\:\\:header\\(\\) expects string, int given\\.$#', @@ -61,18 +37,6 @@ 'count' => 1, 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.7/class-gutenberg-rest-templates-controller-6-7.php', ]; -$ignoreErrors[] = [ - // identifier: argument.type - 'message' => '#^Parameter \\#1 \\$str of function strtoupper expects string, bool given\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.7/class-gutenberg-token-map-6-7.php', -]; -$ignoreErrors[] = [ - // identifier: argument.type - 'message' => '#^Parameter \\#2 \\$value of function setcookie expects string, int given\\.$#', - 'count' => 2, - 'path' => __DIR__ . '/../../../lib/experimental/sync/class-gutenberg-http-signaling-server.php', -]; $ignoreErrors[] = [ // identifier: argument.type 'message' => '#^Parameter \\#5 \\$callback of function add_menu_page expects callable\\(\\)\\: mixed, \'\' given\\.$#', diff --git a/tools/phpstan/baseline/level-6.php b/tools/phpstan/baseline/level-6.php index 73be2599a0f3f0..920c1344f8f53d 100644 --- a/tools/phpstan/baseline/level-6.php +++ b/tools/phpstan/baseline/level-6.php @@ -349,12 +349,6 @@ 'count' => 1, 'path' => __DIR__ . '/../../../lib/compat/plugin/fonts.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.parameter - 'message' => '#^Function gutenberg_add_can_update_block_bindings_editor_setting\\(\\) has parameter \\$editor_settings with no type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.7/block-bindings.php', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Function gutenberg_bootstrap_server_block_bindings_sources\\(\\) has no return type specified\\.$#', @@ -397,18 +391,6 @@ 'count' => 1, 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.7/class-wp-block-templates-registry.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Function _gutenberg_add_block_template_plugin_attribute\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.7/compat.php', -]; -$ignoreErrors[] = [ - // identifier: missingType.parameter - 'message' => '#^Function _gutenberg_add_block_template_plugin_attribute\\(\\) has parameter \\$block_template with no type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.7/compat.php', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Function gutenberg_post_format_rest_posts_controller\\(\\) has no return type specified\\.$#', diff --git a/tools/phpstan/baseline/level-7.php b/tools/phpstan/baseline/level-7.php index 6de15e3cf3b433..cefa5be2941879 100644 --- a/tools/phpstan/baseline/level-7.php +++ b/tools/phpstan/baseline/level-7.php @@ -127,12 +127,6 @@ 'count' => 1, 'path' => __DIR__ . '/../../../lib/class-wp-theme-json-gutenberg.php', ]; -$ignoreErrors[] = [ - // identifier: offsetAccess.nonOffsetAccessible - 'message' => '#^Cannot access offset \'selectors\' on object\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../lib/class-wp-theme-json-gutenberg.php', -]; $ignoreErrors[] = [ // identifier: offsetAccess.nonOffsetAccessible 'message' => '#^Cannot access offset mixed on object\\.$#', @@ -151,12 +145,24 @@ 'count' => 2, 'path' => __DIR__ . '/../../../lib/class-wp-theme-json-gutenberg.php', ]; +$ignoreErrors[] = [ + // identifier: return.type + 'message' => '#^Method WP_Theme_JSON_Resolver_Gutenberg\\:\\:get_theme_data\\(\\) should return WP_Theme_JSON_Gutenberg but returns WP_Theme_JSON\\|WP_Theme_JSON_Gutenberg\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../../lib/class-wp-theme-json-resolver-gutenberg.php', +]; $ignoreErrors[] = [ // identifier: return.type 'message' => '#^Method WP_Theme_JSON_Resolver_Gutenberg\\:\\:translate\\(\\) should return array but returns array\\\\|string\\.$#', 'count' => 1, 'path' => __DIR__ . '/../../../lib/class-wp-theme-json-resolver-gutenberg.php', ]; +$ignoreErrors[] = [ + // identifier: argument.type + 'message' => '#^Parameter \\#1 \\$incoming of method WP_Theme_JSON_Gutenberg\\:\\:merge\\(\\) expects WP_Theme_JSON_Gutenberg, WP_Theme_JSON\\|WP_Theme_JSON_Gutenberg given\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../../lib/class-wp-theme-json-resolver-gutenberg.php', +]; $ignoreErrors[] = [ // identifier: argument.type 'message' => '#^Parameter \\#1 \\$obj of function get_object_vars expects object, int\\|WP_Post given\\.$#', diff --git a/tools/phpstan/baseline/level-8.php b/tools/phpstan/baseline/level-8.php index e035a4ff159bcb..dda2890ed0ab52 100644 --- a/tools/phpstan/baseline/level-8.php +++ b/tools/phpstan/baseline/level-8.php @@ -75,15 +75,15 @@ ]; $ignoreErrors[] = [ // identifier: argument.type - 'message' => '#^Parameter \\#2 \\$content of method ZipArchive\\:\\:addFromString\\(\\) expects string, string\\|null given\\.$#', + 'message' => '#^Parameter \\#2 \\$pieces of function implode expects array, array\\|null given\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../../lib/block-template-utils.php', + 'path' => __DIR__ . '/../../../lib/block-supports/typography.php', ]; $ignoreErrors[] = [ - // identifier: return.type - 'message' => '#^Method WP_Duotone_Gutenberg\\:\\:get_selector\\(\\) should return string but returns string\\|null\\.$#', - 'count' => 2, - 'path' => __DIR__ . '/../../../lib/class-wp-duotone-gutenberg.php', + // identifier: argument.type + 'message' => '#^Parameter \\#2 \\$content of method ZipArchive\\:\\:addFromString\\(\\) expects string, string\\|null given\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../../lib/block-template-utils.php', ]; $ignoreErrors[] = [ // identifier: argument.type @@ -135,207 +135,81 @@ ]; $ignoreErrors[] = [ // identifier: argument.type - 'message' => '#^Parameter \\#1 \\$obj of function get_object_vars expects object, WP_Post\\|null given\\.$#', + 'message' => '#^Parameter \\#3 \\$subject of function str_replace expects array\\|string, string\\|null given\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../../lib/class-wp-theme-json-resolver-gutenberg.php', + 'path' => __DIR__ . '/../../../lib/class-wp-theme-json-gutenberg.php', ]; $ignoreErrors[] = [ // identifier: argument.type - 'message' => '#^Parameter \\#2 \\$subject of function preg_match_all expects string, string\\|null given\\.$#', + 'message' => '#^Parameter \\#1 \\$obj of function get_object_vars expects object, WP_Post\\|null given\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../../lib/experimental/l10n.php', -]; -$ignoreErrors[] = [ - // identifier: argument.type - 'message' => '#^Parameter \\#3 \\$subject of function preg_replace expects array\\|string, string\\|null given\\.$#', - 'count' => 8, - 'path' => __DIR__ . '/../../../lib/experimental/l10n.php', + 'path' => __DIR__ . '/../../../lib/class-wp-theme-json-resolver-gutenberg.php', ]; $ignoreErrors[] = [ - // identifier: argument.type - 'message' => '#^Parameter \\#1 \\$item of method Gutenberg_REST_Attachments_Controller\\:\\:prepare_item_for_response\\(\\) expects WP_Post, WP_Post\\|null given\\.$#', + // identifier: parameter.phpDocType + 'message' => '#^@param WP_Post_Type \\$post_type does not accept actual type of parameter\\: WP_Post_Type\\|null\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../../lib/experimental/media/class-gutenberg-rest-attachments-controller.php', -]; -$ignoreErrors[] = [ - // identifier: property.nonObject - 'message' => '#^Cannot access property \\$labels on WP_Post_Type\\|null\\.$#', - 'count' => 2, - 'path' => __DIR__ . '/../../../lib/experimental/posts/load.php', + 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.7/class-gutenberg-rest-posts-controller-6-7.php', ]; $ignoreErrors[] = [ // identifier: property.nonObject 'message' => '#^Cannot access property \\$hierarchical on WP_Post_Type\\|null\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../../lib/experimental/rest-api.php', -]; -$ignoreErrors[] = [ - // identifier: argument.type - 'message' => '#^Parameter \\#1 \\$url of function esc_url expects string, string\\|null given\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../packages/block-library/src/comment-edit-link/index.php', -]; -$ignoreErrors[] = [ - // identifier: property.nonObject - 'message' => '#^Cannot access property \\$comment_parent on WP_Comment\\|null\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../packages/block-library/src/comment-reply-link/index.php', + 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.7/class-gutenberg-rest-posts-controller-6-7.php', ]; $ignoreErrors[] = [ // identifier: argument.type - 'message' => '#^Parameter \\#1 \\$post of function setup_postdata expects int\\|object, WP_Post\\|null given\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../packages/block-library/src/comments/index.php', -]; -$ignoreErrors[] = [ - // identifier: return.type - 'message' => '#^Function block_core_gallery_render\\(\\) should return string but returns string\\|null\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../packages/block-library/src/gallery/index.php', -]; -$ignoreErrors[] = [ - // identifier: return.type - 'message' => '#^Function block_core_image_render_lightbox\\(\\) should return string but returns string\\|null\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../packages/block-library/src/image/index.php', -]; -$ignoreErrors[] = [ - // identifier: argument.type - 'message' => '#^Parameter \\#2 \\$value of method WP_HTML_Tag_Processor\\:\\:set_attribute\\(\\) expects bool\\|string, string\\|null given\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../packages/block-library/src/image/index.php', -]; -$ignoreErrors[] = [ - // identifier: return.type - 'message' => '#^Function render_block_core_media_text\\(\\) should return string but returns string\\|null\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../packages/block-library/src/media-text/index.php', -]; -$ignoreErrors[] = [ - // identifier: argument.type - 'message' => '#^Parameter \\#1 \\$html of class WP_HTML_Tag_Processor constructor expects string, string\\|null given\\.$#', + 'message' => '#^Parameter \\#2 \\$value of function get_user_by expects int\\|string, int\\|null given\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../../packages/block-library/src/media-text/index.php', -]; -$ignoreErrors[] = [ - // identifier: property.nonObject - 'message' => '#^Cannot access property \\$name on WP_Post\\|WP_Post_Type\\|WP_Term\\|WP_User\\|null\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../packages/block-library/src/navigation-link/index.php', -]; -$ignoreErrors[] = [ - // identifier: property.nonObject - 'message' => '#^Cannot access property \\$name on WP_Post\\|WP_Post_Type\\|WP_Term\\|WP_User\\|null\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../packages/block-library/src/navigation-submenu/index.php', + 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.7/class-gutenberg-rest-templates-controller-6-7.php', ]; $ignoreErrors[] = [ // identifier: argument.type - 'message' => '#^Parameter \\#2 \\$post of function block_core_navigation_set_ignored_hooked_blocks_metadata expects WP_Post, WP_Post\\|null given\\.$#', + 'message' => '#^Parameter \\#2 \\$haystack of function in_array expects array, array\\\\|null given\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../../packages/block-library/src/navigation/index.php', + 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.7/class-wp-block-templates-registry.php', ]; $ignoreErrors[] = [ // identifier: foreach.nonIterable 'message' => '#^Argument of an invalid type array\\|null supplied for foreach, only iterables are supported\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../../packages/block-library/src/post-featured-image/index.php', -]; -$ignoreErrors[] = [ - // identifier: property.nonObject - 'message' => '#^Cannot access property \\$post_content on WP_Post\\|null\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../packages/block-library/src/post-featured-image/index.php', -]; -$ignoreErrors[] = [ - // identifier: argument.type - 'message' => '#^Parameter \\#2 \\$value of method WP_HTML_Tag_Processor\\:\\:set_attribute\\(\\) expects bool\\|string, string\\|true\\|null given\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../packages/block-library/src/post-featured-image/index.php', -]; -$ignoreErrors[] = [ - // identifier: return.type - 'message' => '#^Function render_block_core_query_pagination_next\\(\\) should return string but returns string\\|null\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../packages/block-library/src/query-pagination-next/index.php', -]; -$ignoreErrors[] = [ - // identifier: return.type - 'message' => '#^Function render_block_core_query_pagination_previous\\(\\) should return string but returns string\\|null\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../packages/block-library/src/query-pagination-previous/index.php', + 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.7/compat.php', ]; $ignoreErrors[] = [ // identifier: argument.type - 'message' => '#^Parameter \\#2 \\$callback of function remove_filter expects array\\|\\(callable\\(\\)\\: mixed\\)\\|string, \\(Closure\\(mixed, mixed\\)\\: mixed\\)\\|null given\\.$#', + 'message' => '#^Parameter \\#2 \\$context of function apply_block_hooks_to_content expects array\\|WP_Block_Template\\|WP_Post, WP_Post\\|null given\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../../packages/block-library/src/query/index.php', -]; -$ignoreErrors[] = [ - // identifier: foreach.nonIterable - 'message' => '#^Argument of an invalid type array\\\\|null supplied for foreach, only iterables are supported\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../packages/block-library/src/rss/index.php', -]; -$ignoreErrors[] = [ - // identifier: argument.type - 'message' => '#^Parameter \\#1 \\$str of function strip_tags expects string, string\\|null given\\.$#', - 'count' => 2, - 'path' => __DIR__ . '/../../../packages/block-library/src/rss/index.php', + 'path' => __DIR__ . '/../../../lib/compat/wordpress-6.8/blocks.php', ]; $ignoreErrors[] = [ // identifier: argument.type - 'message' => '#^Parameter \\#1 \\$string of function html_entity_decode expects string, string\\|null given\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../packages/block-library/src/rss/index.php', -]; -$ignoreErrors[] = [ - // identifier: argument.type - 'message' => '#^Parameter \\#1 \\$url of function esc_url expects string, string\\|null given\\.$#', + 'message' => '#^Parameter \\#2 \\$subject of function preg_match_all expects string, string\\|null given\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../../packages/block-library/src/rss/index.php', + 'path' => __DIR__ . '/../../../lib/experimental/l10n.php', ]; $ignoreErrors[] = [ // identifier: argument.type - 'message' => '#^Parameter \\#1 \\$str of function strtolower expects string, string\\|null given\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../packages/block-library/src/search/index.php', + 'message' => '#^Parameter \\#3 \\$subject of function preg_replace expects array\\|string, string\\|null given\\.$#', + 'count' => 8, + 'path' => __DIR__ . '/../../../lib/experimental/l10n.php', ]; $ignoreErrors[] = [ // identifier: argument.type - 'message' => '#^Parameter \\#1 \\$html of class WP_HTML_Tag_Processor constructor expects string, string\\|null given\\.$#', + 'message' => '#^Parameter \\#1 \\$item of method Gutenberg_REST_Attachments_Controller\\:\\:prepare_item_for_response\\(\\) expects WP_Post, WP_Post\\|null given\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../../packages/block-library/src/site-logo/index.php', + 'path' => __DIR__ . '/../../../lib/experimental/media/class-gutenberg-rest-attachments-controller.php', ]; $ignoreErrors[] = [ // identifier: property.nonObject - 'message' => '#^Cannot access property \\$content on WP_Block_Template\\|null\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../packages/block-library/src/template-part/index.php', -]; -$ignoreErrors[] = [ - // identifier: method.nonObject - 'message' => '#^Cannot call method add_declarations\\(\\) on WP_Style_Engine_CSS_Rule\\|null\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../packages/style-engine/class-wp-style-engine.php', -]; -$ignoreErrors[] = [ - // identifier: return.type - 'message' => '#^Method WP_Style_Engine\\:\\:get_store\\(\\) should return WP_Style_Engine_CSS_Rules_Store but returns WP_Style_Engine_CSS_Rules_Store\\|null\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../packages/style-engine/class-wp-style-engine.php', -]; -$ignoreErrors[] = [ - // identifier: method.nonObject - 'message' => '#^Cannot call method render\\(\\) on WP_Block_Type\\|null\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../../packages/widgets/src/blocks/legacy-widget/index.php', + 'message' => '#^Cannot access property \\$labels on WP_Post_Type\\|null\\.$#', + 'count' => 2, + 'path' => __DIR__ . '/../../../lib/experimental/posts/load.php', ]; $ignoreErrors[] = [ - // identifier: argument.type - 'message' => '#^Parameter \\#2 \\$sidebar_id of function wp_render_widget expects string, string\\|null given\\.$#', + // identifier: property.nonObject + 'message' => '#^Cannot access property \\$hierarchical on WP_Post_Type\\|null\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../../packages/widgets/src/blocks/legacy-widget/index.php', + 'path' => __DIR__ . '/../../../lib/experimental/rest-api.php', ]; return ['parameters' => ['ignoreErrors' => $ignoreErrors]];