Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/wp-includes/class-wp-classic-to-block-menu-converter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
Expand Down Expand Up @@ -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'] );

Expand Down
20 changes: 10 additions & 10 deletions src/wp-includes/class-wp-navigation-fallback.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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.' ) );
Expand Down Expand Up @@ -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 );
}


Expand Down Expand Up @@ -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(
Expand Down
14 changes: 7 additions & 7 deletions src/wp-includes/class-wp-theme-json-resolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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 (
Expand Down Expand Up @@ -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 );
}
}

Expand Down Expand Up @@ -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 ) {
Expand All @@ -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'] ) ) {
Expand Down
12 changes: 6 additions & 6 deletions src/wp-includes/fonts/class-wp-font-face-resolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static function get_fonts_from_theme_json() {
return array();
}

return static::parse_settings( $settings );
return self::parse_settings( $settings );
}

/**
Expand Down Expand Up @@ -65,7 +65,7 @@ public static function get_fonts_from_style_variations() {
),
);

return static::parse_settings( $settings );
return self::parse_settings( $settings );
}

/**
Expand All @@ -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 );
}
}

Expand Down Expand Up @@ -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;
}
Expand Down
100 changes: 0 additions & 100 deletions tests/phpstan/baselines/staticClassAccess.privateMethod.neon
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Loading