From 3ba44120d0ffa7ac330a1b7e3f8b363ce78f8060 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 29 Nov 2022 15:51:14 +0000 Subject: [PATCH] Coding Standards: Always use parentheses when instantiating an object. Note: This will be enforced by WPCS 3.0.0. Props jrf. See #56791. Built from https://develop.svn.wordpress.org/trunk@54891 git-svn-id: http://core.svn.wordpress.org/trunk@54443 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/customize.php | 2 +- wp-admin/includes/ajax-actions.php | 2 +- wp-admin/includes/bookmark.php | 2 +- .../includes/class-language-pack-upgrader.php | 2 +- .../includes/class-wp-automatic-updater.php | 4 ++-- .../class-wp-site-health-auto-updates.php | 4 ++-- wp-admin/includes/image-edit.php | 4 ++-- wp-admin/includes/nav-menu.php | 8 ++++---- wp-admin/includes/post.php | 2 +- wp-admin/includes/privacy-tools.php | 2 +- wp-admin/includes/schema.php | 2 +- wp-admin/includes/template.php | 2 +- wp-admin/includes/translation-install.php | 4 ++-- wp-admin/includes/update-core.php | 2 +- wp-admin/includes/update.php | 4 ++-- wp-admin/includes/upgrade.php | 2 +- wp-admin/includes/user.php | 2 +- wp-admin/user-edit.php | 2 +- wp-includes/admin-bar.php | 2 +- wp-includes/capabilities.php | 2 +- wp-includes/category-template.php | 4 ++-- wp-includes/class-wp-admin-bar.php | 2 +- wp-includes/class-wp-editor.php | 2 +- wp-includes/class-wp-http.php | 2 +- wp-includes/class-wp-oembed.php | 4 ++-- .../class-wp-text-diff-renderer-table.php | 2 +- wp-includes/class-wp-user.php | 2 +- wp-includes/comment-template.php | 2 +- wp-includes/comment.php | 6 +++--- wp-includes/functions.php | 2 +- wp-includes/l10n.php | 2 +- wp-includes/ms-load.php | 4 ++-- wp-includes/nav-menu-template.php | 2 +- wp-includes/nav-menu.php | 2 +- wp-includes/pluggable.php | 2 +- wp-includes/post-template.php | 4 ++-- wp-includes/post.php | 4 ++-- wp-includes/rest-api.php | 18 +++++++++--------- .../rest-api/class-wp-rest-response.php | 2 +- .../class-wp-rest-attachments-controller.php | 4 ++-- .../class-wp-rest-comments-controller.php | 4 ++-- .../class-wp-rest-terms-controller.php | 2 +- .../class-wp-rest-users-controller.php | 2 +- .../class-wp-rest-widget-types-controller.php | 2 +- .../class-wp-rest-widgets-controller.php | 2 +- wp-includes/theme.php | 2 +- wp-includes/update.php | 12 ++++++------ wp-includes/user.php | 2 +- wp-includes/version.php | 2 +- xmlrpc.php | 2 +- 50 files changed, 80 insertions(+), 80 deletions(-) diff --git a/wp-admin/customize.php b/wp-admin/customize.php index 0df5d81ae5..cd2550c1a8 100644 --- a/wp-admin/customize.php +++ b/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/wp-admin/includes/ajax-actions.php b/wp-admin/includes/ajax-actions.php index 6ca6a0217a..995433eaba 100644 --- a/wp-admin/includes/ajax-actions.php +++ b/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/wp-admin/includes/bookmark.php b/wp-admin/includes/bookmark.php index 8d26e27a5e..abb068319c 100644 --- a/wp-admin/includes/bookmark.php +++ b/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/wp-admin/includes/class-language-pack-upgrader.php b/wp-admin/includes/class-language-pack-upgrader.php index c219999569..0d6961ab22 100644 --- a/wp-admin/includes/class-language-pack-upgrader.php +++ b/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/wp-admin/includes/class-wp-automatic-updater.php b/wp-admin/includes/class-wp-automatic-updater.php index 2d62527a98..083a6dcc36 100644 --- a/wp-admin/includes/class-wp-automatic-updater.php +++ b/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/wp-admin/includes/class-wp-site-health-auto-updates.php b/wp-admin/includes/class-wp-site-health-auto-updates.php index e3c02d0620..541bbd1f23 100644 --- a/wp-admin/includes/class-wp-site-health-auto-updates.php +++ b/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/wp-admin/includes/image-edit.php b/wp-admin/includes/image-edit.php index e814fc47e7..746c0bafbd 100644 --- a/wp-admin/includes/image-edit.php +++ b/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/wp-admin/includes/nav-menu.php b/wp-admin/includes/nav-menu.php index 0e09d31148..8dd05ba533 100644 --- a/wp-admin/includes/nav-menu.php +++ b/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/wp-admin/includes/post.php b/wp-admin/includes/post.php index 65b36c4836..b72134d421 100644 --- a/wp-admin/includes/post.php +++ b/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/wp-admin/includes/privacy-tools.php b/wp-admin/includes/privacy-tools.php index f974ea8a5d..9682e94fcf 100644 --- a/wp-admin/includes/privacy-tools.php +++ b/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/wp-admin/includes/schema.php b/wp-admin/includes/schema.php index 57ffe69054..79fb80c205 100644 --- a/wp-admin/includes/schema.php +++ b/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/wp-admin/includes/template.php b/wp-admin/includes/template.php index deecc92c50..7de1a07431 100644 --- a/wp-admin/includes/template.php +++ b/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/wp-admin/includes/translation-install.php b/wp-admin/includes/translation-install.php index dc7cb89a05..01c61bbb7b 100644 --- a/wp-admin/includes/translation-install.php +++ b/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/wp-admin/includes/update-core.php b/wp-admin/includes/update-core.php index 20a7390149..c240fb0ee6 100644 --- a/wp-admin/includes/update-core.php +++ b/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/wp-admin/includes/update.php b/wp-admin/includes/update.php index 8661af75b5..530406bc28 100644 --- a/wp-admin/includes/update.php +++ b/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/wp-admin/includes/upgrade.php b/wp-admin/includes/upgrade.php index 94d9d335f3..63580cceb0 100644 --- a/wp-admin/includes/upgrade.php +++ b/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/wp-admin/includes/user.php b/wp-admin/includes/user.php index 134da30514..1df2739d48 100644 --- a/wp-admin/includes/user.php +++ b/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/wp-admin/user-edit.php b/wp-admin/user-edit.php index 681c7354f8..edcdfb1ac5 100644 --- a/wp-admin/user-edit.php +++ b/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/wp-includes/admin-bar.php b/wp-includes/admin-bar.php index 19322a3451..784153ebf0 100644 --- a/wp-includes/admin-bar.php +++ b/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/wp-includes/capabilities.php b/wp-includes/capabilities.php index d06887a2bb..2b16174666 100644 --- a/wp-includes/capabilities.php +++ b/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/wp-includes/category-template.php b/wp-includes/category-template.php index dc0dfe7ef0..b35c17170d 100644 --- a/wp-includes/category-template.php +++ b/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/wp-includes/class-wp-admin-bar.php b/wp-includes/class-wp-admin-bar.php index 406d76459b..dc6ea0993c 100644 --- a/wp-includes/class-wp-admin-bar.php +++ b/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/wp-includes/class-wp-editor.php b/wp-includes/class-wp-editor.php index 41f379a838..16805f7a16 100644 --- a/wp-includes/class-wp-editor.php +++ b/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/wp-includes/class-wp-http.php b/wp-includes/class-wp-http.php index 3d4e8798aa..3d90085e49 100644 --- a/wp-includes/class-wp-http.php +++ b/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/wp-includes/class-wp-oembed.php b/wp-includes/class-wp-oembed.php index 8b24cf752b..e177223435 100644 --- a/wp-includes/class-wp-oembed.php +++ b/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/wp-includes/class-wp-text-diff-renderer-table.php b/wp-includes/class-wp-text-diff-renderer-table.php index a74b8019f4..dbbf867c74 100644 --- a/wp-includes/class-wp-text-diff-renderer-table.php +++ b/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/wp-includes/class-wp-user.php b/wp-includes/class-wp-user.php index b190960009..ecfa1a5920 100644 --- a/wp-includes/class-wp-user.php +++ b/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/wp-includes/comment-template.php b/wp-includes/comment-template.php index 63614663de..44eddaec86 100644 --- a/wp-includes/comment-template.php +++ b/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/wp-includes/comment.php b/wp-includes/comment.php index bf646a2a27..a52edf84f4 100644 --- a/wp-includes/comment.php +++ b/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/wp-includes/functions.php b/wp-includes/functions.php index 8cb36f5e39..b2baae9a51 100644 --- a/wp-includes/functions.php +++ b/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/wp-includes/l10n.php b/wp-includes/l10n.php index 40c653fdbe..d7642c7038 100644 --- a/wp-includes/l10n.php +++ b/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/wp-includes/ms-load.php b/wp-includes/ms-load.php index 35942df0f8..c7f74167f4 100644 --- a/wp-includes/ms-load.php +++ b/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/wp-includes/nav-menu-template.php b/wp-includes/nav-menu-template.php index 0673bf36ed..893727c44c 100644 --- a/wp-includes/nav-menu-template.php +++ b/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/wp-includes/nav-menu.php b/wp-includes/nav-menu.php index 3ef281f643..87b51182e3 100644 --- a/wp-includes/nav-menu.php +++ b/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/wp-includes/pluggable.php b/wp-includes/pluggable.php index 2852e23a93..27e5d91b20 100644 --- a/wp-includes/pluggable.php +++ b/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/wp-includes/post-template.php b/wp-includes/post-template.php index 03178a3dd5..3ce819c2b0 100644 --- a/wp-includes/post-template.php +++ b/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/wp-includes/post.php b/wp-includes/post.php index 185d2d5a08..1163d023cd 100644 --- a/wp-includes/post.php +++ b/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/wp-includes/rest-api.php b/wp-includes/rest-api.php index b611745ebd..3953b74392 100644 --- a/wp-includes/rest-api.php +++ b/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/wp-includes/rest-api/class-wp-rest-response.php b/wp-includes/rest-api/class-wp-rest-response.php index cb890f5b0b..c6ea11be83 100644 --- a/wp-includes/rest-api/class-wp-rest-response.php +++ b/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/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php index ff3c1dc42f..98c0a1bb64 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php +++ b/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/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php index 42919b7dc2..6fecfd3961 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php +++ b/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/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php index 4ef48fa366..4fda654746 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php +++ b/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/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php index 52e8fcf0cd..62b9bc7e5d 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php +++ b/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/wp-includes/rest-api/endpoints/class-wp-rest-widget-types-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-widget-types-controller.php index d721c32d64..1868050573 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-widget-types-controller.php +++ b/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/wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php index e6ac11cf88..596e78aecf 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php +++ b/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/wp-includes/theme.php b/wp-includes/theme.php index 61d5c13284..47fe9cb162 100644 --- a/wp-includes/theme.php +++ b/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/wp-includes/update.php b/wp-includes/update.php index f352cab7c2..5136912037 100644 --- a/wp-includes/update.php +++ b/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/wp-includes/user.php b/wp-includes/user.php index 9c17d1583e..cc128c26e4 100644 --- a/wp-includes/user.php +++ b/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/wp-includes/version.php b/wp-includes/version.php index 512b8fc7fc..b9158a963a 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.2-alpha-54890'; +$wp_version = '6.2-alpha-54891'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. diff --git a/xmlrpc.php b/xmlrpc.php index ecac4c7c7a..3f35815525 100644 --- a/xmlrpc.php +++ b/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();