diff --git a/composer.json b/composer.json
index 134e366befdb94..3571377bd58bd7 100644
--- a/composer.json
+++ b/composer.json
@@ -26,10 +26,8 @@
}
},
"require-dev": {
- "dealerdirect/phpcodesniffer-composer-installer": "^0.7",
- "squizlabs/php_codesniffer": "^3.5",
"phpcompatibility/phpcompatibility-wp": "^2.1.3",
- "wp-coding-standards/wpcs": "^2.2",
+ "wp-coding-standards/wpcs": "^3.0",
"sirbrillig/phpcs-variable-analysis": "^2.8",
"spatie/phpunit-watcher": "^1.23",
"yoast/phpunit-polyfills": "^1.0",
diff --git a/lib/block-supports/border.php b/lib/block-supports/border.php
index 486f6d99b64890..51e484c43af421 100644
--- a/lib/block-supports/border.php
+++ b/lib/block-supports/border.php
@@ -134,24 +134,24 @@ function gutenberg_apply_border_support( $block_type, $block_attributes ) {
* flag nested under `experimentalBorder` must be enabled for the feature
* to be opted into.
*
- * @param WP_Block_Type $block_type Block type to check for support.
- * @param string $feature Name of the feature to check support for.
- * @param mixed $default Fallback value for feature support, defaults to false.
+ * @param WP_Block_Type $block_type Block type to check for support.
+ * @param string $feature Name of the feature to check support for.
+ * @param mixed $default_value Fallback value for feature support, defaults to false.
*
* @return boolean Whether or not the feature is supported.
*/
-function gutenberg_has_border_feature_support( $block_type, $feature, $default = false ) {
+function gutenberg_has_border_feature_support( $block_type, $feature, $default_value = false ) {
// Check if all border support features have been opted into via `"__experimentalBorder": true`.
if (
property_exists( $block_type, 'supports' ) &&
- ( true === _wp_array_get( $block_type->supports, array( '__experimentalBorder' ), $default ) )
+ ( true === _wp_array_get( $block_type->supports, array( '__experimentalBorder' ), $default_value ) )
) {
return true;
}
// Check if the specific feature has been opted into individually
// via nested flag under `__experimentalBorder`.
- return block_has_support( $block_type, array( '__experimentalBorder', $feature ), $default );
+ return block_has_support( $block_type, array( '__experimentalBorder', $feature ), $default_value );
}
// Register the block support.
diff --git a/lib/block-supports/elements.php b/lib/block-supports/elements.php
index 328d371c3e4fd8..2106360c4bd047 100644
--- a/lib/block-supports/elements.php
+++ b/lib/block-supports/elements.php
@@ -80,7 +80,7 @@ function gutenberg_render_elements_support( $block_content, $block ) {
foreach ( $element_config['paths'] as $path ) {
if ( null !== _wp_array_get( $block['attrs'], explode( '.', $path ), null ) ) {
- $element_colors_set++;
+ ++$element_colors_set;
}
}
}
diff --git a/lib/block-supports/layout.php b/lib/block-supports/layout.php
index 0cf501028efd88..3acef1f7df4d4b 100644
--- a/lib/block-supports/layout.php
+++ b/lib/block-supports/layout.php
@@ -833,7 +833,7 @@ function gutenberg_restore_group_inner_container( $block_content, $block ) {
);
$updated_content = preg_replace_callback(
$replace_regex,
- static function( $matches ) {
+ static function ( $matches ) {
return $matches[1] . '
' . $matches[2] . '
' . $matches[3];
},
$block_content
diff --git a/lib/block-supports/typography.php b/lib/block-supports/typography.php
index d0721503fb101e..1e8c894387de62 100644
--- a/lib/block-supports/typography.php
+++ b/lib/block-supports/typography.php
@@ -244,7 +244,6 @@ function gutenberg_render_typography_support( $block_content, $block ) {
}
return $block_content;
-
}
/**
diff --git a/lib/blocks.php b/lib/blocks.php
index 34ef63f2e87ad9..c54f5df68489ae 100644
--- a/lib/blocks.php
+++ b/lib/blocks.php
@@ -274,7 +274,7 @@ function gutenberg_register_core_block_assets( $block_name ) {
if ( ! $stylesheet_removed ) {
add_action(
'wp_enqueue_scripts',
- static function() {
+ static function () {
wp_dequeue_style( 'wp-block-library-theme' );
}
);
diff --git a/lib/class-wp-duotone-gutenberg.php b/lib/class-wp-duotone-gutenberg.php
index 41120a882ed235..5c4b4a3cc9d9c7 100644
--- a/lib/class-wp-duotone-gutenberg.php
+++ b/lib/class-wp-duotone-gutenberg.php
@@ -482,7 +482,7 @@ private static function is_preset( $duotone_attr ) {
* @return string The CSS variable name.
*/
private static function get_css_custom_property_name( $slug ) {
- return "--wp--preset--duotone--$slug";
+ return "--wp--preset--duotone--$slug";
}
/**
@@ -492,7 +492,7 @@ private static function get_css_custom_property_name( $slug ) {
* @return string The ID of the duotone filter.
*/
private static function get_filter_id( $slug ) {
- return "wp-duotone-$slug";
+ return "wp-duotone-$slug";
}
/**
diff --git a/lib/class-wp-theme-json-data-gutenberg.php b/lib/class-wp-theme-json-data-gutenberg.php
index db0737ebea08b6..f0d2025347493b 100644
--- a/lib/class-wp-theme-json-data-gutenberg.php
+++ b/lib/class-wp-theme-json-data-gutenberg.php
@@ -72,5 +72,4 @@ public function update_with( $new_data ) {
public function get_data() {
return $this->theme_json->get_raw_data();
}
-
}
diff --git a/lib/class-wp-theme-json-gutenberg.php b/lib/class-wp-theme-json-gutenberg.php
index 63de99624a0ac6..7aa165ecc06353 100644
--- a/lib/class-wp-theme-json-gutenberg.php
+++ b/lib/class-wp-theme-json-gutenberg.php
@@ -2345,7 +2345,7 @@ public function get_styles_for_block( $block_metadata ) {
// Prepend the variation selector to the current selector.
$split_selectors = explode( ',', $shortened_selector );
$updated_selectors = array_map(
- static function( $split_selector ) use ( $clean_style_variation_selector ) {
+ static function ( $split_selector ) use ( $clean_style_variation_selector ) {
return $clean_style_variation_selector . $split_selector;
},
$split_selectors
@@ -2384,7 +2384,7 @@ static function( $split_selector ) use ( $clean_style_variation_selector ) {
$pseudo_matches = array_values(
array_filter(
$element_pseudo_allowed,
- static function( $pseudo_selector ) use ( $selector ) {
+ static function ( $pseudo_selector ) use ( $selector ) {
return str_contains( $selector, $pseudo_selector );
}
)
@@ -3415,7 +3415,7 @@ public function set_spacing_sizes() {
}
if ( $below_midpoint_count < $steps_mid_point - 2 ) {
- $x_small_count++;
+ ++$x_small_count;
}
$slug -= 10;
@@ -3452,7 +3452,7 @@ public function set_spacing_sizes() {
}
if ( $above_midpoint_count > 1 ) {
- $x_large_count++;
+ ++$x_large_count;
}
$slug += 10;
@@ -3728,10 +3728,10 @@ public static function resolve_variables( $theme_json ) {
$theme_vars = static::compute_theme_vars( $settings );
$vars = array_reduce(
array_merge( $preset_vars, $theme_vars ),
- function( $carry, $item ) {
+ function ( $carry, $item ) {
$name = $item['name'];
$carry[ "var({$name})" ] = $item['value'];
- return $carry;
+ return $carry;
},
array()
);
@@ -3739,5 +3739,4 @@ function( $carry, $item ) {
$theme_json->theme_json['styles'] = self::convert_variables_to_value( $styles, $vars );
return $theme_json;
}
-
}
diff --git a/lib/class-wp-theme-json-resolver-gutenberg.php b/lib/class-wp-theme-json-resolver-gutenberg.php
index c5a4c662221aeb..363c25f63761cb 100644
--- a/lib/class-wp-theme-json-resolver-gutenberg.php
+++ b/lib/class-wp-theme-json-resolver-gutenberg.php
@@ -408,18 +408,18 @@ public static function get_block_data() {
/**
* When given an array, this will remove any keys with the name `//`.
*
- * @param array $array The array to filter.
+ * @param array $json_array The array to filter.
* @return array The filtered array.
*/
- private static function remove_json_comments( $array ) {
- unset( $array['//'] );
- foreach ( $array as $k => $v ) {
+ private static function remove_json_comments( $json_array ) {
+ unset( $json_array['//'] );
+ foreach ( $json_array as $k => $v ) {
if ( is_array( $v ) ) {
- $array[ $k ] = static::remove_json_comments( $v );
+ $json_array[ $k ] = static::remove_json_comments( $v );
}
}
- return $array;
+ return $json_array;
}
/**
diff --git a/lib/compat/wordpress-6.3/blocks.php b/lib/compat/wordpress-6.3/blocks.php
index 962c9ee3e07ef3..001416b42566f7 100644
--- a/lib/compat/wordpress-6.3/blocks.php
+++ b/lib/compat/wordpress-6.3/blocks.php
@@ -104,7 +104,7 @@ function gutenberg_wp_block_register_post_meta() {
$post_type,
'wp_pattern_sync_status',
array(
- 'auth_callback' => function() {
+ 'auth_callback' => function () {
return current_user_can( 'edit_posts' );
},
'sanitize_callback' => 'sanitize_text_field',
diff --git a/lib/compat/wordpress-6.3/class-gutenberg-navigation-fallback.php b/lib/compat/wordpress-6.3/class-gutenberg-navigation-fallback.php
index fcf6e13b0954d7..fcd70da61f57ed 100644
--- a/lib/compat/wordpress-6.3/class-gutenberg-navigation-fallback.php
+++ b/lib/compat/wordpress-6.3/class-gutenberg-navigation-fallback.php
@@ -154,7 +154,7 @@ private static function get_fallback_classic_menu() {
private static function get_most_recently_created_nav_menu( $classic_nav_menus ) {
usort(
$classic_nav_menus,
- static function( $a, $b ) {
+ static function ( $a, $b ) {
return $b->term_id - $a->term_id;
}
);
diff --git a/lib/compat/wordpress-6.3/html-api/class-gutenberg-html-tag-processor-6-3.php b/lib/compat/wordpress-6.3/html-api/class-gutenberg-html-tag-processor-6-3.php
index b869e2ef1e1c16..73cdb9342490c1 100644
--- a/lib/compat/wordpress-6.3/html-api/class-gutenberg-html-tag-processor-6-3.php
+++ b/lib/compat/wordpress-6.3/html-api/class-gutenberg-html-tag-processor-6-3.php
@@ -947,7 +947,7 @@ private function parse_next_tag() {
if ( '/' === $this->html[ $at + 1 ] ) {
$this->is_closing_tag = true;
- $at++;
+ ++$at;
} else {
$this->is_closing_tag = false;
}
@@ -1016,7 +1016,7 @@ private function parse_next_tag() {
*
* See https://html.spec.whatwg.org/#parse-error-incorrectly-closed-comment
*/
- $closer_at--; // Pre-increment inside condition below reduces risk of accidental infinite looping.
+ --$closer_at; // Pre-increment inside condition below reduces risk of accidental infinite looping.
while ( ++$closer_at < strlen( $html ) ) {
$closer_at = strpos( $html, '--', $closer_at );
if ( false === $closer_at ) {
@@ -1097,7 +1097,7 @@ private function parse_next_tag() {
* See https://html.spec.whatwg.org/#parse-error-missing-end-tag-name
*/
if ( '>' === $html[ $at + 1 ] ) {
- $at++;
+ ++$at;
continue;
}
@@ -1739,7 +1739,7 @@ public function get_attribute( $name ) {
* @param string $prefix Prefix of requested attribute names.
* @return array|null List of attribute names, or `null` when no tag opener is matched.
*/
- function get_attribute_names_with_prefix( $prefix ) {
+ public function get_attribute_names_with_prefix( $prefix ) {
if ( $this->is_closing_tag || null === $this->tag_name_starts_at ) {
return null;
}
@@ -2282,11 +2282,9 @@ private function matches() {
* See https://html.spec.whatwg.org/#attributes-3
* See https://html.spec.whatwg.org/#space-separated-tokens
*/
- while (
- // phpcs:ignore WordPress.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition
- false !== ( $class_at = strpos( $this->html, $this->sought_class_name, $class_at ) ) &&
- $class_at < $class_end
- ) {
+ do {
+ $class_at = strpos( $this->html, $this->sought_class_name, $class_at );
+
/*
* Verify this class starts at a boundary.
*/
@@ -2312,7 +2310,7 @@ private function matches() {
}
return true;
- }
+ } while ( false !== $class_at && $class_at < $class_end );
return false;
}
diff --git a/lib/compat/wordpress-6.3/rest-api.php b/lib/compat/wordpress-6.3/rest-api.php
index 041398eda24b4f..db90a2575d9eea 100644
--- a/lib/compat/wordpress-6.3/rest-api.php
+++ b/lib/compat/wordpress-6.3/rest-api.php
@@ -70,9 +70,9 @@ function add_modified_wp_template_schema() {
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
- 'get_callback' => function( $object ) {
- if ( ! empty( $object['wp_id'] ) ) {
- $post = get_post( $object['wp_id'] );
+ 'get_callback' => function ( $template_object ) {
+ if ( ! empty( $template_object['wp_id'] ) ) {
+ $post = get_post( $template_object['wp_id'] );
if ( $post && isset( $post->post_modified ) ) {
return mysql_to_rfc3339( $post->post_modified );
}
diff --git a/lib/compat/wordpress-6.3/script-loader.php b/lib/compat/wordpress-6.3/script-loader.php
index 8f7bda2a648114..89149f3a753140 100644
--- a/lib/compat/wordpress-6.3/script-loader.php
+++ b/lib/compat/wordpress-6.3/script-loader.php
@@ -100,7 +100,7 @@ function _gutenberg_get_iframed_editor_assets() {
add_filter(
'block_editor_settings_all',
- static function( $settings ) {
+ static function ( $settings ) {
// We must override what core is passing now.
$settings['__unstableResolvedAssets'] = _gutenberg_get_iframed_editor_assets();
return $settings;
diff --git a/lib/compat/wordpress-6.4/fonts/fonts.php b/lib/compat/wordpress-6.4/fonts/fonts.php
index 2e06b6e085d907..ca930141b0c6db 100644
--- a/lib/compat/wordpress-6.4/fonts/fonts.php
+++ b/lib/compat/wordpress-6.4/fonts/fonts.php
@@ -39,7 +39,7 @@ function wp_print_font_faces( $fonts = array() ) {
// @core-merge: do not merge this code into Core.
add_filter(
'block_editor_settings_all',
- static function( $settings ) {
+ static function ( $settings ) {
ob_start();
// @core-merge: add only this line into Core's `_wp_get_iframed_editor_assets()` function after `wp_print_styles()`.
wp_print_font_faces();
diff --git a/lib/compat/wordpress-6.4/script-loader.php b/lib/compat/wordpress-6.4/script-loader.php
index 8be3084f9e0b67..0f90494927c725 100644
--- a/lib/compat/wordpress-6.4/script-loader.php
+++ b/lib/compat/wordpress-6.4/script-loader.php
@@ -179,7 +179,7 @@ function _gutenberg_get_iframed_editor_assets_6_4() {
add_filter(
'block_editor_settings_all',
- static function( $settings ) {
+ static function ( $settings ) {
// We must override what core is passing now.
$settings['__unstableResolvedAssets'] = _gutenberg_get_iframed_editor_assets_6_4();
return $settings;
diff --git a/lib/experimental/block-hooks.php b/lib/experimental/block-hooks.php
index abe85ee3b9ace8..0586b989608133 100644
--- a/lib/experimental/block-hooks.php
+++ b/lib/experimental/block-hooks.php
@@ -152,7 +152,7 @@ function gutenberg_add_hooked_block( $hooked_block, $position, $anchor_block ) {
* @return callable A function that accepts a block's content and returns the content with the inserted block.
*/
function gutenberg_insert_hooked_block( $inserted_block, $relative_position, $anchor_block_type ) {
- return function( $block ) use ( $inserted_block, $relative_position, $anchor_block_type ) {
+ return function ( $block ) use ( $inserted_block, $relative_position, $anchor_block_type ) {
if ( $anchor_block_type === $block['blockName'] ) {
if ( 'first_child' === $relative_position ) {
array_unshift( $block['innerBlocks'], $inserted_block );
@@ -173,7 +173,7 @@ function gutenberg_insert_hooked_block( $inserted_block, $relative_position, $an
$anchor_block_index = array_search( $anchor_block_type, array_column( $block['innerBlocks'], 'blockName' ), true );
if ( false !== $anchor_block_index && ( 'after' === $relative_position || 'before' === $relative_position ) ) {
if ( 'after' === $relative_position ) {
- $anchor_block_index++;
+ ++$anchor_block_index;
}
array_splice( $block['innerBlocks'], $anchor_block_index, 0, array( $inserted_block ) );
@@ -181,9 +181,9 @@ function gutenberg_insert_hooked_block( $inserted_block, $relative_position, $an
$chunk_index = 0;
while ( $anchor_block_index > 0 ) {
if ( ! is_string( $block['innerContent'][ $chunk_index ] ) ) {
- $anchor_block_index--;
+ --$anchor_block_index;
}
- $chunk_index++;
+ ++$chunk_index;
}
// Since WP_Block::render() iterates over `inner_content` (rather than `inner_blocks`)
// when rendering blocks, we also need to insert a value (`null`, to mark a block
@@ -204,7 +204,7 @@ function gutenberg_insert_hooked_block( $inserted_block, $relative_position, $an
* @return callable A filter for the `rest_prepare_block_type` hook that adds a `block_hooks` field to the network response.
*/
function gutenberg_add_block_hooks_field_to_block_type_controller( $inserted_block_type, $position, $anchor_block_type ) {
- return function( $response, $block_type ) use ( $inserted_block_type, $position, $anchor_block_type ) {
+ return function ( $response, $block_type ) use ( $inserted_block_type, $position, $anchor_block_type ) {
if ( $block_type->name !== $inserted_block_type ) {
return $response;
}
diff --git a/lib/experimental/blocks.php b/lib/experimental/blocks.php
index 5ab0d093758124..e509c889a9ef8a 100644
--- a/lib/experimental/blocks.php
+++ b/lib/experimental/blocks.php
@@ -42,7 +42,7 @@ function wp_enqueue_block_view_script( $block_name, $args ) {
* is to ensure the content exists.
* @return string Block content.
*/
- $callback = static function( $content, $block ) use ( $args, $block_name ) {
+ $callback = static function ( $content, $block ) use ( $args, $block_name ) {
// Sanity check.
if ( empty( $block['blockName'] ) || $block_name !== $block['blockName'] ) {
@@ -185,7 +185,7 @@ function gutenberg_render_block_connections( $block_content, $block, $block_inst
);
if ( ! $found ) {
return $block_content;
- };
+ }
$tag_name = $tags->get_tag();
$markup = "<$tag_name>$custom_value$tag_name>";
$updated_tags = new WP_HTML_Tag_Processor( $markup );
diff --git a/lib/experimental/class-wp-rest-customizer-nonces.php b/lib/experimental/class-wp-rest-customizer-nonces.php
index 15c587295557d8..67be9485df29f4 100644
--- a/lib/experimental/class-wp-rest-customizer-nonces.php
+++ b/lib/experimental/class-wp-rest-customizer-nonces.php
@@ -72,5 +72,4 @@ public function get_save_nonce() {
'stylesheet' => $wp_customize->get_stylesheet(),
);
}
-
}
diff --git a/lib/experimental/fonts-api/bc-layer/class-wp-web-fonts.php b/lib/experimental/fonts-api/bc-layer/class-wp-web-fonts.php
index 435895ef9489c9..550940935b7dbb 100644
--- a/lib/experimental/fonts-api/bc-layer/class-wp-web-fonts.php
+++ b/lib/experimental/fonts-api/bc-layer/class-wp-web-fonts.php
@@ -65,8 +65,8 @@ public function __construct() {
* @type string $provider_id => array {
* An associate array of provider's class name and fonts.
*
- * @type string $class Fully qualified name of the provider's class.
- * @type string[] $fonts An array of enqueued font handles for this provider.
+ * @type string $class_name Fully qualified name of the provider's class.
+ * @type string[] $fonts An array of enqueued font handles for this provider.
* }
* }
*/
@@ -80,16 +80,16 @@ public function get_providers() {
* @since X.X.X
*
* @param string $provider_id The provider's unique ID.
- * @param string $class The provider class name.
+ * @param string $class_name The provider class name.
* @return bool True if successfully registered, else false.
*/
- public function register_provider( $provider_id, $class ) {
- if ( empty( $provider_id ) || empty( $class ) || ! class_exists( $class ) ) {
+ public function register_provider( $provider_id, $class_name ) {
+ if ( empty( $provider_id ) || empty( $class_name ) || ! class_exists( $class_name ) ) {
return false;
}
$this->providers[ $provider_id ] = array(
- 'class' => $class,
+ 'class' => $class_name,
'fonts' => array(),
);
return true;
diff --git a/lib/experimental/fonts-api/class-wp-fonts.php b/lib/experimental/fonts-api/class-wp-fonts.php
index 5ce85bab315094..b6d965d5bbc5e6 100644
--- a/lib/experimental/fonts-api/class-wp-fonts.php
+++ b/lib/experimental/fonts-api/class-wp-fonts.php
@@ -115,8 +115,8 @@ public function __construct() {
* @type string $provider_id => array {
* An associate array of provider's class name and fonts.
*
- * @type string $class Fully qualified name of the provider's class.
- * @type string[] $fonts An array of enqueued font handles for this provider.
+ * @type string $class_name Fully qualified name of the provider's class.
+ * @type string[] $fonts An array of enqueued font handles for this provider.
* }
* }
*/
@@ -130,16 +130,16 @@ public function get_providers() {
* @since X.X.X
*
* @param string $provider_id The provider's unique ID.
- * @param string $class The provider class name.
+ * @param string $class_name The provider class name.
* @return bool True if successfully registered, else false.
*/
- public function register_provider( $provider_id, $class ) {
- if ( empty( $provider_id ) || empty( $class ) || ! class_exists( $class ) ) {
+ public function register_provider( $provider_id, $class_name ) {
+ if ( empty( $provider_id ) || empty( $class_name ) || ! class_exists( $class_name ) ) {
return false;
}
$this->providers[ $provider_id ] = array(
- 'class' => $class,
+ 'class' => $class_name,
'fonts' => array(),
);
return true;
diff --git a/lib/experimental/fonts-api/fonts-api.php b/lib/experimental/fonts-api/fonts-api.php
index 8d07dc118f56e1..2ff0ff07208d77 100644
--- a/lib/experimental/fonts-api/fonts-api.php
+++ b/lib/experimental/fonts-api/fonts-api.php
@@ -223,7 +223,7 @@ function wp_print_fonts( $handles = false ) {
*/
add_filter(
'mime_types',
- static function( $mime_types ) {
+ static function ( $mime_types ) {
// Webfonts formats.
$mime_types['woff2'] = 'font/woff2';
$mime_types['woff'] = 'font/woff';
@@ -246,7 +246,7 @@ static function( $mime_types ) {
add_filter(
'block_editor_settings_all',
- static function( $settings ) {
+ static function ( $settings ) {
ob_start();
wp_print_fonts( true );
$styles = ob_get_clean();
diff --git a/lib/experimental/fonts/font-library/class-wp-font-family.php b/lib/experimental/fonts/font-library/class-wp-font-family.php
index 76ffcd402ac9d3..cacf504382cce8 100644
--- a/lib/experimental/fonts/font-library/class-wp-font-family.php
+++ b/lib/experimental/fonts/font-library/class-wp-font-family.php
@@ -182,7 +182,7 @@ private function get_upload_overrides( $filename ) {
// Seems mime type for files that are not images cannot be tested.
// See wp_check_filetype_and_ext().
'test_type' => false,
- 'unique_filename_callback' => static function() use ( $filename ) {
+ 'unique_filename_callback' => static function () use ( $filename ) {
// Keep the original filename.
return $filename;
},
diff --git a/lib/experimental/interactivity-api/class-wp-directive-context.php b/lib/experimental/interactivity-api/class-wp-directive-context.php
index 6e28db83509f52..3fc47b26043167 100644
--- a/lib/experimental/interactivity-api/class-wp-directive-context.php
+++ b/lib/experimental/interactivity-api/class-wp-directive-context.php
@@ -44,7 +44,7 @@ class WP_Directive_Context {
*
* @param array $context A context.
*/
- function __construct( $context = array() ) {
+ public function __construct( $context = array() ) {
$this->set_context( $context );
}
diff --git a/lib/experimental/interactivity-api/class-wp-directive-processor.php b/lib/experimental/interactivity-api/class-wp-directive-processor.php
index e57000b3663ce4..807a02724197c1 100644
--- a/lib/experimental/interactivity-api/class-wp-directive-processor.php
+++ b/lib/experimental/interactivity-api/class-wp-directive-processor.php
@@ -27,7 +27,7 @@ class WP_Directive_Processor extends WP_HTML_Tag_Processor {
*
* @var array
*/
- static $root_blocks = array();
+ public static $root_blocks = array();
/**
* Add a root block to the list.
@@ -78,7 +78,7 @@ public function next_balanced_closer() {
)
) ) {
if ( ! $this->is_tag_closer() ) {
- $depth++;
+ ++$depth;
continue;
}
@@ -86,7 +86,7 @@ public function next_balanced_closer() {
return true;
}
- $depth--;
+ --$depth;
}
return false;
diff --git a/lib/experimental/interactivity-api/class-wp-interactivity-store.php b/lib/experimental/interactivity-api/class-wp-interactivity-store.php
index 0dd8aae5406fc0..89cb58700554a9 100644
--- a/lib/experimental/interactivity-api/class-wp-interactivity-store.php
+++ b/lib/experimental/interactivity-api/class-wp-interactivity-store.php
@@ -34,7 +34,7 @@ class WP_Interactivity_Store {
*
* @return array
*/
- static function get_data() {
+ public static function get_data() {
return self::$store;
}
@@ -43,21 +43,21 @@ static function get_data() {
*
* @param array $data The data that will be merged with the existing store.
*/
- static function merge_data( $data ) {
+ public static function merge_data( $data ) {
self::$store = array_replace_recursive( self::$store, $data );
}
/**
* Reset the store data.
*/
- static function reset() {
+ public static function reset() {
self::$store = array();
}
/**
* Render the store data.
*/
- static function render() {
+ public static function render() {
if ( empty( self::$store ) ) {
return;
}
diff --git a/lib/experimental/interactivity-api/directive-processing.php b/lib/experimental/interactivity-api/directive-processing.php
index ce20eac43b3cbd..41223c08158869 100644
--- a/lib/experimental/interactivity-api/directive-processing.php
+++ b/lib/experimental/interactivity-api/directive-processing.php
@@ -65,7 +65,7 @@ function gutenberg_interactivity_mark_inner_blocks( $parsed_block, $source_block
* WP_Directive_Processor.
*/
function gutenberg_interactivity_process_directives( $tags, $prefix, $directives ) {
- $context = new WP_Directive_Context;
+ $context = new WP_Directive_Context();
$tag_stack = array();
while ( $tags->next_tag( array( 'tag_closers' => 'visit' ) ) ) {
diff --git a/lib/experimental/kses.php b/lib/experimental/kses.php
index 6fa8ca641772a2..d447b10fcbd05d 100644
--- a/lib/experimental/kses.php
+++ b/lib/experimental/kses.php
@@ -60,7 +60,6 @@ function gutenberg_override_core_kses_init_filters() {
remove_filter( 'content_filtered_save_pre', 'wp_filter_global_styles_post', 9 );
add_filter( 'content_filtered_save_pre', 'gutenberg_filter_global_styles_post', 9 );
}
-
}
// The 'kses_init_filters' is usually initialized with default priority. Use higher priority to override.
add_action( 'init', 'gutenberg_override_core_kses_init_filters', 20 );
diff --git a/lib/experimental/navigation-theme-opt-in.php b/lib/experimental/navigation-theme-opt-in.php
index efd1a6eec5cb8c..547aa8b88ea7d1 100644
--- a/lib/experimental/navigation-theme-opt-in.php
+++ b/lib/experimental/navigation-theme-opt-in.php
@@ -161,7 +161,7 @@ function gutenberg_remove_block_nav_menu_items( $menu_items ) {
return array_filter(
$menu_items,
- static function( $menu_item ) {
+ static function ( $menu_item ) {
return 'block' !== $menu_item->type;
}
);
diff --git a/packages/block-library/src/comment-template/index.php b/packages/block-library/src/comment-template/index.php
index 5a0eef5685cf1c..915c5880a8f962 100644
--- a/packages/block-library/src/comment-template/index.php
+++ b/packages/block-library/src/comment-template/index.php
@@ -28,7 +28,7 @@ function block_core_comment_template_render_comments( $comments, $block ) {
$content = '';
foreach ( $comments as $comment ) {
$comment_id = $comment->comment_ID;
- $filter_block_context = static function( $context ) use ( $comment_id ) {
+ $filter_block_context = static function ( $context ) use ( $comment_id ) {
$context['commentId'] = $comment_id;
return $context;
};
diff --git a/packages/block-library/src/comments-pagination-next/index.php b/packages/block-library/src/comments-pagination-next/index.php
index 5a8df691ff0924..51d1f75c58d477 100644
--- a/packages/block-library/src/comments-pagination-next/index.php
+++ b/packages/block-library/src/comments-pagination-next/index.php
@@ -26,7 +26,7 @@ function render_block_core_comments_pagination_next( $attributes, $content, $blo
$label = isset( $attributes['label'] ) && ! empty( $attributes['label'] ) ? $attributes['label'] : $default_label;
$pagination_arrow = get_comments_pagination_arrow( $block, 'next' );
- $filter_link_attributes = static function() {
+ $filter_link_attributes = static function () {
return get_block_wrapper_attributes();
};
add_filter( 'next_comments_link_attributes', $filter_link_attributes );
diff --git a/packages/block-library/src/comments-pagination-previous/index.php b/packages/block-library/src/comments-pagination-previous/index.php
index ed3fa653abda9e..f194e8ab517f57 100644
--- a/packages/block-library/src/comments-pagination-previous/index.php
+++ b/packages/block-library/src/comments-pagination-previous/index.php
@@ -22,7 +22,7 @@ function render_block_core_comments_pagination_previous( $attributes, $content,
$label = $pagination_arrow . $label;
}
- $filter_link_attributes = static function() {
+ $filter_link_attributes = static function () {
return get_block_wrapper_attributes();
};
add_filter( 'previous_comments_link_attributes', $filter_link_attributes );
diff --git a/packages/block-library/src/latest-posts/index.php b/packages/block-library/src/latest-posts/index.php
index 4cbdf1ca61bed0..356ba5032689f7 100644
--- a/packages/block-library/src/latest-posts/index.php
+++ b/packages/block-library/src/latest-posts/index.php
@@ -48,7 +48,7 @@ function render_block_core_latest_posts( $attributes ) {
$block_core_latest_posts_excerpt_length = $attributes['excerptLength'];
add_filter( 'excerpt_length', 'block_core_latest_posts_get_excerpt_length', 20 );
- $filter_latest_posts_excerpt_more = static function( $more ) use ( $attributes ) {
+ $filter_latest_posts_excerpt_more = static function ( $more ) use ( $attributes ) {
$use_excerpt = 'excerpt' === $attributes['displayPostContentRadio'];
/* translators: %1$s is a URL to a post, excerpt truncation character, default … */
return $use_excerpt ? sprintf( __( ' … Read more' ), esc_url( get_permalink() ) ) : $more;
diff --git a/packages/block-library/src/navigation/index.php b/packages/block-library/src/navigation/index.php
index 6d5bb07335f2af..082db8c998a05d 100644
--- a/packages/block-library/src/navigation/index.php
+++ b/packages/block-library/src/navigation/index.php
@@ -105,7 +105,7 @@ function block_core_navigation_add_directives_to_submenu( $w, $block_attributes
$w->set_attribute( 'data-wp-on--click', 'actions.core.navigation.toggleMenuOnClick' );
$w->set_attribute( 'data-wp-bind--aria-expanded', 'selectors.core.navigation.isMenuOpen' );
// The `aria-expanded` attribute for SSR is already added in the submenu block.
- };
+ }
// Add directives to the submenu.
if ( $w->next_tag(
array(
@@ -120,7 +120,7 @@ function block_core_navigation_add_directives_to_submenu( $w, $block_attributes
block_core_navigation_add_directives_to_submenu( $w, $block_attributes );
}
return $w->get_updated_html();
-};
+}
/**
* Build an array with CSS classes and inline styles defining the colors
@@ -263,7 +263,7 @@ function block_core_navigation_render_submenu_icon() {
function block_core_navigation_filter_out_empty_blocks( $parsed_blocks ) {
$filtered = array_filter(
$parsed_blocks,
- static function( $block ) {
+ static function ( $block ) {
return isset( $block['blockName'] );
}
);
@@ -904,7 +904,7 @@ function block_core_navigation_get_classic_menu_fallback() {
// Otherwise return the most recently created classic menu.
usort(
$classic_nav_menus,
- static function( $a, $b ) {
+ static function ( $a, $b ) {
return $b->term_id - $a->term_id;
}
);
diff --git a/packages/block-library/src/post-excerpt/index.php b/packages/block-library/src/post-excerpt/index.php
index 4ed4edab95078b..09d6b6f003d34b 100644
--- a/packages/block-library/src/post-excerpt/index.php
+++ b/packages/block-library/src/post-excerpt/index.php
@@ -31,7 +31,7 @@ function render_block_core_post_excerpt( $attributes, $content, $block ) {
}
$more_text = ! empty( $attributes['moreText'] ) ? '' . wp_kses_post( $attributes['moreText'] ) . '' : '';
- $filter_excerpt_more = static function( $more ) use ( $more_text ) {
+ $filter_excerpt_more = static function ( $more ) use ( $more_text ) {
return empty( $more_text ) ? $more : '';
};
/**
@@ -87,7 +87,7 @@ function register_block_core_post_excerpt() {
defined( 'REST_REQUEST' ) && REST_REQUEST ) {
add_filter(
'excerpt_length',
- static function() {
+ static function () {
return 100;
},
PHP_INT_MAX
diff --git a/packages/block-library/src/post-template/index.php b/packages/block-library/src/post-template/index.php
index e616939514a682..2c7502ca3b6653 100644
--- a/packages/block-library/src/post-template/index.php
+++ b/packages/block-library/src/post-template/index.php
@@ -106,7 +106,7 @@ function render_block_core_post_template( $attributes, $content, $block ) {
$post_id = get_the_ID();
$post_type = get_post_type();
- $filter_block_context = static function( $context ) use ( $post_id, $post_type ) {
+ $filter_block_context = static function ( $context ) use ( $post_id, $post_type ) {
$context['postType'] = $post_type;
$context['postId'] = $post_id;
return $context;
diff --git a/packages/block-library/src/query-pagination-next/index.php b/packages/block-library/src/query-pagination-next/index.php
index 83c177c6fb0a9f..6b1861be8a1ef6 100644
--- a/packages/block-library/src/query-pagination-next/index.php
+++ b/packages/block-library/src/query-pagination-next/index.php
@@ -37,7 +37,7 @@ function render_block_core_query_pagination_next( $attributes, $content, $block
// Check if the pagination is for Query that inherits the global context.
if ( isset( $block->context['query']['inherit'] ) && $block->context['query']['inherit'] ) {
- $filter_link_attributes = static function() use ( $wrapper_attributes ) {
+ $filter_link_attributes = static function () use ( $wrapper_attributes ) {
return $wrapper_attributes;
};
add_filter( 'next_posts_link_attributes', $filter_link_attributes );
diff --git a/packages/block-library/src/query-pagination-previous/index.php b/packages/block-library/src/query-pagination-previous/index.php
index a580880f0f04c8..be5d62d6b0a918 100644
--- a/packages/block-library/src/query-pagination-previous/index.php
+++ b/packages/block-library/src/query-pagination-previous/index.php
@@ -35,7 +35,7 @@ function render_block_core_query_pagination_previous( $attributes, $content, $bl
// Check if the pagination is for Query that inherits the global context
// and handle appropriately.
if ( isset( $block->context['query']['inherit'] ) && $block->context['query']['inherit'] ) {
- $filter_link_attributes = static function() use ( $wrapper_attributes ) {
+ $filter_link_attributes = static function () use ( $wrapper_attributes ) {
return $wrapper_attributes;
};
diff --git a/packages/block-library/src/search/index.php b/packages/block-library/src/search/index.php
index da04a0478e3069..779130d6c21fb3 100644
--- a/packages/block-library/src/search/index.php
+++ b/packages/block-library/src/search/index.php
@@ -182,7 +182,7 @@ function render_block_core_search( $attributes, $content, $block ) {
data-wp-on--keydown="actions.core.search.handleSearchKeydown"
data-wp-on--focusout="actions.core.search.handleSearchFocusout"
';
- };
+ }
return sprintf(
'',
diff --git a/packages/e2e-tests/mu-plugins/enable-templates-ui.php b/packages/e2e-tests/mu-plugins/enable-templates-ui.php
index 0fe1056d4624b0..70b70af7048f85 100644
--- a/packages/e2e-tests/mu-plugins/enable-templates-ui.php
+++ b/packages/e2e-tests/mu-plugins/enable-templates-ui.php
@@ -12,7 +12,7 @@
*/
add_filter(
'register_post_type_args',
- static function( $args, $name ) {
+ static function ( $args, $name ) {
if ( in_array( $name, array( 'wp_template', 'wp_template_part' ), true ) ) {
$args['show_ui'] = wp_is_block_theme();
}
diff --git a/packages/e2e-tests/mu-plugins/nocache-headers.php b/packages/e2e-tests/mu-plugins/nocache-headers.php
index 0bb88030e68f5b..7b66b4eea336ca 100644
--- a/packages/e2e-tests/mu-plugins/nocache-headers.php
+++ b/packages/e2e-tests/mu-plugins/nocache-headers.php
@@ -12,7 +12,7 @@
// for 'networkidle'.
add_filter(
'nocache_headers',
- static function( $headers ) {
+ static function ( $headers ) {
$cache_control_parts = explode( ', ', $headers['Cache-Control'] );
$cache_control_parts = array_diff( $cache_control_parts, array( 'no-store' ) );
$headers['Cache-Control'] = implode( ', ', $cache_control_parts );
diff --git a/packages/e2e-tests/plugins/block-context.php b/packages/e2e-tests/plugins/block-context.php
index d245efce2a6156..f640665bb2f0ed 100644
--- a/packages/e2e-tests/plugins/block-context.php
+++ b/packages/e2e-tests/plugins/block-context.php
@@ -47,7 +47,7 @@ function gutenberg_test_register_context_blocks() {
'postId',
'postType',
),
- 'render_callback' => static function( $attributes, $content, $block ) {
+ 'render_callback' => static function ( $attributes, $content, $block ) {
$ordered_context = array(
$block->context['gutenberg/recordId'],
$block->context['postId'],
diff --git a/packages/e2e-tests/plugins/iframed-block.php b/packages/e2e-tests/plugins/iframed-block.php
index 574a48400ea2fb..329f3e26a479cb 100644
--- a/packages/e2e-tests/plugins/iframed-block.php
+++ b/packages/e2e-tests/plugins/iframed-block.php
@@ -9,14 +9,14 @@
add_action(
'setup_theme',
- static function() {
+ static function () {
add_theme_support( 'block-templates' );
}
);
add_action(
'init',
- static function() {
+ static function () {
wp_register_script(
'iframed-block-jquery-test',
plugin_dir_url( __FILE__ ) . 'iframed-block/jquery.test.js',
diff --git a/packages/e2e-tests/plugins/iframed-enqueue-block-assets.php b/packages/e2e-tests/plugins/iframed-enqueue-block-assets.php
index 3f24a6e25cfcb5..d02bfc6e2d34b7 100644
--- a/packages/e2e-tests/plugins/iframed-enqueue-block-assets.php
+++ b/packages/e2e-tests/plugins/iframed-enqueue-block-assets.php
@@ -9,7 +9,7 @@
add_action(
'enqueue_block_assets',
- static function() {
+ static function () {
wp_enqueue_style(
'iframed-enqueue-block-assets',
plugin_dir_url( __FILE__ ) . 'iframed-enqueue-block-assets/style.css',
diff --git a/packages/e2e-tests/plugins/iframed-enqueue-block-editor-settings.php b/packages/e2e-tests/plugins/iframed-enqueue-block-editor-settings.php
index 2e5eb32c042784..ef6361208848d7 100644
--- a/packages/e2e-tests/plugins/iframed-enqueue-block-editor-settings.php
+++ b/packages/e2e-tests/plugins/iframed-enqueue-block-editor-settings.php
@@ -9,7 +9,7 @@
add_action(
'block_editor_settings_all',
- function( $settings ) {
+ function ( $settings ) {
$settings['styles'][] = array(
'css' => 'p { border: 1px solid red }',
'__unstableType' => 'plugin',
diff --git a/packages/e2e-tests/plugins/iframed-inline-styles.php b/packages/e2e-tests/plugins/iframed-inline-styles.php
index ec44e371af6f08..0f8c69e1073337 100644
--- a/packages/e2e-tests/plugins/iframed-inline-styles.php
+++ b/packages/e2e-tests/plugins/iframed-inline-styles.php
@@ -9,14 +9,14 @@
add_action(
'setup_theme',
- static function() {
+ static function () {
add_theme_support( 'block-templates' );
}
);
add_action(
'init',
- static function() {
+ static function () {
wp_register_script(
'iframed-inline-styles-editor-script',
plugin_dir_url( __FILE__ ) . 'iframed-inline-styles/editor.js',
@@ -40,7 +40,7 @@ static function() {
add_action(
'enqueue_block_editor_assets',
- static function() {
+ static function () {
wp_enqueue_style(
'iframed-inline-styles-compat-style',
plugin_dir_url( __FILE__ ) . 'iframed-inline-styles/compat-style.css',
diff --git a/packages/e2e-tests/plugins/iframed-masonry-block.php b/packages/e2e-tests/plugins/iframed-masonry-block.php
index 3e7948ae2fa127..ebfbdb6b1257ec 100644
--- a/packages/e2e-tests/plugins/iframed-masonry-block.php
+++ b/packages/e2e-tests/plugins/iframed-masonry-block.php
@@ -9,14 +9,14 @@
add_action(
'setup_theme',
- static function() {
+ static function () {
add_theme_support( 'block-templates' );
}
);
add_action(
'init',
- static function() {
+ static function () {
wp_register_script(
'iframed-masonry-block-editor',
plugin_dir_url( __FILE__ ) . 'iframed-masonry-block/editor.js',
diff --git a/packages/e2e-tests/plugins/iframed-multiple-stylesheets.php b/packages/e2e-tests/plugins/iframed-multiple-stylesheets.php
index e70ba31938d14b..6a4505ed065228 100644
--- a/packages/e2e-tests/plugins/iframed-multiple-stylesheets.php
+++ b/packages/e2e-tests/plugins/iframed-multiple-stylesheets.php
@@ -9,14 +9,14 @@
add_action(
'setup_theme',
- static function() {
+ static function () {
add_theme_support( 'block-templates' );
}
);
add_action(
'init',
- static function() {
+ static function () {
wp_register_script(
'iframed-multiple-stylesheets-editor-script',
plugin_dir_url( __FILE__ ) . 'iframed-multiple-stylesheets/editor.js',
diff --git a/packages/e2e-tests/plugins/interactive-blocks.php b/packages/e2e-tests/plugins/interactive-blocks.php
index 8a44e5a0efd4ac..a6bd468493840d 100644
--- a/packages/e2e-tests/plugins/interactive-blocks.php
+++ b/packages/e2e-tests/plugins/interactive-blocks.php
@@ -9,7 +9,7 @@
add_action(
'init',
- function() {
+ function () {
// Register all blocks found in the `interactive-blocks` folder.
if ( file_exists( __DIR__ . '/interactive-blocks/' ) ) {
$block_json_files = glob( __DIR__ . '/interactive-blocks/**/block.json' );
@@ -30,8 +30,8 @@ function() {
);
register_block_type_from_metadata( $block_folder );
- };
- };
+ }
+ }
// Temporary fix to disable SSR of directives during E2E testing. This
// is required at this moment, as SSR for directives is not stabilized
@@ -43,6 +43,5 @@ function() {
'gutenberg_interactivity_process_directives_in_root_blocks'
);
}
-
}
);
diff --git a/packages/e2e-tests/plugins/marquee-function-widget.php b/packages/e2e-tests/plugins/marquee-function-widget.php
index 85881bab14c495..389641489af841 100644
--- a/packages/e2e-tests/plugins/marquee-function-widget.php
+++ b/packages/e2e-tests/plugins/marquee-function-widget.php
@@ -14,7 +14,7 @@ function marquee_greeting_init() {
wp_register_sidebar_widget(
'marquee_greeting',
'Marquee Greeting',
- static function() {
+ static function () {
$greeting = get_option( 'marquee_greeting', 'Hello!' );
printf( '', esc_html( $greeting ) );
}
@@ -23,7 +23,7 @@ static function() {
wp_register_widget_control(
'marquee_greeting',
'Marquee Greeting',
- static function() {
+ static function () {
if ( isset( $_POST['marquee-greeting'] ) ) {
update_option(
'marquee_greeting',
diff --git a/phpcs.xml.dist b/phpcs.xml.dist
index e8c672f130f7c5..d383de10726d21 100644
--- a/phpcs.xml.dist
+++ b/phpcs.xml.dist
@@ -10,15 +10,20 @@
-
-
+
+
+
+
+
+
+
+
-
@@ -48,6 +53,7 @@
./packages/block-serialization-spec-parser/parser.php
node_modules/*
+ build/*
./vendor/*
@@ -64,6 +70,7 @@
phpunit/*
+ test/gutenberg-test-themes/*
**/*.min.asset.php
@@ -90,22 +97,16 @@
phpunit/*
-
-
- ./packages/block-serialization-default-parser/parser.php
-
-
- ./packages/block-serialization-default-parser/parser.php
-
-
- ./packages/block-serialization-default-parser/parser.php
-
- ./packages/block-serialization-default-parser/parser.php
/phpunit/*
+
+
+ ./test/gutenberg-test-themes/*
+
+
/phpunit/*
diff --git a/phpunit/blocks/render-block-navigation-submenu-test.php b/phpunit/blocks/render-block-navigation-submenu-test.php
index 86ca34f5b997f8..4b60cab4514c94 100644
--- a/phpunit/blocks/render-block-navigation-submenu-test.php
+++ b/phpunit/blocks/render-block-navigation-submenu-test.php
@@ -208,6 +208,5 @@ public function test_should_not_apply_custom_colors_if_missing_from_context() {
'has-text-color has-background',
'Submenu block should not apply "has-*" color classes if missing from context'
);
-
}
}
diff --git a/phpunit/blocks/render-block-navigation-test.php b/phpunit/blocks/render-block-navigation-test.php
index ca4bbb6c342789..b8266d510ad6c6 100644
--- a/phpunit/blocks/render-block-navigation-test.php
+++ b/phpunit/blocks/render-block-navigation-test.php
@@ -85,5 +85,4 @@ public function test_gutenberg_block_core_navigation_block_contains_core_navigat
$inner_blocks = new WP_Block_List( $parsed_blocks );
$this->assertFalse( gutenberg_block_core_navigation_block_contains_core_navigation( $inner_blocks ) );
}
-
}
diff --git a/phpunit/blocks/render-comment-template-test.php b/phpunit/blocks/render-comment-template-test.php
index c297d1729d0dc5..64700424473aad 100644
--- a/phpunit/blocks/render-comment-template-test.php
+++ b/phpunit/blocks/render-comment-template-test.php
@@ -91,7 +91,7 @@ public function test_rendering_comment_template_sets_comment_id_context() {
'Comment Author Name block rendered markup is empty.'
);
- $render_block_callback = static function( $block_content, $block ) use ( $parsed_comment_author_name_block ) {
+ $render_block_callback = static function ( $block_content, $block ) use ( $parsed_comment_author_name_block ) {
// Insert a Comment Author Name block (which requires `commentId`
// block context to work) after the Comment Content block.
if ( 'core/comment-content' !== $block['blockName'] ) {
@@ -126,7 +126,7 @@ public function test_inner_block_inserted_by_render_block_data_is_retained() {
$render_block_callback = new MockAction();
add_filter( 'render_block', array( $render_block_callback, 'filter' ), 10, 3 );
- $render_block_data_callback = static function( $parsed_block ) {
+ $render_block_data_callback = static function ( $parsed_block ) {
// Add a Social Links block to a Comment Template block's inner blocks.
if ( 'core/comment-template' === $parsed_block['blockName'] ) {
$inserted_block_markup = << static function() use ( &$in_the_loop_logs ) {
+ 'render_callback' => static function () use ( &$in_the_loop_logs ) {
$in_the_loop_logs[] = in_the_loop();
return '';
},
diff --git a/phpunit/class-block-context-test.php b/phpunit/class-block-context-test.php
index 6c06cfd099bd4f..49bbb560e8022d 100644
--- a/phpunit/class-block-context-test.php
+++ b/phpunit/class-block-context-test.php
@@ -104,7 +104,7 @@ public function test_provides_block_context() {
'gutenberg/contextWithAssigned',
'gutenberg/contextWithoutDefault',
),
- 'render_callback' => static function( $attributes, $content, $block ) use ( &$provided_context ) {
+ 'render_callback' => static function ( $attributes, $content, $block ) use ( &$provided_context ) {
$provided_context[] = $block->context;
return '';
@@ -142,7 +142,7 @@ public function test_provides_default_context() {
'gutenberg/test-context-consumer',
array(
'uses_context' => array( 'postId', 'postType' ),
- 'render_callback' => static function( $attributes, $content, $block ) use ( &$provided_context ) {
+ 'render_callback' => static function ( $attributes, $content, $block ) use ( &$provided_context ) {
$provided_context[] = $block->context;
return '';
@@ -173,7 +173,7 @@ public function test_default_context_is_filterable() {
'gutenberg/test-context-consumer',
array(
'uses_context' => array( 'example' ),
- 'render_callback' => static function( $attributes, $content, $block ) use ( &$provided_context ) {
+ 'render_callback' => static function ( $attributes, $content, $block ) use ( &$provided_context ) {
$provided_context[] = $block->context;
return '';
@@ -181,7 +181,7 @@ public function test_default_context_is_filterable() {
)
);
- $filter_block_context = static function( $context ) {
+ $filter_block_context = static function ( $context ) {
$context['example'] = 'ok';
return $context;
};
diff --git a/phpunit/class-block-library-navigation-link-test.php b/phpunit/class-block-library-navigation-link-test.php
index b0a5b989a9ae83..7223a7d45abda9 100644
--- a/phpunit/class-block-library-navigation-link-test.php
+++ b/phpunit/class-block-library-navigation-link-test.php
@@ -246,7 +246,7 @@ public function test_returns_link_for_decoded_link() {
$urls_after_render[ $idx ]
) !== false
);
- };
+ }
}
public function test_returns_empty_when_custom_post_type_draft() {
diff --git a/phpunit/class-gutenberg-navigation-fallback-gutenberg-test.php b/phpunit/class-gutenberg-navigation-fallback-gutenberg-test.php
index edc48f1c71761b..6ae05e0a5ffb7f 100644
--- a/phpunit/class-gutenberg-navigation-fallback-gutenberg-test.php
+++ b/phpunit/class-gutenberg-navigation-fallback-gutenberg-test.php
@@ -182,7 +182,6 @@ public function test_should_return_fallback_navigation_from_existing_classic_men
// Check that only a single Navigation fallback was created.
$navs_in_db = $this->get_navigations_in_database();
$this->assertCount( 1, $navs_in_db, 'A single Navigation menu should be present in the database.' );
-
}
/**
@@ -335,7 +334,6 @@ public function test_should_not_create_fallback_from_classic_menu_if_a_navigatio
$navs_in_db = $this->get_navigations_in_database();
$this->assertCount( 1, $navs_in_db, 'Only the existing Navigation menus should be present in the database.' );
-
}
private function get_navigations_in_database() {
@@ -351,5 +349,4 @@ private function get_navigations_in_database() {
return $navs_in_db->posts ? $navs_in_db->posts : array();
}
-
}
diff --git a/phpunit/class-gutenberg-rest-navigation-fallback-controller-test.php b/phpunit/class-gutenberg-rest-navigation-fallback-controller-test.php
index d6df0c3c504ee3..0132bc53015e66 100644
--- a/phpunit/class-gutenberg-rest-navigation-fallback-controller-test.php
+++ b/phpunit/class-gutenberg-rest-navigation-fallback-controller-test.php
@@ -87,7 +87,6 @@ public function test_get_item() {
$navs_in_db = $this->get_navigations_in_database();
$this->assertCount( 1, $navs_in_db, 'Only a single Navigation menu should be present in the database.' );
-
}
/**
diff --git a/phpunit/class-phpunit-environment-setup-test.php b/phpunit/class-phpunit-environment-setup-test.php
index 6dd03a5a1f5afb..a704144ea17f0f 100644
--- a/phpunit/class-phpunit-environment-setup-test.php
+++ b/phpunit/class-phpunit-environment-setup-test.php
@@ -17,5 +17,4 @@ public function test_is_multisite_if_defined() {
$this->assertEquals( $is_multisite_in_env, is_multisite(), 'Despite WP_MULTISITE being set in the environment, the tests were not run in multisite mode. There is likely an issue with the phpunit setup.' );
}
-
}
diff --git a/phpunit/class-wp-theme-json-resolver-test.php b/phpunit/class-wp-theme-json-resolver-test.php
index 1588aa4d603265..eda8caede7bfec 100644
--- a/phpunit/class-wp-theme-json-resolver-test.php
+++ b/phpunit/class-wp-theme-json-resolver-test.php
@@ -229,13 +229,13 @@ public function test_add_theme_supports_are_loaded_for_themes_without_theme_json
/**
* Recursively applies ksort to an array.
*/
- private static function recursive_ksort( &$array ) {
- foreach ( $array as &$value ) {
+ private static function recursive_ksort( &$input_array ) {
+ foreach ( $input_array as &$value ) {
if ( is_array( $value ) ) {
self::recursive_ksort( $value );
}
}
- ksort( $array );
+ ksort( $input_array );
}
public function test_merges_child_theme_json_into_parent_theme_json() {
@@ -346,7 +346,7 @@ public function test_get_user_data_from_wp_global_styles_does_not_use_uncached_q
$this->assertNotEmpty( $user_cpt, 'User CPT is expected not to be empty.' );
$query_count = count( $this->queries );
- for ( $i = 0; $i < 3; $i ++ ) {
+ for ( $i = 0; $i < 3; $i++ ) {
$new_user_cpt = WP_Theme_JSON_Resolver_Gutenberg::get_user_data_from_wp_global_styles( $theme );
WP_Theme_JSON_Resolver_Gutenberg::clean_cached_data();
$this->assertSameSets( $user_cpt, $new_user_cpt, "User CPTs do not match on run {$i}." );
@@ -438,7 +438,7 @@ public function test_get_merged_data_returns_origin( $origin, $core_palette, $co
$this->assertSame( $core_palette, isset( $settings['color']['palette']['default'] ), $core_palette_text );
$styles = array_filter(
$styles,
- static function( $element ) {
+ static function ( $element ) {
return isset( $element['name'] ) && 'my/block-with-styles' === $element['name'];
}
);
@@ -568,5 +568,4 @@ public function test_get_style_variations_returns_all_variations() {
$actual_settings
);
}
-
}
diff --git a/phpunit/class-wp-theme-json-test.php b/phpunit/class-wp-theme-json-test.php
index 11ec35e0925bfe..619be4ce806c8f 100644
--- a/phpunit/class-wp-theme-json-test.php
+++ b/phpunit/class-wp-theme-json-test.php
@@ -1604,7 +1604,6 @@ public function test_sanitize_with_invalid_style_variation( $theme_json_variatio
$sanitized_theme_json = $theme_json->get_raw_data();
$this->assertIsArray( $sanitized_theme_json, 'Sanitized theme.json is not an array data type' );
$this->assertArrayNotHasKey( 'styles', $sanitized_theme_json, 'Sanitized theme.json should not have a "styles" key' );
-
}
/**
@@ -1892,7 +1891,6 @@ public function test_update_separator_declarations() {
$expected = $base_styles . '.wp-block-separator{background-color: blue;border-color: pink;}';
$stylesheet = $theme_json->get_stylesheet( array( 'styles' ) );
$this->assertEquals( $expected, $stylesheet );
-
}
public function test_get_custom_css_handles_global_custom_css() {
@@ -2098,7 +2096,6 @@ public function test_internal_syntax_is_converted_to_css_variables() {
$this->assertEquals( 'var(--wp--preset--font-size--s)', $styles['blocks']['core/quote']['variations']['plain']['typography']['fontSize'], 'Style variations: Assert the originally correct values are still correct.' );
$this->assertEquals( 'var(--wp--preset--color--s)', $styles['blocks']['core/quote']['variations']['plain']['color']['background'], 'Style variations: Assert the internal variables are convert to CSS custom variables.' );
-
}
public function test_resolve_variables() {
@@ -2253,5 +2250,4 @@ public function test_resolve_variables() {
$this->assertEquals( $small_font, $styles['blocks']['core/quote']['variations']['plain']['typography']['fontSize'], 'Block variations: font-size' );
$this->assertEquals( $secondary_color, $styles['blocks']['core/quote']['variations']['plain']['color']['background'], 'Block variations: color' );
}
-
}
diff --git a/phpunit/experimental/interactivity-api/directive-processing-test.php b/phpunit/experimental/interactivity-api/directive-processing-test.php
index 4da0a4a85ac3c0..44838b4ce68d3e 100644
--- a/phpunit/experimental/interactivity-api/directive-processing-test.php
+++ b/phpunit/experimental/interactivity-api/directive-processing-test.php
@@ -4,18 +4,21 @@
*
* @package Gutenberg
* @subpackage Interactivity API
+ *
+ * @phpcs:disable Generic.Files.OneObjectStructurePerFile.MultipleFound
*/
+
class Helper_Class {
// phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
- function process_foo_test( $tags, $context ) {
+ public function process_foo_test( $tags, $context ) {
}
- function increment( $store ) {
+ public function increment( $store ) {
return $store['state']['count'] + $store['context']['count'];
}
- static function static_increment( $store ) {
+ public static function static_increment( $store ) {
return $store['state']['count'] + $store['context']['count'];
}
}
@@ -40,7 +43,7 @@ public function test_correctly_call_attribute_directive_processor_on_closing_tag
->method( 'process_foo_test' )
->with(
$this->callback(
- function( $p ) {
+ function ( $p ) {
return 'DIV' === $p->get_tag() && (
// Either this is a closing tag...
$p->is_tag_closer() ||
@@ -129,7 +132,7 @@ public function test_evaluate_function_should_return_null_for_unresolved_paths()
public function test_evaluate_function_should_execute_anonymous_functions() {
$context = new WP_Directive_Context( array( 'count' => 2 ) );
- $helper = new Helper_Class;
+ $helper = new Helper_Class();
wp_store(
array(
@@ -137,7 +140,7 @@ public function test_evaluate_function_should_execute_anonymous_functions() {
'count' => 3,
),
'selectors' => array(
- 'anonymous_function' => function( $store ) {
+ 'anonymous_function' => function ( $store ) {
return $store['state']['count'] + $store['context']['count'];
},
// Other types of callables should not be executed.
diff --git a/phpunit/experimental/interactivity-api/directives/wp-context-test.php b/phpunit/experimental/interactivity-api/directives/wp-context-test.php
index 90ffb7dd9bf296..0f36f38ba837db 100644
--- a/phpunit/experimental/interactivity-api/directives/wp-context-test.php
+++ b/phpunit/experimental/interactivity-api/directives/wp-context-test.php
@@ -73,5 +73,4 @@ public function test_directive_doesnt_throw_on_malformed_context_objects() {
$context->get_context()
);
}
-
}
diff --git a/phpunit/l10n-test.php b/phpunit/l10n-test.php
index 4f71e9e89e2279..b191bbd1babc38 100644
--- a/phpunit/l10n-test.php
+++ b/phpunit/l10n-test.php
@@ -13,19 +13,19 @@ class Tests_L10n_wpWordcount extends WP_UnitTestCase {
*
* @dataProvider data_get_string_variations
*
- * @param string $string String to count words.
+ * @param string $input_string String to count words.
* @param int $words Expected value if the count type is based on word.
* @param int $characters_excluding_spaces Expected value if the count type is based on single character excluding spaces.
* @param int $characters_including_spaces Expected value if the count type is based on single character including spaces.
*/
- public function test_word_count( $string, $words, $characters_excluding_spaces, $characters_including_spaces ) {
+ public function test_word_count( $input_string, $words, $characters_excluding_spaces, $characters_including_spaces ) {
$settings = array(
'shortcodes' => array( 'shortcode' ),
);
- $this->assertEquals( wp_word_count( $string, 'words', $settings ), $words );
- $this->assertEquals( wp_word_count( $string, 'characters_excluding_spaces', $settings ), $characters_excluding_spaces );
- $this->assertEquals( wp_word_count( $string, 'characters_including_spaces', $settings ), $characters_including_spaces );
+ $this->assertEquals( wp_word_count( $input_string, 'words', $settings ), $words );
+ $this->assertEquals( wp_word_count( $input_string, 'characters_excluding_spaces', $settings ), $characters_excluding_spaces );
+ $this->assertEquals( wp_word_count( $input_string, 'characters_including_spaces', $settings ), $characters_including_spaces );
}
/**
diff --git a/phpunit/tests/fonts-api/base.php b/phpunit/tests/fonts-api/base.php
index 11ae3b624ea8ca..5d03e2733964af 100644
--- a/phpunit/tests/fonts-api/base.php
+++ b/phpunit/tests/fonts-api/base.php
@@ -161,12 +161,12 @@ protected function set_up_mock( $method ) {
return $mock;
}
- protected function setup_object_mock( $method, $class ) {
+ protected function setup_object_mock( $method, $class_name ) {
if ( is_string( $method ) ) {
$method = array( $method );
}
- return $this->getMockBuilder( $class )->setMethods( $method )->getMock();
+ return $this->getMockBuilder( $class_name )->setMethods( $method )->getMock();
}
protected function get_registered_handles() {
@@ -193,15 +193,15 @@ protected function get_queued_before_register( $wp_fonts = null ) {
return $this->get_property_value( 'queued_before_register', WP_Dependencies::class, $wp_fonts );
}
- protected function get_reflection_property( $property_name, $class = 'WP_Fonts' ) {
- $property = new ReflectionProperty( $class, $property_name );
+ protected function get_reflection_property( $property_name, $class_name = 'WP_Fonts' ) {
+ $property = new ReflectionProperty( $class_name, $property_name );
$property->setAccessible( true );
return $property;
}
- protected function get_property_value( $property_name, $class, $wp_fonts = null ) {
- $property = $this->get_reflection_property( $property_name, $class );
+ protected function get_property_value( $property_name, $class_name, $wp_fonts = null ) {
+ $property = $this->get_reflection_property( $property_name, $class_name );
if ( ! $wp_fonts ) {
$wp_fonts = wp_fonts();
@@ -210,19 +210,19 @@ protected function get_property_value( $property_name, $class, $wp_fonts = null
return $property->getValue( $wp_fonts );
}
- protected function setup_property( $class, $property_name ) {
- $key = $this->get_property_key( $class, $property_name );
+ protected function setup_property( $class_name, $property_name ) {
+ $key = $this->get_property_key( $class_name, $property_name );
if ( ! isset( $this->property[ $key ] ) ) {
- $this->property[ $key ] = new ReflectionProperty( $class, 'providers' );
+ $this->property[ $key ] = new ReflectionProperty( $class_name, 'providers' );
$this->property[ $key ]->setAccessible( true );
}
return $this->property[ $key ];
}
- protected function get_property_key( $class, $property_name ) {
- return $class . '::$' . $property_name;
+ protected function get_property_key( $class_name, $property_name ) {
+ return $class_name . '::$' . $property_name;
}
/**
diff --git a/phpunit/tests/fonts-api/wpFonts/add.php b/phpunit/tests/fonts-api/wpFonts/add.php
index f9449b87c53b53..85d3d98c0f3556 100644
--- a/phpunit/tests/fonts-api/wpFonts/add.php
+++ b/phpunit/tests/fonts-api/wpFonts/add.php
@@ -25,7 +25,6 @@ public function test_add( $handle ) {
$this->assertTrue( $wp_fonts->add( $handle, false ), 'Registering a handle should return true' );
$this->assertCount( 1, $wp_fonts->registered );
$this->assertArrayHasKey( $handle, $wp_fonts->registered, 'Font family handle should be in the registry after registration' );
-
}
/**
diff --git a/phpunit/tests/fonts-api/wpFonts/addFontFamily.php b/phpunit/tests/fonts-api/wpFonts/addFontFamily.php
index f227c2c4025a40..69b6bccf5ae352 100644
--- a/phpunit/tests/fonts-api/wpFonts/addFontFamily.php
+++ b/phpunit/tests/fonts-api/wpFonts/addFontFamily.php
@@ -27,7 +27,6 @@ public function test_should_register( $font_family, $expected ) {
$this->assertSame( $expected, $font_family_handle, 'Registering a font-family should return its handle' );
$this->assertCount( 1, $wp_fonts->registered );
$this->assertArrayHasKey( $font_family_handle, $wp_fonts->registered, 'Font family handle should be in the registry after registration' );
-
}
/**
diff --git a/phpunit/tests/fonts-api/wpFonts/doItem.php b/phpunit/tests/fonts-api/wpFonts/doItem.php
index af46f376b3bc5c..a92bd244d1f2ae 100644
--- a/phpunit/tests/fonts-api/wpFonts/doItem.php
+++ b/phpunit/tests/fonts-api/wpFonts/doItem.php
@@ -18,7 +18,7 @@ class Tests_Fonts_WpFonts_DoItem extends WP_Fonts_TestCase {
public function set_up() {
parent::set_up();
- $this->wp_fonts = new WP_Fonts;
+ $this->wp_fonts = new WP_Fonts();
}
public function test_should_return_false_when_provider_not_registered() {
diff --git a/phpunit/tests/fonts-api/wpFonts/doItems.php b/phpunit/tests/fonts-api/wpFonts/doItems.php
index 23307366101cb0..8a29e7463406a8 100644
--- a/phpunit/tests/fonts-api/wpFonts/doItems.php
+++ b/phpunit/tests/fonts-api/wpFonts/doItems.php
@@ -19,7 +19,7 @@ class Tests_Fonts_WpFonts_DoItems extends WP_Fonts_TestCase {
public function set_up() {
parent::set_up();
- $this->wp_fonts = new WP_Fonts;
+ $this->wp_fonts = new WP_Fonts();
}
public function test_should_not_process_when_no_providers_registered() {
diff --git a/phpunit/tests/fonts-api/wpFonts/registerProvider.php b/phpunit/tests/fonts-api/wpFonts/registerProvider.php
index 09d3d7f3891720..c67976e0a68655 100644
--- a/phpunit/tests/fonts-api/wpFonts/registerProvider.php
+++ b/phpunit/tests/fonts-api/wpFonts/registerProvider.php
@@ -19,12 +19,12 @@ class Tests_Fonts_WpFonts_RegisterProvider extends WP_Fonts_TestCase {
* @dataProvider data_register_providers
*
* @param string $provider_id Provider ID.
- * @param string $class Provider class name.
+ * @param string $class_name Provider class name.
* @param array $expected Expected providers queue.
*/
- public function test_should_register_provider( $provider_id, $class, $expected ) {
+ public function test_should_register_provider( $provider_id, $class_name, $expected ) {
$wp_fonts = new WP_Fonts();
- $this->assertTrue( $wp_fonts->register_provider( $provider_id, $class ), 'WP_Fonts::register_provider() should return true' );
+ $this->assertTrue( $wp_fonts->register_provider( $provider_id, $class_name ), 'WP_Fonts::register_provider() should return true' );
$this->assertSame( $expected, $wp_fonts->get_providers(), 'Provider "' . $provider_id . '" should be registered in providers queue' );
}
@@ -83,12 +83,12 @@ public function test_should_register_multiple_providers() {
* @dataProvider data_invalid_providers
*
* @param string $provider_id Provider ID.
- * @param string $class Provider class name.
+ * @param string $class_name Provider class name.
*/
- public function test_should_not_register( $provider_id, $class ) {
+ public function test_should_not_register( $provider_id, $class_name ) {
$wp_fonts = new WP_Fonts();
- $this->assertFalse( $wp_fonts->register_provider( $provider_id, $class ), 'WP_Fonts::register_provider() should return false' );
+ $this->assertFalse( $wp_fonts->register_provider( $provider_id, $class_name ), 'WP_Fonts::register_provider() should return false' );
$this->assertArrayNotHasKey( $provider_id, $wp_fonts->get_providers(), 'Both local and mock providers should be registered' );
}
diff --git a/phpunit/tests/fonts-api/wpFontsResolver/registerFontsFromThemeJson.php b/phpunit/tests/fonts-api/wpFontsResolver/registerFontsFromThemeJson.php
index c812b98d3d156d..0186dbf34f3fdc 100644
--- a/phpunit/tests/fonts-api/wpFontsResolver/registerFontsFromThemeJson.php
+++ b/phpunit/tests/fonts-api/wpFontsResolver/registerFontsFromThemeJson.php
@@ -261,7 +261,7 @@ public function test_should_skip_when_font_face_not_defined() {
* @return WP_Theme_JSON_Data_Gutenberg| WP_Theme_JSON_Data Modified instance.
* @throws ReflectionException
*/
- $remove_expected_font_family = static function( $theme_json_data ) use ( $expected_font_family ) {
+ $remove_expected_font_family = static function ( $theme_json_data ) use ( $expected_font_family ) {
// Need to get the underlying data array which is in WP_Theme_JSON_Gutenberg | WP_Theme_JSON object.
$property = new ReflectionProperty( $theme_json_data, 'theme_json' );
$property->setAccessible( true );
diff --git a/phpunit/tests/fonts-api/wpRegisterFontProvider.php b/phpunit/tests/fonts-api/wpRegisterFontProvider.php
index 9288ee3850672d..907355bdc91c82 100644
--- a/phpunit/tests/fonts-api/wpRegisterFontProvider.php
+++ b/phpunit/tests/fonts-api/wpRegisterFontProvider.php
@@ -19,19 +19,19 @@ class Tests_Fonts_WpRegisterFontProvider extends WP_Fonts_TestCase {
* @dataProvider data_register_providers
*
* @param string $provider_id Provider ID.
- * @param string $class Provider class name.
+ * @param string $class_name Provider class name.
*/
- public function test_should_register_provider( $provider_id, $class ) {
+ public function test_should_register_provider( $provider_id, $class_name ) {
$mock = $this->set_up_mock( 'register_provider' );
$mock->expects( $this->once() )
->method( 'register_provider' )
->with(
$this->identicalTo( $provider_id ),
- $this->identicalTo( $class )
+ $this->identicalTo( $class_name )
)
->will( $this->returnValue( true ) );
- $this->assertTrue( wp_register_font_provider( $provider_id, $class ), 'wp_register_font_provider() should return true' );
+ $this->assertTrue( wp_register_font_provider( $provider_id, $class_name ), 'wp_register_font_provider() should return true' );
}
/**
@@ -56,20 +56,19 @@ public function data_register_providers() {
* @dataProvider data_invalid_providers
*
* @param string $provider_id Provider ID.
- * @param string $class Provider class name.
+ * @param string $class_name Provider class name.
*/
- public function test_should_not_register( $provider_id, $class ) {
+ public function test_should_not_register( $provider_id, $class_name ) {
$mock = $this->set_up_mock( 'register_provider' );
$mock->expects( $this->once() )
->method( 'register_provider' )
->with(
$this->identicalTo( $provider_id ),
- $this->identicalTo( $class )
+ $this->identicalTo( $class_name )
)
->will( $this->returnValue( false ) );
- $this->assertFalse( wp_register_font_provider( $provider_id, $class ), 'wp_register_font_provider() should return false' );
-
+ $this->assertFalse( wp_register_font_provider( $provider_id, $class_name ), 'wp_register_font_provider() should return false' );
}
/**
diff --git a/phpunit/tests/fonts/font-face/base.php b/phpunit/tests/fonts/font-face/base.php
index 4d8d487cb47c97..4d6c9cc5cc0325 100644
--- a/phpunit/tests/fonts/font-face/base.php
+++ b/phpunit/tests/fonts/font-face/base.php
@@ -140,15 +140,15 @@ public function filter_set_theme_root() {
return self::$theme_root;
}
- protected function get_reflection_property( $property_name, $class = 'WP_Fonts' ) {
- $property = new ReflectionProperty( $class, $property_name );
+ protected function get_reflection_property( $property_name, $class_name = 'WP_Fonts' ) {
+ $property = new ReflectionProperty( $class_name, $property_name );
$property->setAccessible( true );
return $property;
}
- protected function get_property_value( $property_name, $class, $wp_fonts = null ) {
- $property = $this->get_reflection_property( $property_name, $class );
+ protected function get_property_value( $property_name, $class_name, $wp_fonts = null ) {
+ $property = $this->get_reflection_property( $property_name, $class_name );
if ( ! $wp_fonts ) {
$wp_fonts = wp_fonts();
@@ -157,19 +157,19 @@ protected function get_property_value( $property_name, $class, $wp_fonts = null
return $property->getValue( $wp_fonts );
}
- protected function setup_property( $class, $property_name ) {
- $key = $this->get_property_key( $class, $property_name );
+ protected function setup_property( $class_name, $property_name ) {
+ $key = $this->get_property_key( $class_name, $property_name );
if ( ! isset( $this->property[ $key ] ) ) {
- $this->property[ $key ] = new ReflectionProperty( $class, 'providers' );
+ $this->property[ $key ] = new ReflectionProperty( $class_name, 'providers' );
$this->property[ $key ]->setAccessible( true );
}
return $this->property[ $key ];
}
- protected function get_property_key( $class, $property_name ) {
- return $class . '::$' . $property_name;
+ protected function get_property_key( $class_name, $property_name ) {
+ return $class_name . '::$' . $property_name;
}
/**
diff --git a/phpunit/tests/fonts/font-library/wpFontLibrary/getFontCollection.php b/phpunit/tests/fonts/font-library/wpFontLibrary/getFontCollection.php
index 1d4573cbe060c4..b3d8d1f10a1efc 100644
--- a/phpunit/tests/fonts/font-library/wpFontLibrary/getFontCollection.php
+++ b/phpunit/tests/fonts/font-library/wpFontLibrary/getFontCollection.php
@@ -32,5 +32,4 @@ public function test_should_get_no_font_collection_if_the_id_is_not_registered()
$font_collection = WP_Font_Library::get_font_collection( 'not-registered-font-collection' );
$this->assertWPError( $font_collection );
}
-
}
diff --git a/phpunit/tests/fonts/font-library/wpRestFontLibraryController/getFontCollection.php b/phpunit/tests/fonts/font-library/wpRestFontLibraryController/getFontCollection.php
index 2b605302e37ffc..ca661a1aac6268 100644
--- a/phpunit/tests/fonts/font-library/wpRestFontLibraryController/getFontCollection.php
+++ b/phpunit/tests/fonts/font-library/wpRestFontLibraryController/getFontCollection.php
@@ -45,4 +45,3 @@ public function test_get_non_existing_collection_should_return_404() {
$this->assertSame( 404, $response->get_status() );
}
}
-
diff --git a/phpunit/tests/fonts/font-library/wpRestFontLibraryController/getFontCollections.php b/phpunit/tests/fonts/font-library/wpRestFontLibraryController/getFontCollections.php
index bf527093e4df1c..52678aa4cb94ae 100644
--- a/phpunit/tests/fonts/font-library/wpRestFontLibraryController/getFontCollections.php
+++ b/phpunit/tests/fonts/font-library/wpRestFontLibraryController/getFontCollections.php
@@ -43,4 +43,3 @@ public function test_get_font_collections() {
$this->assertArrayHasKey( 'name', $data[0], 'The response data does not have the key with the collection name.' );
}
}
-
diff --git a/phpunit/tests/fonts/font-library/wpRestFontLibraryController/installFonts.php b/phpunit/tests/fonts/font-library/wpRestFontLibraryController/installFonts.php
index 8b8ec28406ac1d..1813f535c109f5 100644
--- a/phpunit/tests/fonts/font-library/wpRestFontLibraryController/installFonts.php
+++ b/phpunit/tests/fonts/font-library/wpRestFontLibraryController/installFonts.php
@@ -50,7 +50,6 @@ public function test_install_fonts( $font_families, $files, $expected_response )
// Compares if the rest of the data is the same.
$this->assertEquals( $expected_font, $installed_font, 'The endpoint answer is not as expected.' );
}
-
}
/**
@@ -416,4 +415,3 @@ public function data_install_with_improper_inputs() {
);
}
}
-
diff --git a/phpunit/tests/fonts/font-library/wpRestFontLibraryController/registerRoutes.php b/phpunit/tests/fonts/font-library/wpRestFontLibraryController/registerRoutes.php
index ee957300090b00..2ac7b93c3a4141 100644
--- a/phpunit/tests/fonts/font-library/wpRestFontLibraryController/registerRoutes.php
+++ b/phpunit/tests/fonts/font-library/wpRestFontLibraryController/registerRoutes.php
@@ -26,4 +26,3 @@ public function test_register_routes() {
$this->assertArrayHasKey( 'GET', $routes['/wp/v2/fonts/collections/(?P[\/\w-]+)'][0]['methods'], 'Rest server has not the GET method for collection intialized.' );
}
}
-
diff --git a/phpunit/tests/fonts/font-library/wpRestFontLibraryController/uninstallFonts.php b/phpunit/tests/fonts/font-library/wpRestFontLibraryController/uninstallFonts.php
index 9edcec970146db..3082bfc87f62ef 100644
--- a/phpunit/tests/fonts/font-library/wpRestFontLibraryController/uninstallFonts.php
+++ b/phpunit/tests/fonts/font-library/wpRestFontLibraryController/uninstallFonts.php
@@ -72,7 +72,6 @@ public function test_uninstall() {
$response = rest_get_server()->dispatch( $uninstall_request );
echo ( print_r( $response->get_data(), true ) );
$this->assertSame( 200, $response->get_status(), 'The response status is not 200.' );
-
}
@@ -96,5 +95,3 @@ public function test_uninstall_non_existing_fonts() {
$this->assertSame( 500, $response->get_status(), 'The response status is not 500.' );
}
}
-
-
diff --git a/test/emptytheme/functions.php b/test/emptytheme/functions.php
index 137cbef8de59d4..79ae16f9694a1f 100644
--- a/test/emptytheme/functions.php
+++ b/test/emptytheme/functions.php
@@ -20,12 +20,13 @@ function emptytheme_support() {
add_action( 'after_setup_theme', 'emptytheme_support' );
endif;
-/**
- * Enqueue scripts and styles.
- */
-function emptytheme_scripts() {
- // Enqueue theme stylesheet.
- wp_enqueue_style( 'emptytheme-style', get_template_directory_uri() . '/style.css', array(), wp_get_theme()->get( 'Version' ) );
-}
-
-add_action( 'wp_enqueue_scripts', 'emptytheme_scripts' );
+if ( ! function_exists( 'emptytheme_scripts' ) ) :
+ /**
+ * Enqueue scripts and styles.
+ */
+ function emptytheme_scripts() {
+ // Enqueue theme stylesheet.
+ wp_enqueue_style( 'emptytheme-style', get_template_directory_uri() . '/style.css', array(), wp_get_theme()->get( 'Version' ) );
+ }
+ add_action( 'wp_enqueue_scripts', 'emptytheme_scripts' );
+endif;
diff --git a/test/gutenberg-test-themes/emptyhybrid/functions.php b/test/gutenberg-test-themes/emptyhybrid/functions.php
index 350fe964691434..9d7b70f052d6a2 100644
--- a/test/gutenberg-test-themes/emptyhybrid/functions.php
+++ b/test/gutenberg-test-themes/emptyhybrid/functions.php
@@ -23,11 +23,13 @@ function emptyhybrid_support() {
add_action( 'after_setup_theme', 'emptyhybrid_support' );
endif;
-/**
- * Enqueue scripts and styles.
- */
-function emptyhybrid_scripts() {
- // Enqueue theme stylesheet.
- wp_enqueue_style( 'emptyhybrid-style', get_template_directory_uri() . '/style.css', array(), wp_get_theme()->get( 'Version' ) );
-}
-add_action( 'wp_enqueue_scripts', 'emptyhybrid_scripts' );
+if ( ! function_exists( 'emptyhybrid_scripts' ) ) :
+ /**
+ * Enqueue scripts and styles.
+ */
+ function emptyhybrid_scripts() {
+ // Enqueue theme stylesheet.
+ wp_enqueue_style( 'emptyhybrid-style', get_template_directory_uri() . '/style.css', array(), wp_get_theme()->get( 'Version' ) );
+ }
+ add_action( 'wp_enqueue_scripts', 'emptyhybrid_scripts' );
+endif;