diff --git a/src/wp-admin/customize.php b/src/wp-admin/customize.php
index 0df5d81ae5..cd2550c1a8 100644
--- a/src/wp-admin/customize.php
+++ b/src/wp-admin/customize.php
@@ -97,7 +97,7 @@ if ( ! empty( $autofocus ) && is_array( $autofocus ) ) {
}
$registered = $wp_scripts->registered;
-$wp_scripts = new WP_Scripts;
+$wp_scripts = new WP_Scripts();
$wp_scripts->registered = $registered;
add_action( 'customize_controls_print_scripts', 'print_head_scripts', 20 );
diff --git a/src/wp-admin/includes/ajax-actions.php b/src/wp-admin/includes/ajax-actions.php
index 6ca6a0217a..995433eaba 100644
--- a/src/wp-admin/includes/ajax-actions.php
+++ b/src/wp-admin/includes/ajax-actions.php
@@ -1570,7 +1570,7 @@ function wp_ajax_add_menu_item() {
'before' => '',
'link_after' => '',
'link_before' => '',
- 'walker' => new $walker_class_name,
+ 'walker' => new $walker_class_name(),
);
echo walk_nav_menu_tree( $menu_items, 0, (object) $args );
diff --git a/src/wp-admin/includes/bookmark.php b/src/wp-admin/includes/bookmark.php
index 8d26e27a5e..abb068319c 100644
--- a/src/wp-admin/includes/bookmark.php
+++ b/src/wp-admin/includes/bookmark.php
@@ -59,7 +59,7 @@ function edit_link( $link_id = 0 ) {
* @return stdClass Default link object.
*/
function get_default_link_to_edit() {
- $link = new stdClass;
+ $link = new stdClass();
if ( isset( $_GET['linkurl'] ) ) {
$link->link_url = esc_url( wp_unslash( $_GET['linkurl'] ) );
} else {
diff --git a/src/wp-admin/includes/class-language-pack-upgrader.php b/src/wp-admin/includes/class-language-pack-upgrader.php
index c219999569..0d6961ab22 100644
--- a/src/wp-admin/includes/class-language-pack-upgrader.php
+++ b/src/wp-admin/includes/class-language-pack-upgrader.php
@@ -62,7 +62,7 @@ class Language_Pack_Upgrader extends WP_Upgrader {
* Avoid messing with VCS installations, at least for now.
* Noted: this is not the ideal way to accomplish this.
*/
- $check_vcs = new WP_Automatic_Updater;
+ $check_vcs = new WP_Automatic_Updater();
if ( $check_vcs->is_vcs_checkout( WP_CONTENT_DIR ) ) {
return;
}
diff --git a/src/wp-admin/includes/class-wp-automatic-updater.php b/src/wp-admin/includes/class-wp-automatic-updater.php
index 2d62527a98..083a6dcc36 100644
--- a/src/wp-admin/includes/class-wp-automatic-updater.php
+++ b/src/wp-admin/includes/class-wp-automatic-updater.php
@@ -139,7 +139,7 @@ class WP_Automatic_Updater {
*/
public function should_update( $type, $item, $context ) {
// Used to see if WP_Filesystem is set up to allow unattended updates.
- $skin = new Automatic_Upgrader_Skin;
+ $skin = new Automatic_Upgrader_Skin();
if ( $this->is_disabled() ) {
return false;
@@ -305,7 +305,7 @@ class WP_Automatic_Updater {
* @return null|WP_Error
*/
public function update( $type, $item ) {
- $skin = new Automatic_Upgrader_Skin;
+ $skin = new Automatic_Upgrader_Skin();
switch ( $type ) {
case 'core':
diff --git a/src/wp-admin/includes/class-wp-site-health-auto-updates.php b/src/wp-admin/includes/class-wp-site-health-auto-updates.php
index e3c02d0620..541bbd1f23 100644
--- a/src/wp-admin/includes/class-wp-site-health-auto-updates.php
+++ b/src/wp-admin/includes/class-wp-site-health-auto-updates.php
@@ -280,7 +280,7 @@ class WP_Site_Health_Auto_Updates {
require_once ABSPATH . 'wp-admin/includes/file.php';
}
- $skin = new Automatic_Upgrader_Skin;
+ $skin = new Automatic_Upgrader_Skin();
$success = $skin->request_filesystem_credentials( false, ABSPATH );
if ( ! $success ) {
@@ -313,7 +313,7 @@ class WP_Site_Health_Auto_Updates {
require ABSPATH . WPINC . '/version.php'; // $wp_version; // x.y.z
- $skin = new Automatic_Upgrader_Skin;
+ $skin = new Automatic_Upgrader_Skin();
$success = $skin->request_filesystem_credentials( false, ABSPATH );
if ( ! $success ) {
diff --git a/src/wp-admin/includes/image-edit.php b/src/wp-admin/includes/image-edit.php
index e814fc47e7..746c0bafbd 100644
--- a/src/wp-admin/includes/image-edit.php
+++ b/src/wp-admin/includes/image-edit.php
@@ -739,7 +739,7 @@ function wp_restore_image( $post_id ) {
$backup_sizes = get_post_meta( $post_id, '_wp_attachment_backup_sizes', true );
$old_backup_sizes = $backup_sizes;
$restored = false;
- $msg = new stdClass;
+ $msg = new stdClass();
if ( ! is_array( $backup_sizes ) ) {
$msg->error = __( 'Cannot load image metadata.' );
@@ -827,7 +827,7 @@ function wp_restore_image( $post_id ) {
function wp_save_image( $post_id ) {
$_wp_additional_image_sizes = wp_get_additional_image_sizes();
- $return = new stdClass;
+ $return = new stdClass();
$success = false;
$delete = false;
$scaled = false;
diff --git a/src/wp-admin/includes/nav-menu.php b/src/wp-admin/includes/nav-menu.php
index 0e09d31148..8dd05ba533 100644
--- a/src/wp-admin/includes/nav-menu.php
+++ b/src/wp-admin/includes/nav-menu.php
@@ -32,7 +32,7 @@ function _wp_ajax_menu_quick_search( $request = array() ) {
}
if ( 'markup' === $response_format ) {
- $args['walker'] = new Walker_Nav_Menu_Checklist;
+ $args['walker'] = new Walker_Nav_Menu_Checklist();
}
if ( 'get-post-item' === $type ) {
@@ -429,14 +429,14 @@ function wp_nav_menu_item_post_type_meta_box( $data_object, $box ) {
}
// @todo Transient caching of these results with proper invalidation on updating of a post of this type.
- $get_posts = new WP_Query;
+ $get_posts = new WP_Query();
$posts = $get_posts->query( $args );
// Only suppress and insert when more than just suppression pages available.
if ( ! $get_posts->post_count ) {
if ( ! empty( $suppress_page_ids ) ) {
unset( $args['post__not_in'] );
- $get_posts = new WP_Query;
+ $get_posts = new WP_Query();
$posts = $get_posts->query( $args );
} else {
echo '
' . __( 'No items.' ) . '
';
@@ -1059,7 +1059,7 @@ function wp_get_nav_menu_to_edit( $menu_id = 0 ) {
$walker_class_name = apply_filters( 'wp_edit_nav_menu_walker', 'Walker_Nav_Menu_Edit', $menu_id );
if ( class_exists( $walker_class_name ) ) {
- $walker = new $walker_class_name;
+ $walker = new $walker_class_name();
} else {
return new WP_Error(
'menu_walker_not_exist',
diff --git a/src/wp-admin/includes/post.php b/src/wp-admin/includes/post.php
index 65b36c4836..b72134d421 100644
--- a/src/wp-admin/includes/post.php
+++ b/src/wp-admin/includes/post.php
@@ -716,7 +716,7 @@ function get_default_post_to_edit( $post_type = 'post', $create_in_db = false )
wp_schedule_event( time(), 'daily', 'wp_scheduled_auto_draft_delete' );
}
} else {
- $post = new stdClass;
+ $post = new stdClass();
$post->ID = 0;
$post->post_author = '';
$post->post_date = '';
diff --git a/src/wp-admin/includes/privacy-tools.php b/src/wp-admin/includes/privacy-tools.php
index f974ea8a5d..9682e94fcf 100644
--- a/src/wp-admin/includes/privacy-tools.php
+++ b/src/wp-admin/includes/privacy-tools.php
@@ -535,7 +535,7 @@ function wp_privacy_generate_personal_data_export_file( $request_id ) {
wp_delete_file( $archive_pathname );
}
- $zip = new ZipArchive;
+ $zip = new ZipArchive();
if ( true === $zip->open( $archive_pathname, ZipArchive::CREATE ) ) {
if ( ! $zip->addFile( $json_report_pathname, 'export.json' ) ) {
$error = __( 'Unable to archive the personal data export file (JSON format).' );
diff --git a/src/wp-admin/includes/schema.php b/src/wp-admin/includes/schema.php
index 57ffe69054..79fb80c205 100644
--- a/src/wp-admin/includes/schema.php
+++ b/src/wp-admin/includes/schema.php
@@ -1050,7 +1050,7 @@ function populate_network( $network_id = 1, $domain = '', $email = '', $site_nam
* created.
*/
if ( ! is_multisite() ) {
- $current_site = new stdClass;
+ $current_site = new stdClass();
$current_site->domain = $domain;
$current_site->path = $path;
$current_site->site_name = ucfirst( $domain );
diff --git a/src/wp-admin/includes/template.php b/src/wp-admin/includes/template.php
index deecc92c50..7de1a07431 100644
--- a/src/wp-admin/includes/template.php
+++ b/src/wp-admin/includes/template.php
@@ -104,7 +104,7 @@ function wp_terms_checklist( $post_id = 0, $args = array() ) {
$parsed_args = wp_parse_args( $params, $defaults );
if ( empty( $parsed_args['walker'] ) || ! ( $parsed_args['walker'] instanceof Walker ) ) {
- $walker = new Walker_Category_Checklist;
+ $walker = new Walker_Category_Checklist();
} else {
$walker = $parsed_args['walker'];
}
diff --git a/src/wp-admin/includes/translation-install.php b/src/wp-admin/includes/translation-install.php
index dc7cb89a05..01c61bbb7b 100644
--- a/src/wp-admin/includes/translation-install.php
+++ b/src/wp-admin/includes/translation-install.php
@@ -237,7 +237,7 @@ function wp_download_language_pack( $download ) {
$translation = (object) $translation;
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
- $skin = new Automatic_Upgrader_Skin;
+ $skin = new Automatic_Upgrader_Skin();
$upgrader = new Language_Pack_Upgrader( $skin );
$translation->type = 'core';
$result = $upgrader->upgrade( $translation, array( 'clear_update_cache' => false ) );
@@ -263,7 +263,7 @@ function wp_can_install_language_pack() {
}
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
- $skin = new Automatic_Upgrader_Skin;
+ $skin = new Automatic_Upgrader_Skin();
$upgrader = new Language_Pack_Upgrader( $skin );
$upgrader->init();
diff --git a/src/wp-admin/includes/update-core.php b/src/wp-admin/includes/update-core.php
index 20a7390149..c240fb0ee6 100644
--- a/src/wp-admin/includes/update-core.php
+++ b/src/wp-admin/includes/update-core.php
@@ -1395,7 +1395,7 @@ function update_core( $from, $to ) {
// If a error occurs partway through this final step, keep the error flowing through, but keep process going.
if ( is_wp_error( $_result ) ) {
if ( ! is_wp_error( $result ) ) {
- $result = new WP_Error;
+ $result = new WP_Error();
}
$result->add(
diff --git a/src/wp-admin/includes/update.php b/src/wp-admin/includes/update.php
index 8661af75b5..530406bc28 100644
--- a/src/wp-admin/includes/update.php
+++ b/src/wp-admin/includes/update.php
@@ -93,7 +93,7 @@ function find_core_auto_update() {
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
$auto_update = false;
- $upgrader = new WP_Automatic_Updater;
+ $upgrader = new WP_Automatic_Updater();
foreach ( $updates->updates as $update ) {
if ( 'autoupdate' !== $update->response ) {
continue;
@@ -235,7 +235,7 @@ function core_update_footer( $msg = '' ) {
$cur = get_preferred_from_update_core();
if ( ! is_object( $cur ) ) {
- $cur = new stdClass;
+ $cur = new stdClass();
}
if ( ! isset( $cur->current ) ) {
diff --git a/src/wp-admin/includes/upgrade.php b/src/wp-admin/includes/upgrade.php
index 94d9d335f3..63580cceb0 100644
--- a/src/wp-admin/includes/upgrade.php
+++ b/src/wp-admin/includes/upgrade.php
@@ -2617,7 +2617,7 @@ function maybe_convert_table_to_utf8mb4( $table ) {
*/
function get_alloptions_110() {
global $wpdb;
- $all_options = new stdClass;
+ $all_options = new stdClass();
$options = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options" );
if ( $options ) {
foreach ( $options as $option ) {
diff --git a/src/wp-admin/includes/user.php b/src/wp-admin/includes/user.php
index 134da30514..1df2739d48 100644
--- a/src/wp-admin/includes/user.php
+++ b/src/wp-admin/includes/user.php
@@ -29,7 +29,7 @@ function add_user() {
*/
function edit_user( $user_id = 0 ) {
$wp_roles = wp_roles();
- $user = new stdClass;
+ $user = new stdClass();
$user_id = (int) $user_id;
if ( $user_id ) {
$update = true;
diff --git a/src/wp-admin/user-edit.php b/src/wp-admin/user-edit.php
index 681c7354f8..edcdfb1ac5 100644
--- a/src/wp-admin/user-edit.php
+++ b/src/wp-admin/user-edit.php
@@ -104,7 +104,7 @@ if ( is_multisite()
if ( IS_PROFILE_PAGE && isset( $_GET['newuseremail'] ) && $current_user->ID ) {
$new_email = get_user_meta( $current_user->ID, '_new_email', true );
if ( $new_email && hash_equals( $new_email['hash'], $_GET['newuseremail'] ) ) {
- $user = new stdClass;
+ $user = new stdClass();
$user->ID = $current_user->ID;
$user->user_email = esc_html( trim( $new_email['newemail'] ) );
if ( is_multisite() && $wpdb->get_var( $wpdb->prepare( "SELECT user_login FROM {$wpdb->signups} WHERE user_login = %s", $current_user->user_login ) ) ) {
diff --git a/src/wp-includes/admin-bar.php b/src/wp-includes/admin-bar.php
index 19322a3451..784153ebf0 100644
--- a/src/wp-includes/admin-bar.php
+++ b/src/wp-includes/admin-bar.php
@@ -41,7 +41,7 @@ function _wp_admin_bar_init() {
*/
$admin_bar_class = apply_filters( 'wp_admin_bar_class', 'WP_Admin_Bar' );
if ( class_exists( $admin_bar_class ) ) {
- $wp_admin_bar = new $admin_bar_class;
+ $wp_admin_bar = new $admin_bar_class();
} else {
return false;
}
diff --git a/src/wp-includes/capabilities.php b/src/wp-includes/capabilities.php
index d06887a2bb..2b16174666 100644
--- a/src/wp-includes/capabilities.php
+++ b/src/wp-includes/capabilities.php
@@ -975,7 +975,7 @@ function user_can( $user, $capability, ...$args ) {
if ( empty( $user ) ) {
// User is logged out, create anonymous user object.
$user = new WP_User( 0 );
- $user->init( new stdClass );
+ $user->init( new stdClass() );
}
return $user->has_cap( $capability, ...$args );
diff --git a/src/wp-includes/category-template.php b/src/wp-includes/category-template.php
index dc0dfe7ef0..b35c17170d 100644
--- a/src/wp-includes/category-template.php
+++ b/src/wp-includes/category-template.php
@@ -1110,7 +1110,7 @@ function _wp_object_count_sort_cb( $a, $b ) {
function walk_category_tree( ...$args ) {
// The user's options are the third parameter.
if ( empty( $args[2]['walker'] ) || ! ( $args[2]['walker'] instanceof Walker ) ) {
- $walker = new Walker_Category;
+ $walker = new Walker_Category();
} else {
/**
* @var Walker $walker
@@ -1136,7 +1136,7 @@ function walk_category_tree( ...$args ) {
function walk_category_dropdown_tree( ...$args ) {
// The user's options are the third parameter.
if ( empty( $args[2]['walker'] ) || ! ( $args[2]['walker'] instanceof Walker ) ) {
- $walker = new Walker_CategoryDropdown;
+ $walker = new Walker_CategoryDropdown();
} else {
/**
* @var Walker $walker
diff --git a/src/wp-includes/class-wp-admin-bar.php b/src/wp-includes/class-wp-admin-bar.php
index 406d76459b..dc6ea0993c 100644
--- a/src/wp-includes/class-wp-admin-bar.php
+++ b/src/wp-includes/class-wp-admin-bar.php
@@ -41,7 +41,7 @@ class WP_Admin_Bar {
* @since 3.1.0
*/
public function initialize() {
- $this->user = new stdClass;
+ $this->user = new stdClass();
if ( is_user_logged_in() ) {
/* Populate settings we need for the menu based on the current user. */
diff --git a/src/wp-includes/class-wp-editor.php b/src/wp-includes/class-wp-editor.php
index 41f379a838..16805f7a16 100644
--- a/src/wp-includes/class-wp-editor.php
+++ b/src/wp-includes/class-wp-editor.php
@@ -1799,7 +1799,7 @@ final class _WP_Editors {
$query = apply_filters( 'wp_link_query_args', $query );
// Do main query.
- $get_posts = new WP_Query;
+ $get_posts = new WP_Query();
$posts = $get_posts->query( $query );
// Build results.
diff --git a/src/wp-includes/class-wp-http.php b/src/wp-includes/class-wp-http.php
index 3d4e8798aa..3d90085e49 100644
--- a/src/wp-includes/class-wp-http.php
+++ b/src/wp-includes/class-wp-http.php
@@ -581,7 +581,7 @@ class WP_Http {
// Transport claims to support request, instantiate it and give it a whirl.
if ( empty( $transports[ $class ] ) ) {
- $transports[ $class ] = new $class;
+ $transports[ $class ] = new $class();
}
$response = $transports[ $class ]->request( $url, $args );
diff --git a/src/wp-includes/class-wp-oembed.php b/src/wp-includes/class-wp-oembed.php
index 8b24cf752b..e177223435 100644
--- a/src/wp-includes/class-wp-oembed.php
+++ b/src/wp-includes/class-wp-oembed.php
@@ -639,7 +639,7 @@ class WP_oEmbed {
return false;
}
- $dom = new DOMDocument;
+ $dom = new DOMDocument();
$success = $dom->loadXML( $response_body );
if ( ! $success ) {
return false;
@@ -660,7 +660,7 @@ class WP_oEmbed {
return false;
}
- $return = new stdClass;
+ $return = new stdClass();
foreach ( $xml as $key => $value ) {
$return->$key = (string) $value;
}
diff --git a/src/wp-includes/class-wp-text-diff-renderer-table.php b/src/wp-includes/class-wp-text-diff-renderer-table.php
index a74b8019f4..dbbf867c74 100644
--- a/src/wp-includes/class-wp-text-diff-renderer-table.php
+++ b/src/wp-includes/class-wp-text-diff-renderer-table.php
@@ -269,7 +269,7 @@ class WP_Text_Diff_Renderer_Table extends Text_Diff_Renderer {
foreach ( $orig_matches as $o => $f ) {
if ( is_numeric( $o ) && is_numeric( $f ) ) {
$text_diff = new Text_Diff( 'auto', array( array( $orig[ $o ] ), array( $final[ $f ] ) ) );
- $renderer = new $this->inline_diff_renderer;
+ $renderer = new $this->inline_diff_renderer();
$diff = $renderer->render( $text_diff );
// If they're too different, don't include any or 's.
diff --git a/src/wp-includes/class-wp-user.php b/src/wp-includes/class-wp-user.php
index b190960009..ecfa1a5920 100644
--- a/src/wp-includes/class-wp-user.php
+++ b/src/wp-includes/class-wp-user.php
@@ -156,7 +156,7 @@ class WP_User {
if ( $data ) {
$this->init( $data, $site_id );
} else {
- $this->data = new stdClass;
+ $this->data = new stdClass();
}
}
diff --git a/src/wp-includes/comment-template.php b/src/wp-includes/comment-template.php
index 63614663de..44eddaec86 100644
--- a/src/wp-includes/comment-template.php
+++ b/src/wp-includes/comment-template.php
@@ -2238,7 +2238,7 @@ function wp_list_comments( $args = array(), $comments = null ) {
wp_queue_comments_for_comment_meta_lazyload( $_comments );
if ( empty( $parsed_args['walker'] ) ) {
- $walker = new Walker_Comment;
+ $walker = new Walker_Comment();
} else {
$walker = $parsed_args['walker'];
}
diff --git a/src/wp-includes/comment.php b/src/wp-includes/comment.php
index bf646a2a27..a52edf84f4 100644
--- a/src/wp-includes/comment.php
+++ b/src/wp-includes/comment.php
@@ -171,7 +171,7 @@ function get_approved_comments( $post_id, $args = array() ) {
);
$parsed_args = wp_parse_args( $args, $defaults );
- $query = new WP_Comment_Query;
+ $query = new WP_Comment_Query();
return $query->query( $parsed_args );
}
@@ -240,7 +240,7 @@ function get_comment( $comment = null, $output = OBJECT ) {
* @return WP_Comment[]|int[]|int List of comments or number of found comments if `$count` argument is true.
*/
function get_comments( $args = '' ) {
- $query = new WP_Comment_Query;
+ $query = new WP_Comment_Query();
return $query->query( $args );
}
@@ -1023,7 +1023,7 @@ function get_comment_pages_count( $comments = null, $per_page = null, $threaded
}
if ( $threaded ) {
- $walker = new Walker_Comment;
+ $walker = new Walker_Comment();
$count = ceil( $walker->get_number_of_root_elements( $comments ) / $per_page );
} else {
$count = ceil( count( $comments ) / $per_page );
diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php
index 8cb36f5e39..b2baae9a51 100644
--- a/src/wp-includes/functions.php
+++ b/src/wp-includes/functions.php
@@ -4302,7 +4302,7 @@ function _wp_json_sanity_check( $data, $depth ) {
}
}
} elseif ( is_object( $data ) ) {
- $output = new stdClass;
+ $output = new stdClass();
foreach ( $data as $id => $el ) {
if ( is_string( $id ) ) {
$clean_id = _wp_json_convert_string( $id );
diff --git a/src/wp-includes/l10n.php b/src/wp-includes/l10n.php
index 40c653fdbe..d7642c7038 100644
--- a/src/wp-includes/l10n.php
+++ b/src/wp-includes/l10n.php
@@ -1306,7 +1306,7 @@ function get_translations_for_domain( $domain ) {
static $noop_translations = null;
if ( null === $noop_translations ) {
- $noop_translations = new NOOP_Translations;
+ $noop_translations = new NOOP_Translations();
}
return $noop_translations;
diff --git a/src/wp-includes/ms-load.php b/src/wp-includes/ms-load.php
index 35942df0f8..c7f74167f4 100644
--- a/src/wp-includes/ms-load.php
+++ b/src/wp-includes/ms-load.php
@@ -297,7 +297,7 @@ function ms_load_current_site_and_network( $domain, $path, $subdomain = false )
// If the network is defined in wp-config.php, we can simply use that.
if ( defined( 'DOMAIN_CURRENT_SITE' ) && defined( 'PATH_CURRENT_SITE' ) ) {
- $current_site = new stdClass;
+ $current_site = new stdClass();
$current_site->id = defined( 'SITE_ID_CURRENT_SITE' ) ? SITE_ID_CURRENT_SITE : 1;
$current_site->domain = DOMAIN_CURRENT_SITE;
$current_site->path = PATH_CURRENT_SITE;
@@ -387,7 +387,7 @@ function ms_load_current_site_and_network( $domain, $path, $subdomain = false )
// During activation of a new subdomain, the requested site does not yet exist.
if ( empty( $current_blog ) && wp_installing() ) {
- $current_blog = new stdClass;
+ $current_blog = new stdClass();
$current_blog->blog_id = 1;
$blog_id = 1;
$current_blog->public = 1;
diff --git a/src/wp-includes/nav-menu-template.php b/src/wp-includes/nav-menu-template.php
index 0673bf36ed..893727c44c 100644
--- a/src/wp-includes/nav-menu-template.php
+++ b/src/wp-includes/nav-menu-template.php
@@ -617,7 +617,7 @@ function _wp_menu_item_classes_by_context( &$menu_items ) {
* @return string The HTML list content for the menu items.
*/
function walk_nav_menu_tree( $items, $depth, $args ) {
- $walker = ( empty( $args->walker ) ) ? new Walker_Nav_Menu : $args->walker;
+ $walker = ( empty( $args->walker ) ) ? new Walker_Nav_Menu() : $args->walker;
return $walker->walk( $items, $depth, $args );
}
diff --git a/src/wp-includes/nav-menu.php b/src/wp-includes/nav-menu.php
index 3ef281f643..87b51182e3 100644
--- a/src/wp-includes/nav-menu.php
+++ b/src/wp-includes/nav-menu.php
@@ -1010,7 +1010,7 @@ function wp_get_associated_nav_menu_items( $object_id = 0, $object_type = 'post_
$object_id = (int) $object_id;
$menu_item_ids = array();
- $query = new WP_Query;
+ $query = new WP_Query();
$menu_items = $query->query(
array(
'meta_key' => '_menu_item_object_id',
diff --git a/src/wp-includes/pluggable.php b/src/wp-includes/pluggable.php
index 2852e23a93..27e5d91b20 100644
--- a/src/wp-includes/pluggable.php
+++ b/src/wp-includes/pluggable.php
@@ -105,7 +105,7 @@ if ( ! function_exists( 'get_user_by' ) ) :
return false;
}
- $user = new WP_User;
+ $user = new WP_User();
$user->init( $userdata );
return $user;
diff --git a/src/wp-includes/post-template.php b/src/wp-includes/post-template.php
index 03178a3dd5..3ce819c2b0 100644
--- a/src/wp-includes/post-template.php
+++ b/src/wp-includes/post-template.php
@@ -1546,7 +1546,7 @@ function wp_page_menu( $args = array() ) {
*/
function walk_page_tree( $pages, $depth, $current_page, $args ) {
if ( empty( $args['walker'] ) ) {
- $walker = new Walker_Page;
+ $walker = new Walker_Page();
} else {
/**
* @var Walker $walker
@@ -1578,7 +1578,7 @@ function walk_page_tree( $pages, $depth, $current_page, $args ) {
*/
function walk_page_dropdown_tree( ...$args ) {
if ( empty( $args[2]['walker'] ) ) { // The user's options are the third parameter.
- $walker = new Walker_PageDropdown;
+ $walker = new Walker_PageDropdown();
} else {
/**
* @var Walker $walker
diff --git a/src/wp-includes/post.php b/src/wp-includes/post.php
index 185d2d5a08..1163d023cd 100644
--- a/src/wp-includes/post.php
+++ b/src/wp-includes/post.php
@@ -2410,7 +2410,7 @@ function get_posts( $args = null ) {
$parsed_args['ignore_sticky_posts'] = true;
$parsed_args['no_found_rows'] = true;
- $get_posts = new WP_Query;
+ $get_posts = new WP_Query();
return $get_posts->query( $parsed_args );
}
@@ -3013,7 +3013,7 @@ function wp_count_posts( $type = 'post', $perm = '' ) {
global $wpdb;
if ( ! post_type_exists( $type ) ) {
- return new stdClass;
+ return new stdClass();
}
$cache_key = _count_posts_cache_key( $type, $perm );
diff --git a/src/wp-includes/rest-api.php b/src/wp-includes/rest-api.php
index b611745ebd..3953b74392 100644
--- a/src/wp-includes/rest-api.php
+++ b/src/wp-includes/rest-api.php
@@ -255,15 +255,15 @@ function create_initial_rest_routes() {
}
// Post types.
- $controller = new WP_REST_Post_Types_Controller;
+ $controller = new WP_REST_Post_Types_Controller();
$controller->register_routes();
// Post statuses.
- $controller = new WP_REST_Post_Statuses_Controller;
+ $controller = new WP_REST_Post_Statuses_Controller();
$controller->register_routes();
// Taxonomies.
- $controller = new WP_REST_Taxonomies_Controller;
+ $controller = new WP_REST_Taxonomies_Controller();
$controller->register_routes();
// Terms.
@@ -278,7 +278,7 @@ function create_initial_rest_routes() {
}
// Users.
- $controller = new WP_REST_Users_Controller;
+ $controller = new WP_REST_Users_Controller();
$controller->register_routes();
// Application Passwords
@@ -286,7 +286,7 @@ function create_initial_rest_routes() {
$controller->register_routes();
// Comments.
- $controller = new WP_REST_Comments_Controller;
+ $controller = new WP_REST_Comments_Controller();
$controller->register_routes();
$search_handlers = array(
@@ -318,15 +318,15 @@ function create_initial_rest_routes() {
$controller->register_routes();
// Global Styles.
- $controller = new WP_REST_Global_Styles_Controller;
+ $controller = new WP_REST_Global_Styles_Controller();
$controller->register_routes();
// Settings.
- $controller = new WP_REST_Settings_Controller;
+ $controller = new WP_REST_Settings_Controller();
$controller->register_routes();
// Themes.
- $controller = new WP_REST_Themes_Controller;
+ $controller = new WP_REST_Themes_Controller();
$controller->register_routes();
// Plugins.
@@ -562,7 +562,7 @@ function rest_get_server() {
* @param string $class_name The name of the server class. Default 'WP_REST_Server'.
*/
$wp_rest_server_class = apply_filters( 'wp_rest_server_class', 'WP_REST_Server' );
- $wp_rest_server = new $wp_rest_server_class;
+ $wp_rest_server = new $wp_rest_server_class();
/**
* Fires when preparing to serve a REST API request.
diff --git a/src/wp-includes/rest-api/class-wp-rest-response.php b/src/wp-includes/rest-api/class-wp-rest-response.php
index cb890f5b0b..c6ea11be83 100644
--- a/src/wp-includes/rest-api/class-wp-rest-response.php
+++ b/src/wp-includes/rest-api/class-wp-rest-response.php
@@ -227,7 +227,7 @@ class WP_REST_Response extends WP_HTTP_Response {
return null;
}
- $error = new WP_Error;
+ $error = new WP_Error();
if ( is_array( $this->get_data() ) ) {
$data = $this->get_data();
diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php
index ff3c1dc42f..98c0a1bb64 100644
--- a/src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php
+++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php
@@ -766,7 +766,7 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller {
// Ensure empty details is an empty object.
if ( empty( $data['media_details'] ) ) {
- $data['media_details'] = new stdClass;
+ $data['media_details'] = new stdClass();
} elseif ( ! empty( $data['media_details']['sizes'] ) ) {
foreach ( $data['media_details']['sizes'] as $size => &$size_data ) {
@@ -797,7 +797,7 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller {
);
}
} else {
- $data['media_details']['sizes'] = new stdClass;
+ $data['media_details']['sizes'] = new stdClass();
}
}
diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php
index 42919b7dc2..6fecfd3961 100644
--- a/src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php
+++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php
@@ -274,7 +274,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
*/
$prepared_args = apply_filters( 'rest_comment_query', $prepared_args, $request );
- $query = new WP_Comment_Query;
+ $query = new WP_Comment_Query();
$query_result = $query->query( $prepared_args );
$comments = array();
@@ -295,7 +295,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
// Out-of-bounds, run the query again without LIMIT for total count.
unset( $prepared_args['number'], $prepared_args['offset'] );
- $query = new WP_Comment_Query;
+ $query = new WP_Comment_Query();
$prepared_args['count'] = true;
$total_comments = $query->query( $prepared_args );
diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php
index 4ef48fa366..4fda654746 100644
--- a/src/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php
+++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php
@@ -807,7 +807,7 @@ class WP_REST_Terms_Controller extends WP_REST_Controller {
* @return object Term object.
*/
public function prepare_item_for_database( $request ) {
- $prepared_term = new stdClass;
+ $prepared_term = new stdClass();
$schema = $this->get_item_schema();
if ( isset( $request['name'] ) && ! empty( $schema['properties']['name'] ) ) {
diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php
index 52e8fcf0cd..62b9bc7e5d 100644
--- a/src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php
+++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php
@@ -1121,7 +1121,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
* @return object User object.
*/
protected function prepare_item_for_database( $request ) {
- $prepared_user = new stdClass;
+ $prepared_user = new stdClass();
$schema = $this->get_item_schema();
diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-widget-types-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-widget-types-controller.php
index d721c32d64..1868050573 100644
--- a/src/wp-includes/rest-api/endpoints/class-wp-rest-widget-types-controller.php
+++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-widget-types-controller.php
@@ -529,7 +529,7 @@ class WP_REST_Widget_Types_Controller extends WP_REST_Controller {
if ( ! empty( $widget_object->widget_options['show_instance_in_rest'] ) ) {
// Use new stdClass so that JSON result is {} and not [].
- $response['instance']['raw'] = empty( $instance ) ? new stdClass : $instance;
+ $response['instance']['raw'] = empty( $instance ) ? new stdClass() : $instance;
}
return rest_ensure_response( $response );
diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php
index e6ac11cf88..596e78aecf 100644
--- a/src/wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php
+++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php
@@ -715,7 +715,7 @@ class WP_REST_Widgets_Controller extends WP_REST_Controller {
if ( ! empty( $widget_object->widget_options['show_instance_in_rest'] ) ) {
// Use new stdClass so that JSON result is {} and not [].
- $prepared['instance']['raw'] = empty( $instance ) ? new stdClass : $instance;
+ $prepared['instance']['raw'] = empty( $instance ) ? new stdClass() : $instance;
}
}
}
diff --git a/src/wp-includes/theme.php b/src/wp-includes/theme.php
index 61d5c13284..47fe9cb162 100644
--- a/src/wp-includes/theme.php
+++ b/src/wp-includes/theme.php
@@ -1331,7 +1331,7 @@ function _get_random_header_data() {
}
if ( empty( $headers ) ) {
- return new stdClass;
+ return new stdClass();
}
$_wp_random_header = (object) $headers[ array_rand( $headers ) ];
diff --git a/src/wp-includes/update.php b/src/wp-includes/update.php
index f352cab7c2..5136912037 100644
--- a/src/wp-includes/update.php
+++ b/src/wp-includes/update.php
@@ -44,7 +44,7 @@ function wp_version_check( $extra_stats = array(), $force_check = false ) {
}
if ( ! is_object( $current ) ) {
- $current = new stdClass;
+ $current = new stdClass();
$current->updates = array();
$current->version_checked = $wp_version;
}
@@ -327,10 +327,10 @@ function wp_update_plugins( $extra_stats = array() ) {
$current = get_site_transient( 'update_plugins' );
if ( ! is_object( $current ) ) {
- $current = new stdClass;
+ $current = new stdClass();
}
- $updates = new stdClass;
+ $updates = new stdClass();
$updates->last_checked = time();
$updates->response = array();
$updates->translations = array();
@@ -595,7 +595,7 @@ function wp_update_themes( $extra_stats = array() ) {
$last_update = get_site_transient( 'update_themes' );
if ( ! is_object( $last_update ) ) {
- $last_update = new stdClass;
+ $last_update = new stdClass();
}
$themes = array();
@@ -734,7 +734,7 @@ function wp_update_themes( $extra_stats = array() ) {
return;
}
- $new_update = new stdClass;
+ $new_update = new stdClass();
$new_update->last_checked = time();
$new_update->checked = $checked;
@@ -846,7 +846,7 @@ function wp_maybe_auto_update() {
include_once ABSPATH . 'wp-admin/includes/admin.php';
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
- $upgrader = new WP_Automatic_Updater;
+ $upgrader = new WP_Automatic_Updater();
$upgrader->run();
}
diff --git a/src/wp-includes/user.php b/src/wp-includes/user.php
index 9c17d1583e..cc128c26e4 100644
--- a/src/wp-includes/user.php
+++ b/src/wp-includes/user.php
@@ -951,7 +951,7 @@ function get_blogs_of_user( $user_id, $all = false ) {
if ( ! is_multisite() ) {
$site_id = get_current_blog_id();
- $sites = array( $site_id => new stdClass );
+ $sites = array( $site_id => new stdClass() );
$sites[ $site_id ]->userblog_id = $site_id;
$sites[ $site_id ]->blogname = get_option( 'blogname' );
$sites[ $site_id ]->domain = '';
diff --git a/src/xmlrpc.php b/src/xmlrpc.php
index ecac4c7c7a..3f35815525 100644
--- a/src/xmlrpc.php
+++ b/src/xmlrpc.php
@@ -81,7 +81,7 @@ $post_default_title = '';
* @param string $class The name of the XML-RPC server class.
*/
$wp_xmlrpc_server_class = apply_filters( 'wp_xmlrpc_server_class', 'wp_xmlrpc_server' );
-$wp_xmlrpc_server = new $wp_xmlrpc_server_class;
+$wp_xmlrpc_server = new $wp_xmlrpc_server_class();
// Fire off the request.
$wp_xmlrpc_server->serve_request();
diff --git a/tests/phpunit/includes/testcase-rest-controller.php b/tests/phpunit/includes/testcase-rest-controller.php
index 67a7970b66..9a4c2a0b61 100644
--- a/tests/phpunit/includes/testcase-rest-controller.php
+++ b/tests/phpunit/includes/testcase-rest-controller.php
@@ -9,7 +9,7 @@ abstract class WP_Test_REST_Controller_Testcase extends WP_Test_REST_TestCase {
add_filter( 'rest_url', array( $this, 'filter_rest_url_for_leading_slash' ), 10, 2 );
/** @var WP_REST_Server $wp_rest_server */
global $wp_rest_server;
- $wp_rest_server = new Spy_REST_Server;
+ $wp_rest_server = new Spy_REST_Server();
do_action( 'rest_api_init', $wp_rest_server );
}
diff --git a/tests/phpunit/tests/adminbar.php b/tests/phpunit/tests/adminbar.php
index 228063e911..cec80d0cae 100644
--- a/tests/phpunit/tests/adminbar.php
+++ b/tests/phpunit/tests/adminbar.php
@@ -37,7 +37,7 @@ class Tests_AdminBar extends WP_UnitTestCase {
register_post_type( 'content', array( 'show_in_admin_bar' => true ) );
- $admin_bar = new WP_Admin_Bar;
+ $admin_bar = new WP_Admin_Bar();
wp_admin_bar_new_content_menu( $admin_bar );
@@ -54,7 +54,7 @@ class Tests_AdminBar extends WP_UnitTestCase {
public function test_merging_existing_meta_values() {
wp_set_current_user( self::$editor_id );
- $admin_bar = new WP_Admin_Bar;
+ $admin_bar = new WP_Admin_Bar();
$admin_bar->add_node(
array(
diff --git a/tests/phpunit/tests/blocks/editor.php b/tests/phpunit/tests/blocks/editor.php
index 076b3026fa..e3a4fdccfc 100644
--- a/tests/phpunit/tests/blocks/editor.php
+++ b/tests/phpunit/tests/blocks/editor.php
@@ -31,7 +31,7 @@ class Tests_Blocks_Editor extends WP_UnitTestCase {
$post = self::factory()->post->create_and_get( $args );
global $wp_rest_server;
- $wp_rest_server = new Spy_REST_Server;
+ $wp_rest_server = new Spy_REST_Server();
do_action( 'rest_api_init', $wp_rest_server );
}
diff --git a/tests/phpunit/tests/cache.php b/tests/phpunit/tests/cache.php
index f65096c597..faf64de5a0 100644
--- a/tests/phpunit/tests/cache.php
+++ b/tests/phpunit/tests/cache.php
@@ -230,7 +230,7 @@ class Tests_Cache extends WP_UnitTestCase {
// Make sure objects are cloned going to and from the cache.
public function test_object_refs() {
$key = __FUNCTION__ . '_1';
- $object_a = new stdClass;
+ $object_a = new stdClass();
$object_a->foo = 'alpha';
$this->cache->set( $key, $object_a );
$object_a->foo = 'bravo';
@@ -240,7 +240,7 @@ class Tests_Cache extends WP_UnitTestCase {
$this->assertSame( 'bravo', $object_a->foo );
$key = __FUNCTION__ . '_2';
- $object_a = new stdClass;
+ $object_a = new stdClass();
$object_a->foo = 'alpha';
$this->cache->add( $key, $object_a );
$object_a->foo = 'bravo';
diff --git a/tests/phpunit/tests/dependencies.php b/tests/phpunit/tests/dependencies.php
index 0087a0c143..cdd8e8b529 100644
--- a/tests/phpunit/tests/dependencies.php
+++ b/tests/phpunit/tests/dependencies.php
@@ -5,7 +5,7 @@
*/
class Tests_Dependencies extends WP_UnitTestCase {
public function test_add() {
- $dep = new WP_Dependencies;
+ $dep = new WP_Dependencies();
$this->assertTrue( $dep->add( 'one', '' ) );
$this->assertTrue( $dep->add( 'two', '' ) );
@@ -18,7 +18,7 @@ class Tests_Dependencies extends WP_UnitTestCase {
}
public function test_remove() {
- $dep = new WP_Dependencies;
+ $dep = new WP_Dependencies();
$this->assertTrue( $dep->add( 'one', '' ) );
$this->assertTrue( $dep->add( 'two', '' ) );
@@ -31,7 +31,7 @@ class Tests_Dependencies extends WP_UnitTestCase {
}
public function test_enqueue() {
- $dep = new WP_Dependencies;
+ $dep = new WP_Dependencies();
$this->assertTrue( $dep->add( 'one', '' ) );
$this->assertTrue( $dep->add( 'two', '' ) );
@@ -47,7 +47,7 @@ class Tests_Dependencies extends WP_UnitTestCase {
}
public function test_dequeue() {
- $dep = new WP_Dependencies;
+ $dep = new WP_Dependencies();
$this->assertTrue( $dep->add( 'one', '' ) );
$this->assertTrue( $dep->add( 'two', '' ) );
@@ -67,7 +67,7 @@ class Tests_Dependencies extends WP_UnitTestCase {
}
public function test_enqueue_args() {
- $dep = new WP_Dependencies;
+ $dep = new WP_Dependencies();
$this->assertTrue( $dep->add( 'one', '' ) );
$this->assertTrue( $dep->add( 'two', '' ) );
@@ -85,7 +85,7 @@ class Tests_Dependencies extends WP_UnitTestCase {
}
public function test_dequeue_args() {
- $dep = new WP_Dependencies;
+ $dep = new WP_Dependencies();
$this->assertTrue( $dep->add( 'one', '' ) );
$this->assertTrue( $dep->add( 'two', '' ) );
@@ -112,7 +112,7 @@ class Tests_Dependencies extends WP_UnitTestCase {
* @ticket 21741
*/
public function test_query_and_registered_enqueued() {
- $dep = new WP_Dependencies;
+ $dep = new WP_Dependencies();
$this->assertTrue( $dep->add( 'one', '' ) );
$this->assertInstanceOf( '_WP_Dependency', $dep->query( 'one' ) );
@@ -138,7 +138,7 @@ class Tests_Dependencies extends WP_UnitTestCase {
}
function test_enqueue_before_register() {
- $dep = new WP_Dependencies;
+ $dep = new WP_Dependencies();
$this->assertArrayNotHasKey( 'one', $dep->registered );
diff --git a/tests/phpunit/tests/dependencies/jquery.php b/tests/phpunit/tests/dependencies/jquery.php
index 62243fe581..aa44b0047a 100644
--- a/tests/phpunit/tests/dependencies/jquery.php
+++ b/tests/phpunit/tests/dependencies/jquery.php
@@ -10,7 +10,7 @@ class Tests_Dependencies_jQuery extends WP_UnitTestCase {
* @covers WP_Scripts::query
*/
public function test_location_of_jquery() {
- $scripts = new WP_Scripts;
+ $scripts = new WP_Scripts();
wp_default_scripts( $scripts );
if ( SCRIPT_DEBUG ) {
@@ -106,7 +106,7 @@ class Tests_Dependencies_jQuery extends WP_UnitTestCase {
* @covers WP_Scripts::do_items
*/
public function test_jquery_in_footer() {
- $scripts = new WP_Scripts;
+ $scripts = new WP_Scripts();
$scripts->add( 'jquery', false, array( 'jquery-core', 'jquery-migrate' ) );
$scripts->add( 'jquery-core', '/jquery.js', array() );
$scripts->add( 'jquery-migrate', '/jquery-migrate.js', array() );
diff --git a/tests/phpunit/tests/dependencies/scripts.php b/tests/phpunit/tests/dependencies/scripts.php
index b64edfeff9..3897c6aa25 100644
--- a/tests/phpunit/tests/dependencies/scripts.php
+++ b/tests/phpunit/tests/dependencies/scripts.php
@@ -276,7 +276,7 @@ JS;
* @covers WP_Dependencies::do_items
*/
public function test_group_mismatch_in_deps() {
- $scripts = new WP_Scripts;
+ $scripts = new WP_Scripts();
$scripts->add( 'one', 'one', array(), 'v1', 1 );
$scripts->add( 'two', 'two', array( 'one' ) );
$scripts->add( 'three', 'three', array( 'two' ), 'v1', 1 );
@@ -295,7 +295,7 @@ JS;
$this->assertContains( 'two', $scripts->done );
$this->assertContains( 'three', $scripts->done );
- $scripts = new WP_Scripts;
+ $scripts = new WP_Scripts();
$scripts->add( 'one', 'one', array(), 'v1', 1 );
$scripts->add( 'two', 'two', array( 'one' ), 'v1', 1 );
$scripts->add( 'three', 'three', array( 'one' ) );
diff --git a/tests/phpunit/tests/formatting/sanitizeTextField.php b/tests/phpunit/tests/formatting/sanitizeTextField.php
index 15e903ac95..240f38850b 100644
--- a/tests/phpunit/tests/formatting/sanitizeTextField.php
+++ b/tests/phpunit/tests/formatting/sanitizeTextField.php
@@ -105,7 +105,7 @@ class Tests_Formatting_SanitizeTextField extends WP_UnitTestCase {
'',
),
array(
- new WP_Query,
+ new WP_Query(),
'',
),
array(
diff --git a/tests/phpunit/tests/formatting/stripslashesDeep.php b/tests/phpunit/tests/formatting/stripslashesDeep.php
index 76f9e8b019..ea2c913954 100644
--- a/tests/phpunit/tests/formatting/stripslashesDeep.php
+++ b/tests/phpunit/tests/formatting/stripslashesDeep.php
@@ -26,7 +26,7 @@ class Tests_Formatting_StripslashesDeep extends WP_UnitTestCase {
$this->assertSame( $arr, stripslashes_deep( $arr ) ); // Keyed array.
$this->assertSame( array_values( $arr ), stripslashes_deep( array_values( $arr ) ) ); // Non-keyed.
- $obj = new stdClass;
+ $obj = new stdClass();
foreach ( $arr as $k => $v ) {
$obj->$k = $v;
}
@@ -41,9 +41,9 @@ class Tests_Formatting_StripslashesDeep extends WP_UnitTestCase {
$this->assertSame( array( 'a' => $new ), stripslashes_deep( array( 'a' => $old ) ) ); // Keyed array.
$this->assertSame( array( $new ), stripslashes_deep( array( $old ) ) ); // Non-keyed.
- $obj_old = new stdClass;
+ $obj_old = new stdClass();
$obj_old->a = $old;
- $obj_new = new stdClass;
+ $obj_new = new stdClass();
$obj_new->a = $new;
$this->assertEquals( $obj_new, stripslashes_deep( $obj_old ) );
}
diff --git a/tests/phpunit/tests/formatting/wpSlash.php b/tests/phpunit/tests/formatting/wpSlash.php
index 39a7c32a01..a1ac591c7a 100644
--- a/tests/phpunit/tests/formatting/wpSlash.php
+++ b/tests/phpunit/tests/formatting/wpSlash.php
@@ -84,7 +84,7 @@ class Tests_Formatting_wpSlash extends WP_UnitTestCase {
$this->assertSame( $arr, wp_slash( $arr ) ); // Keyed array.
$this->assertSame( array_values( $arr ), wp_slash( array_values( $arr ) ) ); // Non-keyed.
- $obj = new stdClass;
+ $obj = new stdClass();
foreach ( $arr as $k => $v ) {
$obj->$k = $v;
}
diff --git a/tests/phpunit/tests/functions.php b/tests/phpunit/tests/functions.php
index 1fdba6ca84..71cd6b67d1 100644
--- a/tests/phpunit/tests/functions.php
+++ b/tests/phpunit/tests/functions.php
@@ -5,7 +5,7 @@
*/
class Tests_Functions extends WP_UnitTestCase {
public function test_wp_parse_args_object() {
- $x = new MockClass;
+ $x = new MockClass();
$x->_baba = 5;
$x->yZ = 'baba'; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
$x->a = array( 5, 111, 'x' );
@@ -17,7 +17,7 @@ class Tests_Functions extends WP_UnitTestCase {
),
wp_parse_args( $x )
);
- $y = new MockClass;
+ $y = new MockClass();
$this->assertSame( array(), wp_parse_args( $y ) );
}
@@ -41,7 +41,7 @@ class Tests_Functions extends WP_UnitTestCase {
}
public function test_wp_parse_args_defaults() {
- $x = new MockClass;
+ $x = new MockClass();
$x->_baba = 5;
$x->yZ = 'baba'; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
$x->a = array( 5, 111, 'x' );
@@ -1113,7 +1113,7 @@ class Tests_Functions extends WP_UnitTestCase {
* @ticket 28786
*/
public function test_wp_json_encode_object() {
- $object = new stdClass;
+ $object = new stdClass();
$object->a = 'b';
$this->assertSame( wp_json_encode( $object ), '{"a":"b"}' );
}
diff --git a/tests/phpunit/tests/import/parser.php b/tests/phpunit/tests/import/parser.php
index 2c05bb8f35..f302cefa29 100644
--- a/tests/phpunit/tests/import/parser.php
+++ b/tests/phpunit/tests/import/parser.php
@@ -33,7 +33,7 @@ class Tests_Import_Parser extends WP_Import_UnitTestCase {
// Regex based parser cannot detect malformed XML.
foreach ( array( 'WXR_Parser_SimpleXML', 'WXR_Parser_XML' ) as $p ) {
- $parser = new $p;
+ $parser = new $p();
$result = $parser->parse( $file );
$this->assertWPError( $result );
$this->assertSame( 'There was an error when reading this WXR file', $result->get_error_message() );
@@ -51,7 +51,7 @@ class Tests_Import_Parser extends WP_Import_UnitTestCase {
foreach ( array( 'WXR_Parser_SimpleXML', 'WXR_Parser_XML', 'WXR_Parser_Regex' ) as $p ) {
foreach ( array( $f1, $f2 ) as $file ) {
- $parser = new $p;
+ $parser = new $p();
$result = $parser->parse( $file );
$this->assertWPError( $result );
$this->assertSame( 'This does not appear to be a WXR file, missing/invalid WXR version number', $result->get_error_message() );
@@ -69,7 +69,7 @@ class Tests_Import_Parser extends WP_Import_UnitTestCase {
foreach ( array( 'WXR_Parser_SimpleXML', 'WXR_Parser_XML', 'WXR_Parser_Regex' ) as $p ) {
$message = $p . ' failed';
- $parser = new $p;
+ $parser = new $p();
$result = $parser->parse( $file );
$this->assertIsArray( $result, $message );
@@ -167,7 +167,7 @@ class Tests_Import_Parser extends WP_Import_UnitTestCase {
foreach ( array( 'WXR_Parser_SimpleXML', 'WXR_Parser_XML', 'WXR_Parser_Regex' ) as $p ) {
$message = $p . ' failed';
- $parser = new $p;
+ $parser = new $p();
$result = $parser->parse( $file );
$this->assertIsArray( $result, $message );
@@ -265,7 +265,7 @@ class Tests_Import_Parser extends WP_Import_UnitTestCase {
foreach ( array( 'WXR_Parser_SimpleXML', 'WXR_Parser_XML', 'WXR_Parser_Regex' ) as $p ) {
$message = 'Parser ' . $p;
- $parser = new $p;
+ $parser = new $p();
$result = $parser->parse( $file );
$post = $result['posts'][0];
@@ -298,7 +298,7 @@ class Tests_Import_Parser extends WP_Import_UnitTestCase {
public function test_unescaped_cdata_closing_sequence() {
$file = DIR_TESTDATA . '/export/crazy-cdata.xml';
- $parser = new WXR_Parser_Regex;
+ $parser = new WXR_Parser_Regex();
$result = $parser->parse( $file );
$post = $result['posts'][0];
diff --git a/tests/phpunit/tests/media.php b/tests/phpunit/tests/media.php
index a2459a8db6..5165e32b85 100644
--- a/tests/phpunit/tests/media.php
+++ b/tests/phpunit/tests/media.php
@@ -361,7 +361,7 @@ https://w.org',
* @dataProvider data_autoembed
*/
public function test_autoembed( $content, $result = null ) {
- $wp_embed = new Test_Autoembed;
+ $wp_embed = new Test_Autoembed();
$this->assertSame( $wp_embed->autoembed( $content ), $result ? $result : $content );
}
diff --git a/tests/phpunit/tests/menu/wpExpandNavMenuPostData.php b/tests/phpunit/tests/menu/wpExpandNavMenuPostData.php
index 7d5c21fde8..b7e6b17c23 100644
--- a/tests/phpunit/tests/menu/wpExpandNavMenuPostData.php
+++ b/tests/phpunit/tests/menu/wpExpandNavMenuPostData.php
@@ -13,7 +13,7 @@ class Tests_Menu_WpExpandNavMenuPostData extends WP_UnitTestCase {
}
$data = array();
- $data[0] = new StdClass;
+ $data[0] = new StdClass();
$data[0]->name = 'yesorno';
$data[0]->value = 'yes';
$_POST['nav-menu-data'] = addslashes( json_encode( $data ) );
@@ -36,7 +36,7 @@ class Tests_Menu_WpExpandNavMenuPostData extends WP_UnitTestCase {
}
$data = array();
- $data[0] = new StdClass;
+ $data[0] = new StdClass();
$data[0]->name = 'would[1][do][the][trick]';
$data[0]->value = 'yes';
$_POST['nav-menu-data'] = addslashes( json_encode( $data ) );
@@ -66,13 +66,13 @@ class Tests_Menu_WpExpandNavMenuPostData extends WP_UnitTestCase {
}
$data = array();
- $data[0] = new StdClass;
+ $data[0] = new StdClass();
$data[0]->name = 'would[1][do][the][trick]';
$data[0]->value = 'yes';
- $data[1] = new StdClass;
+ $data[1] = new StdClass();
$data[1]->name = 'would[2][do][the][trick]';
$data[1]->value = 'yes';
- $data[2] = new StdClass;
+ $data[2] = new StdClass();
$data[2]->name = 'would[2][do][the][job]';
$data[2]->value = 'yes';
$_POST['nav-menu-data'] = addslashes( json_encode( $data ) );
diff --git a/tests/phpunit/tests/meta.php b/tests/phpunit/tests/meta.php
index d49f106821..83dcefd1ba 100644
--- a/tests/phpunit/tests/meta.php
+++ b/tests/phpunit/tests/meta.php
@@ -401,7 +401,7 @@ class Tests_Meta extends WP_UnitTestCase {
* @ticket 15030
*/
public function test_get_metadata_with_empty_key_object_value() {
- $data = new stdClass;
+ $data = new stdClass();
$data->foo = 'bar';
$value = serialize( $data );
add_metadata( 'user', $this->author->ID, 'foo', $data );
diff --git a/tests/phpunit/tests/oembed/controller.php b/tests/phpunit/tests/oembed/controller.php
index a5b8d6a483..25d95e7a8c 100644
--- a/tests/phpunit/tests/oembed/controller.php
+++ b/tests/phpunit/tests/oembed/controller.php
@@ -49,7 +49,7 @@ class Test_oEmbed_Controller extends WP_UnitTestCase {
/** @var WP_REST_Server $wp_rest_server */
global $wp_rest_server;
- $wp_rest_server = new Spy_REST_Server;
+ $wp_rest_server = new Spy_REST_Server();
do_action( 'rest_api_init', $wp_rest_server );
add_filter( 'pre_http_request', array( $this, 'mock_embed_request' ), 10, 3 );
diff --git a/tests/phpunit/tests/pomo/mo.php b/tests/phpunit/tests/pomo/mo.php
index 2269e3d826..e4ce6c4b16 100644
--- a/tests/phpunit/tests/pomo/mo.php
+++ b/tests/phpunit/tests/pomo/mo.php
@@ -145,7 +145,7 @@ class Tests_POMO_MO extends WP_UnitTestCase {
public function test_export_should_not_include_empty_translations() {
$entries = array();
- $mo = new MO;
+ $mo = new MO();
$mo->add_entry(
array(
'singular' => 'baba',
diff --git a/tests/phpunit/tests/pomo/noopTranslations.php b/tests/phpunit/tests/pomo/noopTranslations.php
index 3fcfed6b57..44f46c1880 100644
--- a/tests/phpunit/tests/pomo/noopTranslations.php
+++ b/tests/phpunit/tests/pomo/noopTranslations.php
@@ -28,7 +28,7 @@ class Tests_POMO_NOOPTranslations extends WP_UnitTestCase {
public function set_up() {
parent::set_up();
- $this->noop = new NOOP_Translations;
+ $this->noop = new NOOP_Translations();
$this->entry = new Translation_Entry( array( 'singular' => 'baba' ) );
$this->plural_entry = new Translation_Entry(
array(
diff --git a/tests/phpunit/tests/pomo/translations.php b/tests/phpunit/tests/pomo/translations.php
index 1e5cc2d037..0d2a3383b0 100644
--- a/tests/phpunit/tests/pomo/translations.php
+++ b/tests/phpunit/tests/pomo/translations.php
@@ -121,7 +121,7 @@ class Tests_POMO_Translations extends WP_UnitTestCase {
$domain = new Translations();
$domain->add_entry( $entry_digit_1 );
$domain->add_entry( $entry_digit_2 );
- $dummy_translation = new Translations;
+ $dummy_translation = new Translations();
$this->assertSame( '1', $domain->translate( '1' ) );
$domain->merge_with( $dummy_translation );
$this->assertSame( '1', $domain->translate( '1' ) );
diff --git a/tests/phpunit/tests/post.php b/tests/phpunit/tests/post.php
index 551cbd8c56..484b890af4 100644
--- a/tests/phpunit/tests/post.php
+++ b/tests/phpunit/tests/post.php
@@ -158,7 +158,7 @@ class Tests_Post extends WP_UnitTestCase {
_unregister_post_type( $post_type );
$count = wp_count_posts( $post_type, 'readable' );
- $this->assertEquals( new stdClass, $count );
+ $this->assertEquals( new stdClass(), $count );
}
public function test_wp_count_posts_filtered() {
@@ -601,7 +601,7 @@ class Tests_Post extends WP_UnitTestCase {
'1 int' => array( 1 ),
'null' => array( null ),
'true' => array( true ),
- 'an object' => array( new stdClass ),
+ 'an object' => array( new stdClass() ),
);
}
diff --git a/tests/phpunit/tests/post/meta.php b/tests/phpunit/tests/post/meta.php
index 456eda0ba1..0efca37f6b 100644
--- a/tests/phpunit/tests/post/meta.php
+++ b/tests/phpunit/tests/post/meta.php
@@ -169,7 +169,7 @@ class Tests_Post_Meta extends WP_UnitTestCase {
$mid = add_post_meta( self::$post_id, 'get_post_meta_by_key', 'get_post_meta_by_key_value', true );
$this->assertIsInt( $mid );
- $mobj = new stdClass;
+ $mobj = new stdClass();
$mobj->meta_id = $mid;
$mobj->post_id = self::$post_id;
$mobj->meta_key = 'get_post_meta_by_key';
diff --git a/tests/phpunit/tests/post/types.php b/tests/phpunit/tests/post/types.php
index 5ea10cbb2c..df1543fa0c 100644
--- a/tests/phpunit/tests/post/types.php
+++ b/tests/phpunit/tests/post/types.php
@@ -256,7 +256,7 @@ class Tests_Post_Types extends WP_UnitTestCase {
$this->assertNotNull( get_post_type_object( 'foo' ) );
$this->assertNull( get_post_type_object( array() ) );
$this->assertNull( get_post_type_object( array( 'foo' ) ) );
- $this->assertNull( get_post_type_object( new stdClass ) );
+ $this->assertNull( get_post_type_object( new stdClass() ) );
_unregister_post_type( 'foo' );
diff --git a/tests/phpunit/tests/query.php b/tests/phpunit/tests/query.php
index 5ef98e1f72..9c4ca439a5 100644
--- a/tests/phpunit/tests/query.php
+++ b/tests/phpunit/tests/query.php
@@ -33,7 +33,7 @@ class Tests_Query extends WP_UnitTestCase {
* @ticket 16471
*/
public function test_default_query_var() {
- $query = new WP_Query;
+ $query = new WP_Query();
$this->assertSame( '', $query->get( 'nonexistent' ) );
$this->assertFalse( $query->get( 'nonexistent', false ) );
$this->assertTrue( $query->get( 'nonexistent', true ) );
diff --git a/tests/phpunit/tests/query/generatePostdata.php b/tests/phpunit/tests/query/generatePostdata.php
index c223e4b598..5d39dfb5d4 100644
--- a/tests/phpunit/tests/query/generatePostdata.php
+++ b/tests/phpunit/tests/query/generatePostdata.php
@@ -19,7 +19,7 @@ class Tests_Query_GeneratePostdata extends WP_UnitTestCase {
* @ticket 42814
*/
public function test_setup_by_fake_post() {
- $fake = new stdClass;
+ $fake = new stdClass();
$fake->ID = 98765;
$data = generate_postdata( $fake->ID );
diff --git a/tests/phpunit/tests/query/setupPostdata.php b/tests/phpunit/tests/query/setupPostdata.php
index cabfba7c5b..985ae06f7a 100644
--- a/tests/phpunit/tests/query/setupPostdata.php
+++ b/tests/phpunit/tests/query/setupPostdata.php
@@ -33,7 +33,7 @@ class Tests_Query_SetupPostdata extends WP_UnitTestCase {
* @ticket 30970
*/
public function test_setup_by_fake_post() {
- $fake = new stdClass;
+ $fake = new stdClass();
$fake->ID = 98765;
setup_postdata( $fake->ID );
diff --git a/tests/phpunit/tests/rest-api/rest-block-type-controller.php b/tests/phpunit/tests/rest-api/rest-block-type-controller.php
index 02312ba6ce..b7342a0a43 100644
--- a/tests/phpunit/tests/rest-api/rest-block-type-controller.php
+++ b/tests/phpunit/tests/rest-api/rest-block-type-controller.php
@@ -624,15 +624,15 @@ class REST_Block_Type_Controller_Test extends WP_Test_REST_Controller_Testcase {
* @ticket 47620
*/
public function test_prepare_item() {
- $registry = new WP_Block_Type_Registry;
+ $registry = new WP_Block_Type_Registry();
$settings = array(
'icon' => 'text',
'render_callback' => '__return_null',
);
$registry->register( 'fake/line', $settings );
$block_type = $registry->get_registered( 'fake/line' );
- $endpoint = new WP_REST_Block_Types_Controller;
- $request = new WP_REST_Request;
+ $endpoint = new WP_REST_Block_Types_Controller();
+ $request = new WP_REST_Request();
$request->set_param( 'context', 'edit' );
$response = $endpoint->prepare_item_for_response( $block_type, $request );
$this->check_block_type_object( $block_type, $response->get_data(), $response->get_links() );
@@ -642,15 +642,15 @@ class REST_Block_Type_Controller_Test extends WP_Test_REST_Controller_Testcase {
* @ticket 47620
*/
public function test_prepare_item_limit_fields() {
- $registry = new WP_Block_Type_Registry;
+ $registry = new WP_Block_Type_Registry();
$settings = array(
'icon' => 'text',
'render_callback' => '__return_null',
);
$registry->register( 'fake/line', $settings );
$block_type = $registry->get_registered( 'fake/line' );
- $request = new WP_REST_Request;
- $endpoint = new WP_REST_Block_Types_Controller;
+ $request = new WP_REST_Request();
+ $endpoint = new WP_REST_Block_Types_Controller();
$request->set_param( 'context', 'edit' );
$request->set_param( '_fields', 'name' );
$response = $endpoint->prepare_item_for_response( $block_type, $request );
diff --git a/tests/phpunit/tests/rest-api/rest-categories-controller.php b/tests/phpunit/tests/rest-api/rest-categories-controller.php
index 805472487f..070dac5047 100644
--- a/tests/phpunit/tests/rest-api/rest-categories-controller.php
+++ b/tests/phpunit/tests/rest-api/rest-categories-controller.php
@@ -1093,7 +1093,7 @@ class WP_Test_REST_Categories_Controller extends WP_Test_REST_Controller_Testcas
}
public function test_prepare_item_limit_fields() {
- $request = new WP_REST_Request;
+ $request = new WP_REST_Request();
$endpoint = new WP_REST_Terms_Controller( 'category' );
$request->set_param( '_fields', 'id,name' );
$term = get_term( 1, 'category' );
diff --git a/tests/phpunit/tests/rest-api/rest-comments-controller.php b/tests/phpunit/tests/rest-api/rest-comments-controller.php
index ef9aec3809..be8036e90b 100644
--- a/tests/phpunit/tests/rest-api/rest-comments-controller.php
+++ b/tests/phpunit/tests/rest-api/rest-comments-controller.php
@@ -152,7 +152,7 @@ class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase
public function set_up() {
parent::set_up();
- $this->endpoint = new WP_REST_Comments_Controller;
+ $this->endpoint = new WP_REST_Comments_Controller();
if ( is_multisite() ) {
update_site_option( 'site_admins', array( 'superadmin' ) );
}
@@ -953,7 +953,7 @@ class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase
public function test_prepare_item_limit_fields() {
wp_set_current_user( self::$admin_id );
- $endpoint = new WP_REST_Comments_Controller;
+ $endpoint = new WP_REST_Comments_Controller();
$request = new WP_REST_Request( 'GET', sprintf( '/wp/v2/comments/%d', self::$approved_id ) );
$request->set_param( 'context', 'edit' );
$request->set_param( '_fields', 'id,status' );
diff --git a/tests/phpunit/tests/rest-api/rest-post-meta-fields.php b/tests/phpunit/tests/rest-api/rest-post-meta-fields.php
index cc804a80fc..7101a38c7c 100644
--- a/tests/phpunit/tests/rest-api/rest-post-meta-fields.php
+++ b/tests/phpunit/tests/rest-api/rest-post-meta-fields.php
@@ -247,7 +247,7 @@ class WP_Test_REST_Post_Meta_Fields extends WP_Test_REST_TestCase {
/** @var WP_REST_Server $wp_rest_server */
global $wp_rest_server;
- $wp_rest_server = new Spy_REST_Server;
+ $wp_rest_server = new Spy_REST_Server();
do_action( 'rest_api_init', $wp_rest_server );
}
@@ -380,7 +380,7 @@ class WP_Test_REST_Post_Meta_Fields extends WP_Test_REST_TestCase {
/** @var WP_REST_Server $wp_rest_server */
global $wp_rest_server;
- $wp_rest_server = new Spy_REST_Server;
+ $wp_rest_server = new Spy_REST_Server();
do_action( 'rest_api_init', $wp_rest_server );
add_post_meta( self::$post_id, 'test_string', 42 );
diff --git a/tests/phpunit/tests/rest-api/rest-post-statuses-controller.php b/tests/phpunit/tests/rest-api/rest-post-statuses-controller.php
index 901e8bb357..2f1e92cbae 100644
--- a/tests/phpunit/tests/rest-api/rest-post-statuses-controller.php
+++ b/tests/phpunit/tests/rest-api/rest-post-statuses-controller.php
@@ -125,8 +125,8 @@ class WP_Test_REST_Post_Statuses_Controller extends WP_Test_REST_Controller_Test
public function test_prepare_item() {
$obj = get_post_status_object( 'publish' );
- $endpoint = new WP_REST_Post_Statuses_Controller;
- $request = new WP_REST_Request;
+ $endpoint = new WP_REST_Post_Statuses_Controller();
+ $request = new WP_REST_Request();
$request->set_param( 'context', 'edit' );
$data = $endpoint->prepare_item_for_response( $obj, $request );
$this->check_post_status_obj( $obj, $data->get_data(), $data->get_links() );
@@ -134,8 +134,8 @@ class WP_Test_REST_Post_Statuses_Controller extends WP_Test_REST_Controller_Test
public function test_prepare_item_limit_fields() {
$obj = get_post_status_object( 'publish' );
- $request = new WP_REST_Request;
- $endpoint = new WP_REST_Post_Statuses_Controller;
+ $request = new WP_REST_Request();
+ $endpoint = new WP_REST_Post_Statuses_Controller();
$request->set_param( 'context', 'edit' );
$request->set_param( '_fields', 'id,name' );
$response = $endpoint->prepare_item_for_response( $obj, $request );
diff --git a/tests/phpunit/tests/rest-api/rest-post-types-controller.php b/tests/phpunit/tests/rest-api/rest-post-types-controller.php
index 58e1698426..a56aefa4ad 100644
--- a/tests/phpunit/tests/rest-api/rest-post-types-controller.php
+++ b/tests/phpunit/tests/rest-api/rest-post-types-controller.php
@@ -133,8 +133,8 @@ class WP_Test_REST_Post_Types_Controller extends WP_Test_REST_Controller_Testcas
public function test_prepare_item() {
$obj = get_post_type_object( 'post' );
- $endpoint = new WP_REST_Post_Types_Controller;
- $request = new WP_REST_Request;
+ $endpoint = new WP_REST_Post_Types_Controller();
+ $request = new WP_REST_Request();
$request->set_param( 'context', 'edit' );
$response = $endpoint->prepare_item_for_response( $obj, $request );
$this->check_post_type_obj( 'edit', $obj, $response->get_data(), $response->get_links() );
@@ -142,8 +142,8 @@ class WP_Test_REST_Post_Types_Controller extends WP_Test_REST_Controller_Testcas
public function test_prepare_item_limit_fields() {
$obj = get_post_type_object( 'post' );
- $request = new WP_REST_Request;
- $endpoint = new WP_REST_Post_Types_Controller;
+ $request = new WP_REST_Request();
+ $endpoint = new WP_REST_Post_Types_Controller();
$request->set_param( 'context', 'edit' );
$request->set_param( '_fields', 'id,name' );
$response = $endpoint->prepare_item_for_response( $obj, $request );
diff --git a/tests/phpunit/tests/rest-api/rest-schema-setup.php b/tests/phpunit/tests/rest-api/rest-schema-setup.php
index afc1ebc125..c58af7c346 100644
--- a/tests/phpunit/tests/rest-api/rest-schema-setup.php
+++ b/tests/phpunit/tests/rest-api/rest-schema-setup.php
@@ -20,7 +20,7 @@ class WP_Test_REST_Schema_Initialization extends WP_Test_REST_TestCase {
/** @var WP_REST_Server $wp_rest_server */
global $wp_rest_server;
- $wp_rest_server = new Spy_REST_Server;
+ $wp_rest_server = new Spy_REST_Server();
do_action( 'rest_api_init', $wp_rest_server );
add_filter( 'pre_http_request', array( $this, 'mock_embed_request' ), 10, 3 );
diff --git a/tests/phpunit/tests/rest-api/rest-tags-controller.php b/tests/phpunit/tests/rest-api/rest-tags-controller.php
index a4b566f7b2..945d97a304 100644
--- a/tests/phpunit/tests/rest-api/rest-tags-controller.php
+++ b/tests/phpunit/tests/rest-api/rest-tags-controller.php
@@ -1211,7 +1211,7 @@ class WP_Test_REST_Tags_Controller extends WP_Test_REST_Controller_Testcase {
}
public function test_prepare_item_limit_fields() {
- $request = new WP_REST_Request;
+ $request = new WP_REST_Request();
$endpoint = new WP_REST_Terms_Controller( 'post_tag' );
$request->set_param( '_fields', 'id,name' );
$term = get_term_by( 'id', self::factory()->tag->create(), 'post_tag' );
diff --git a/tests/phpunit/tests/rest-api/rest-taxonomies-controller.php b/tests/phpunit/tests/rest-api/rest-taxonomies-controller.php
index 78593e6bd8..e2901c6307 100644
--- a/tests/phpunit/tests/rest-api/rest-taxonomies-controller.php
+++ b/tests/phpunit/tests/rest-api/rest-taxonomies-controller.php
@@ -174,8 +174,8 @@ class WP_Test_REST_Taxonomies_Controller extends WP_Test_REST_Controller_Testcas
public function test_prepare_item() {
$tax = get_taxonomy( 'category' );
- $endpoint = new WP_REST_Taxonomies_Controller;
- $request = new WP_REST_Request;
+ $endpoint = new WP_REST_Taxonomies_Controller();
+ $request = new WP_REST_Request();
$request->set_param( 'context', 'edit' );
$response = $endpoint->prepare_item_for_response( $tax, $request );
$this->check_taxonomy_object( 'edit', $tax, $response->get_data(), $response->get_links() );
@@ -183,8 +183,8 @@ class WP_Test_REST_Taxonomies_Controller extends WP_Test_REST_Controller_Testcas
public function test_prepare_item_limit_fields() {
$tax = get_taxonomy( 'category' );
- $request = new WP_REST_Request;
- $endpoint = new WP_REST_Taxonomies_Controller;
+ $request = new WP_REST_Request();
+ $endpoint = new WP_REST_Taxonomies_Controller();
$request->set_param( 'context', 'edit' );
$request->set_param( '_fields', 'id,name' );
$response = $endpoint->prepare_item_for_response( $tax, $request );
diff --git a/tests/phpunit/tests/rest-api/rest-term-meta-fields.php b/tests/phpunit/tests/rest-api/rest-term-meta-fields.php
index 5a61623387..21d4ca86cd 100644
--- a/tests/phpunit/tests/rest-api/rest-term-meta-fields.php
+++ b/tests/phpunit/tests/rest-api/rest-term-meta-fields.php
@@ -194,7 +194,7 @@ class WP_Test_REST_Term_Meta_Fields extends WP_Test_REST_TestCase {
/** @var WP_REST_Server $wp_rest_server */
global $wp_rest_server;
- $wp_rest_server = new Spy_REST_Server;
+ $wp_rest_server = new Spy_REST_Server();
do_action( 'rest_api_init', $wp_rest_server );
}
@@ -327,7 +327,7 @@ class WP_Test_REST_Term_Meta_Fields extends WP_Test_REST_TestCase {
/** @var WP_REST_Server $wp_rest_server */
global $wp_rest_server;
- $wp_rest_server = new Spy_REST_Server;
+ $wp_rest_server = new Spy_REST_Server();
do_action( 'rest_api_init', $wp_rest_server );
add_term_meta( self::$category_id, 'test_string', 42 );
diff --git a/tests/phpunit/tests/rest-api/rest-users-controller.php b/tests/phpunit/tests/rest-api/rest-users-controller.php
index 849b0e5464..05e01a6e92 100644
--- a/tests/phpunit/tests/rest-api/rest-users-controller.php
+++ b/tests/phpunit/tests/rest-api/rest-users-controller.php
@@ -974,7 +974,7 @@ class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase {
public function test_prepare_item() {
wp_set_current_user( self::$user );
- $request = new WP_REST_Request;
+ $request = new WP_REST_Request();
$request->set_param( 'context', 'edit' );
$user = get_user_by( 'id', get_current_user_id() );
$data = $this->endpoint->prepare_item_for_response( $user, $request );
@@ -984,7 +984,7 @@ class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase {
public function test_prepare_item_limit_fields() {
wp_set_current_user( self::$user );
- $request = new WP_REST_Request;
+ $request = new WP_REST_Request();
$request->set_param( 'context', 'edit' );
$request->set_param( '_fields', 'id,name' );
$user = get_user_by( 'id', get_current_user_id() );
diff --git a/tests/phpunit/tests/rest-api/rest-widget-types-controller.php b/tests/phpunit/tests/rest-api/rest-widget-types-controller.php
index 5c6f22bfee..5074205fb7 100644
--- a/tests/phpunit/tests/rest-api/rest-widget-types-controller.php
+++ b/tests/phpunit/tests/rest-api/rest-widget-types-controller.php
@@ -118,7 +118,7 @@ class WP_Test_REST_Widget_Types_Controller extends WP_Test_REST_Controller_Testc
$response = rest_get_server()->dispatch( $request );
$data = $response->get_data();
$this->assertGreaterThan( 1, count( $data ) );
- $endpoint = new WP_REST_Widget_Types_Controller;
+ $endpoint = new WP_REST_Widget_Types_Controller();
foreach ( $data as $item ) {
$widget_type = $endpoint->get_widget( $item['name'] );
$this->check_widget_type_object( $widget_type, $item, $item['_links'] );
@@ -180,7 +180,7 @@ class WP_Test_REST_Widget_Types_Controller extends WP_Test_REST_Controller_Testc
wp_set_current_user( self::$admin_id );
$request = new WP_REST_Request( 'GET', '/wp/v2/widget-types/' . $widget_name );
$response = rest_get_server()->dispatch( $request );
- $endpoint = new WP_REST_Widget_Types_Controller;
+ $endpoint = new WP_REST_Widget_Types_Controller();
$widget_type = $endpoint->get_widget( $widget_name );
$this->check_widget_type_object( $widget_type, $response->get_data(), $response->get_links() );
}
@@ -198,7 +198,7 @@ class WP_Test_REST_Widget_Types_Controller extends WP_Test_REST_Controller_Testc
wp_set_current_user( self::$admin_id );
$request = new WP_REST_Request( 'GET', '/wp/v2/widget-types/' . $widget_id );
$response = rest_get_server()->dispatch( $request );
- $endpoint = new WP_REST_Widget_Types_Controller;
+ $endpoint = new WP_REST_Widget_Types_Controller();
$widget_type = $endpoint->get_widget( $widget_id );
$this->check_widget_type_object( $widget_type, $response->get_data(), $response->get_links() );
}
@@ -298,9 +298,9 @@ class WP_Test_REST_Widget_Types_Controller extends WP_Test_REST_Controller_Testc
* @ticket 41683
*/
public function test_prepare_item() {
- $endpoint = new WP_REST_Widget_Types_Controller;
+ $endpoint = new WP_REST_Widget_Types_Controller();
$widget_type = $endpoint->get_widget( 'calendar' );
- $request = new WP_REST_Request;
+ $request = new WP_REST_Request();
$request->set_param( 'context', 'edit' );
$response = $endpoint->prepare_item_for_response( $widget_type, $request );
$this->check_widget_type_object( $widget_type, $response->get_data(), $response->get_links() );
@@ -366,7 +366,7 @@ class WP_Test_REST_Widget_Types_Controller extends WP_Test_REST_Controller_Testc
array(
'encoded' => base64_encode( serialize( array() ) ),
'hash' => wp_hash( serialize( array() ) ),
- 'raw' => new stdClass,
+ 'raw' => new stdClass(),
),
$data['instance']
);
@@ -402,7 +402,7 @@ class WP_Test_REST_Widget_Types_Controller extends WP_Test_REST_Controller_Testc
array(
'encoded' => base64_encode( serialize( array() ) ),
'hash' => wp_hash( serialize( array() ) ),
- 'raw' => new stdClass,
+ 'raw' => new stdClass(),
),
$data['instance']
);