diff --git a/src/wp-includes/class-wp-classic-to-block-menu-converter.php b/src/wp-includes/class-wp-classic-to-block-menu-converter.php index a0b7d5075670a..ca46187991c7e 100644 --- a/src/wp-includes/class-wp-classic-to-block-menu-converter.php +++ b/src/wp-includes/class-wp-classic-to-block-menu-converter.php @@ -42,11 +42,11 @@ public static function convert( $menu ) { // Adds the class property classes for the current context, if applicable. _wp_menu_item_classes_by_context( $menu_items ); - $menu_items_by_parent_id = static::group_by_parent_id( $menu_items ); + $menu_items_by_parent_id = self::group_by_parent_id( $menu_items ); $first_menu_item = $menu_items_by_parent_id[0] ?? array(); - $inner_blocks = static::to_blocks( + $inner_blocks = self::to_blocks( $first_menu_item, $menu_items_by_parent_id ); @@ -117,7 +117,7 @@ private static function to_blocks( $menu_items, $menu_items_by_parent_id ) { ); $block['innerBlocks'] = isset( $menu_items_by_parent_id[ $menu_item->ID ] ) - ? static::to_blocks( $menu_items_by_parent_id[ $menu_item->ID ], $menu_items_by_parent_id ) + ? self::to_blocks( $menu_items_by_parent_id[ $menu_item->ID ], $menu_items_by_parent_id ) : array(); $block['innerContent'] = array_map( 'serialize_block', $block['innerBlocks'] ); diff --git a/src/wp-includes/class-wp-navigation-fallback.php b/src/wp-includes/class-wp-navigation-fallback.php index 573ab27f3489e..339fa58fc0ef8 100644 --- a/src/wp-includes/class-wp-navigation-fallback.php +++ b/src/wp-includes/class-wp-navigation-fallback.php @@ -77,24 +77,24 @@ public static function get_fallback() { */ $should_create_fallback = apply_filters( 'wp_navigation_should_create_fallback', true ); - $fallback = static::get_most_recently_published_navigation(); + $fallback = self::get_most_recently_published_navigation(); if ( $fallback || ! $should_create_fallback ) { return $fallback; } - $fallback = static::create_classic_menu_fallback(); + $fallback = self::create_classic_menu_fallback(); if ( $fallback && ! is_wp_error( $fallback ) ) { // Return the newly created fallback post object which will now be the most recently created navigation menu. - return $fallback instanceof WP_Post ? $fallback : static::get_most_recently_published_navigation(); + return $fallback instanceof WP_Post ? $fallback : self::get_most_recently_published_navigation(); } - $fallback = static::create_default_fallback(); + $fallback = self::create_default_fallback(); if ( $fallback && ! is_wp_error( $fallback ) ) { // Return the newly created fallback post object which will now be the most recently created navigation menu. - return $fallback instanceof WP_Post ? $fallback : static::get_most_recently_published_navigation(); + return $fallback instanceof WP_Post ? $fallback : self::get_most_recently_published_navigation(); } return null; @@ -138,7 +138,7 @@ private static function get_most_recently_published_navigation() { */ private static function create_classic_menu_fallback() { // See if we have a classic menu. - $classic_nav_menu = static::get_fallback_classic_menu(); + $classic_nav_menu = self::get_fallback_classic_menu(); if ( ! $classic_nav_menu ) { return new WP_Error( 'no_classic_menus', __( 'No Classic Menus found.' ) ); @@ -184,19 +184,19 @@ private static function get_fallback_classic_menu() { return null; } - $nav_menu = static::get_nav_menu_at_primary_location(); + $nav_menu = self::get_nav_menu_at_primary_location(); if ( $nav_menu ) { return $nav_menu; } - $nav_menu = static::get_nav_menu_with_primary_slug( $classic_nav_menus ); + $nav_menu = self::get_nav_menu_with_primary_slug( $classic_nav_menus ); if ( $nav_menu ) { return $nav_menu; } - return static::get_most_recently_created_nav_menu( $classic_nav_menus ); + return self::get_most_recently_created_nav_menu( $classic_nav_menus ); } @@ -269,7 +269,7 @@ private static function get_nav_menu_at_primary_location() { */ private static function create_default_fallback() { - $default_blocks = static::get_default_fallback_blocks(); + $default_blocks = self::get_default_fallback_blocks(); // Create a new navigation menu from the fallback blocks. $default_fallback = wp_insert_post( diff --git a/src/wp-includes/class-wp-theme-json-resolver.php b/src/wp-includes/class-wp-theme-json-resolver.php index 85124cf0e0cb6..b6c205bba03bd 100644 --- a/src/wp-includes/class-wp-theme-json-resolver.php +++ b/src/wp-includes/class-wp-theme-json-resolver.php @@ -279,8 +279,8 @@ public static function get_theme_data( $deprecated = array(), $options = array() * See test_add_registered_block_styles_to_theme_data and test_unwraps_block_style_variations. * */ - $theme_json_data = static::inject_variations_from_block_style_variation_files( $theme_json_data, $variations ); - $theme_json_data = static::inject_variations_from_block_styles_registry( $theme_json_data ); + $theme_json_data = self::inject_variations_from_block_style_variation_files( $theme_json_data, $variations ); + $theme_json_data = self::inject_variations_from_block_styles_registry( $theme_json_data ); /** * Filters the data provided by the theme for global styles and settings. @@ -400,7 +400,7 @@ public static function get_block_data() { $config = array( 'version' => WP_Theme_JSON::LATEST_SCHEMA ); foreach ( $blocks as $block_name => $block_type ) { if ( isset( $block_type->supports['__experimentalStyle'] ) ) { - $config['styles']['blocks'][ $block_name ] = static::remove_json_comments( $block_type->supports['__experimentalStyle'] ); + $config['styles']['blocks'][ $block_name ] = self::remove_json_comments( $block_type->supports['__experimentalStyle'] ); } if ( @@ -450,7 +450,7 @@ private static function remove_json_comments( $input_array ) { unset( $input_array['//'] ); foreach ( $input_array as $k => $v ) { if ( is_array( $v ) ) { - $input_array[ $k ] = static::remove_json_comments( $v ); + $input_array[ $k ] = self::remove_json_comments( $v ); } } @@ -805,10 +805,10 @@ public static function get_style_variations( $scope = 'theme' ) { $base_directory = get_stylesheet_directory() . '/styles'; $template_directory = get_template_directory() . '/styles'; if ( is_dir( $base_directory ) ) { - $variation_files = static::recursively_iterate_json( $base_directory ); + $variation_files = self::recursively_iterate_json( $base_directory ); } if ( is_dir( $template_directory ) && $template_directory !== $base_directory ) { - $variation_files_parent = static::recursively_iterate_json( $template_directory ); + $variation_files_parent = self::recursively_iterate_json( $template_directory ); // If the child and parent variation file basename are the same, only include the child theme's. foreach ( $variation_files_parent as $parent_path => $parent ) { foreach ( $variation_files as $child_path => $child ) { @@ -822,7 +822,7 @@ public static function get_style_variations( $scope = 'theme' ) { ksort( $variation_files ); foreach ( $variation_files as $path => $file ) { $decoded_file = self::read_json_file( $path ); - if ( is_array( $decoded_file ) && static::style_variation_has_scope( $decoded_file, $scope ) ) { + if ( is_array( $decoded_file ) && self::style_variation_has_scope( $decoded_file, $scope ) ) { $translated = static::translate( $decoded_file, wp_get_theme()->get( 'TextDomain' ) ); $variation = ( new WP_Theme_JSON( $translated ) )->get_raw_data(); if ( empty( $variation['title'] ) ) { diff --git a/src/wp-includes/fonts/class-wp-font-face-resolver.php b/src/wp-includes/fonts/class-wp-font-face-resolver.php index 153008b53aec0..f2da231ef058b 100644 --- a/src/wp-includes/fonts/class-wp-font-face-resolver.php +++ b/src/wp-includes/fonts/class-wp-font-face-resolver.php @@ -33,7 +33,7 @@ public static function get_fonts_from_theme_json() { return array(); } - return static::parse_settings( $settings ); + return self::parse_settings( $settings ); } /** @@ -65,7 +65,7 @@ public static function get_fonts_from_style_variations() { ), ); - return static::parse_settings( $settings ); + return self::parse_settings( $settings ); } /** @@ -92,14 +92,14 @@ private static function parse_settings( array $settings ) { continue; } - $font_family_name = static::maybe_parse_name_from_comma_separated_list( $definition['fontFamily'] ); + $font_family_name = self::maybe_parse_name_from_comma_separated_list( $definition['fontFamily'] ); // Skip if no font family is defined. if ( empty( $font_family_name ) ) { continue; } - $fonts[] = static::convert_font_face_properties( $definition['fontFace'], $font_family_name ); + $fonts[] = self::convert_font_face_properties( $definition['fontFace'], $font_family_name ); } } @@ -143,11 +143,11 @@ private static function convert_font_face_properties( array $font_face_definitio // Converts the "file:./" src placeholder into a theme font file URI. if ( ! empty( $font_face['src'] ) ) { - $font_face['src'] = static::to_theme_file_uri( (array) $font_face['src'] ); + $font_face['src'] = self::to_theme_file_uri( (array) $font_face['src'] ); } // Convert camelCase properties into kebab-case. - $font_face = static::to_kebab_case( $font_face ); + $font_face = self::to_kebab_case( $font_face ); $converted_font_faces[] = $font_face; } diff --git a/tests/phpstan/baselines/staticClassAccess.privateMethod.neon b/tests/phpstan/baselines/staticClassAccess.privateMethod.neon index c3a8969643a94..7e8a5c1cf59e1 100644 --- a/tests/phpstan/baselines/staticClassAccess.privateMethod.neon +++ b/tests/phpstan/baselines/staticClassAccess.privateMethod.neon @@ -18,81 +18,6 @@ parameters: ignoreErrors: - - - message: '#^Unsafe call to private method WP_Classic_To_Block_Menu_Converter\:\:group_by_parent_id\(\) through static\:\:\.$#' - identifier: staticClassAccess.privateMethod - count: 1 - path: ../../../src/wp-includes/class-wp-classic-to-block-menu-converter.php - - - message: '#^Unsafe call to private method WP_Classic_To_Block_Menu_Converter\:\:to_blocks\(\) through static\:\:\.$#' - identifier: staticClassAccess.privateMethod - count: 2 - path: ../../../src/wp-includes/class-wp-classic-to-block-menu-converter.php - - - message: '#^Unsafe call to private method WP_Navigation_Fallback\:\:create_classic_menu_fallback\(\) through static\:\:\.$#' - identifier: staticClassAccess.privateMethod - count: 1 - path: ../../../src/wp-includes/class-wp-navigation-fallback.php - - - message: '#^Unsafe call to private method WP_Navigation_Fallback\:\:create_default_fallback\(\) through static\:\:\.$#' - identifier: staticClassAccess.privateMethod - count: 1 - path: ../../../src/wp-includes/class-wp-navigation-fallback.php - - - message: '#^Unsafe call to private method WP_Navigation_Fallback\:\:get_default_fallback_blocks\(\) through static\:\:\.$#' - identifier: staticClassAccess.privateMethod - count: 1 - path: ../../../src/wp-includes/class-wp-navigation-fallback.php - - - message: '#^Unsafe call to private method WP_Navigation_Fallback\:\:get_fallback_classic_menu\(\) through static\:\:\.$#' - identifier: staticClassAccess.privateMethod - count: 1 - path: ../../../src/wp-includes/class-wp-navigation-fallback.php - - - message: '#^Unsafe call to private method WP_Navigation_Fallback\:\:get_most_recently_created_nav_menu\(\) through static\:\:\.$#' - identifier: staticClassAccess.privateMethod - count: 1 - path: ../../../src/wp-includes/class-wp-navigation-fallback.php - - - message: '#^Unsafe call to private method WP_Navigation_Fallback\:\:get_most_recently_published_navigation\(\) through static\:\:\.$#' - identifier: staticClassAccess.privateMethod - count: 3 - path: ../../../src/wp-includes/class-wp-navigation-fallback.php - - - message: '#^Unsafe call to private method WP_Navigation_Fallback\:\:get_nav_menu_at_primary_location\(\) through static\:\:\.$#' - identifier: staticClassAccess.privateMethod - count: 1 - path: ../../../src/wp-includes/class-wp-navigation-fallback.php - - - message: '#^Unsafe call to private method WP_Navigation_Fallback\:\:get_nav_menu_with_primary_slug\(\) through static\:\:\.$#' - identifier: staticClassAccess.privateMethod - count: 1 - path: ../../../src/wp-includes/class-wp-navigation-fallback.php - - - message: '#^Unsafe call to private method WP_Theme_JSON_Resolver\:\:inject_variations_from_block_style_variation_files\(\) through static\:\:\.$#' - identifier: staticClassAccess.privateMethod - count: 1 - path: ../../../src/wp-includes/class-wp-theme-json-resolver.php - - - message: '#^Unsafe call to private method WP_Theme_JSON_Resolver\:\:inject_variations_from_block_styles_registry\(\) through static\:\:\.$#' - identifier: staticClassAccess.privateMethod - count: 1 - path: ../../../src/wp-includes/class-wp-theme-json-resolver.php - - - message: '#^Unsafe call to private method WP_Theme_JSON_Resolver\:\:recursively_iterate_json\(\) through static\:\:\.$#' - identifier: staticClassAccess.privateMethod - count: 2 - path: ../../../src/wp-includes/class-wp-theme-json-resolver.php - - - message: '#^Unsafe call to private method WP_Theme_JSON_Resolver\:\:remove_json_comments\(\) through static\:\:\.$#' - identifier: staticClassAccess.privateMethod - count: 2 - path: ../../../src/wp-includes/class-wp-theme-json-resolver.php - - - message: '#^Unsafe call to private method WP_Theme_JSON_Resolver\:\:style_variation_has_scope\(\) through static\:\:\.$#' - identifier: staticClassAccess.privateMethod - count: 1 - path: ../../../src/wp-includes/class-wp-theme-json-resolver.php - message: '#^Unsafe call to private method WP_Theme_JSON\:\:compute_spacing_sizes\(\) through static\:\:\.$#' identifier: staticClassAccess.privateMethod @@ -163,28 +88,3 @@ parameters: identifier: staticClassAccess.privateMethod count: 1 path: ../../../src/wp-includes/class-wp-theme-json.php - - - message: '#^Unsafe call to private method WP_Font_Face_Resolver\:\:convert_font_face_properties\(\) through static\:\:\.$#' - identifier: staticClassAccess.privateMethod - count: 1 - path: ../../../src/wp-includes/fonts/class-wp-font-face-resolver.php - - - message: '#^Unsafe call to private method WP_Font_Face_Resolver\:\:maybe_parse_name_from_comma_separated_list\(\) through static\:\:\.$#' - identifier: staticClassAccess.privateMethod - count: 1 - path: ../../../src/wp-includes/fonts/class-wp-font-face-resolver.php - - - message: '#^Unsafe call to private method WP_Font_Face_Resolver\:\:parse_settings\(\) through static\:\:\.$#' - identifier: staticClassAccess.privateMethod - count: 2 - path: ../../../src/wp-includes/fonts/class-wp-font-face-resolver.php - - - message: '#^Unsafe call to private method WP_Font_Face_Resolver\:\:to_kebab_case\(\) through static\:\:\.$#' - identifier: staticClassAccess.privateMethod - count: 1 - path: ../../../src/wp-includes/fonts/class-wp-font-face-resolver.php - - - message: '#^Unsafe call to private method WP_Font_Face_Resolver\:\:to_theme_file_uri\(\) through static\:\:\.$#' - identifier: staticClassAccess.privateMethod - count: 1 - path: ../../../src/wp-includes/fonts/class-wp-font-face-resolver.php