Make WordPress Core

Ticket #56791: 56791-always-use-parentheses-when-instantiating-an-object.patch

File 56791-always-use-parentheses-when-instantiating-an-object.patch, 76.7 KB (added by jrf, 19 months ago)

Follow up to previous efforts for the same. Note: this will be enforced by WPCS 3.0.0.

  • src/wp-admin/customize.php

    From 26945cb7e360d4827fa96bc354b5f6762b4c7202 Mon Sep 17 00:00:00 2001
    From: jrfnl <jrfnl@users.noreply.github.com>
    Date: Sat, 23 Jul 2022 23:40:28 +0200
    Subject: [PATCH] CS: always use parentheses when instantiating an object
    
    ---
     src/wp-admin/customize.php                     |  2 +-
     src/wp-admin/includes/ajax-actions.php         |  2 +-
     src/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 ++--
     src/wp-admin/includes/image-edit.php           |  4 ++--
     src/wp-admin/includes/nav-menu.php             |  8 ++++----
     src/wp-admin/includes/post.php                 |  2 +-
     src/wp-admin/includes/privacy-tools.php        |  2 +-
     src/wp-admin/includes/schema.php               |  2 +-
     src/wp-admin/includes/template.php             |  2 +-
     src/wp-admin/includes/translation-install.php  |  4 ++--
     src/wp-admin/includes/update-core.php          |  2 +-
     src/wp-admin/includes/update.php               |  4 ++--
     src/wp-admin/includes/upgrade.php              |  2 +-
     src/wp-admin/includes/user.php                 |  2 +-
     src/wp-admin/user-edit.php                     |  2 +-
     src/wp-includes/admin-bar.php                  |  2 +-
     src/wp-includes/capabilities.php               |  2 +-
     src/wp-includes/category-template.php          |  4 ++--
     src/wp-includes/class-wp-admin-bar.php         |  2 +-
     src/wp-includes/class-wp-editor.php            |  2 +-
     src/wp-includes/class-wp-http.php              |  2 +-
     src/wp-includes/class-wp-oembed.php            |  4 ++--
     .../class-wp-text-diff-renderer-table.php      |  2 +-
     src/wp-includes/class-wp-user.php              |  2 +-
     src/wp-includes/comment-template.php           |  2 +-
     src/wp-includes/comment.php                    |  6 +++---
     src/wp-includes/functions.php                  |  2 +-
     src/wp-includes/l10n.php                       |  2 +-
     src/wp-includes/ms-load.php                    |  4 ++--
     src/wp-includes/nav-menu-template.php          |  2 +-
     src/wp-includes/nav-menu.php                   |  2 +-
     src/wp-includes/pluggable.php                  |  2 +-
     src/wp-includes/post-template.php              |  4 ++--
     src/wp-includes/post.php                       |  4 ++--
     src/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 +-
     src/wp-includes/theme.php                      |  2 +-
     src/wp-includes/update.php                     | 12 ++++++------
     src/wp-includes/user.php                       |  2 +-
     src/xmlrpc.php                                 |  2 +-
     .../includes/testcase-rest-controller.php      |  2 +-
     tests/phpunit/tests/adminbar.php               |  4 ++--
     tests/phpunit/tests/blocks/editor.php          |  2 +-
     tests/phpunit/tests/cache.php                  |  4 ++--
     tests/phpunit/tests/dependencies.php           | 16 ++++++++--------
     tests/phpunit/tests/dependencies/jquery.php    |  4 ++--
     tests/phpunit/tests/dependencies/scripts.php   |  4 ++--
     .../tests/formatting/sanitizeTextField.php     |  2 +-
     .../tests/formatting/stripslashesDeep.php      |  6 +++---
     tests/phpunit/tests/formatting/wpSlash.php     |  2 +-
     tests/phpunit/tests/functions.php              |  8 ++++----
     tests/phpunit/tests/import/parser.php          | 12 ++++++------
     tests/phpunit/tests/media.php                  |  2 +-
     .../tests/menu/wpExpandNavMenuPostData.php     | 10 +++++-----
     tests/phpunit/tests/meta.php                   |  2 +-
     tests/phpunit/tests/oembed/controller.php      |  2 +-
     tests/phpunit/tests/pomo/mo.php                |  2 +-
     tests/phpunit/tests/pomo/noopTranslations.php  |  2 +-
     tests/phpunit/tests/pomo/translations.php      |  2 +-
     tests/phpunit/tests/post.php                   |  4 ++--
     tests/phpunit/tests/post/meta.php              |  2 +-
     tests/phpunit/tests/post/types.php             |  2 +-
     tests/phpunit/tests/query.php                  |  2 +-
     tests/phpunit/tests/query/generatePostdata.php |  2 +-
     tests/phpunit/tests/query/setupPostdata.php    |  2 +-
     .../rest-api/rest-block-type-controller.php    | 12 ++++++------
     .../rest-api/rest-categories-controller.php    |  2 +-
     .../rest-api/rest-comments-controller.php      |  4 ++--
     .../tests/rest-api/rest-post-meta-fields.php   |  4 ++--
     .../rest-api/rest-post-statuses-controller.php |  8 ++++----
     .../rest-api/rest-post-types-controller.php    |  8 ++++----
     .../tests/rest-api/rest-schema-setup.php       |  2 +-
     .../tests/rest-api/rest-tags-controller.php    |  2 +-
     .../rest-api/rest-taxonomies-controller.php    |  8 ++++----
     .../tests/rest-api/rest-term-meta-fields.php   |  4 ++--
     .../tests/rest-api/rest-users-controller.php   |  4 ++--
     .../rest-api/rest-widget-types-controller.php  | 14 +++++++-------
     86 files changed, 166 insertions(+), 166 deletions(-)
    
    diff --git a/src/wp-admin/customize.php b/src/wp-admin/customize.php
    index 0df5d81ae5..cd2550c1a8 100644
    a b if ( ! empty( $autofocus ) && is_array( $autofocus ) ) { 
    9797}
    9898
    9999$registered             = $wp_scripts->registered;
    100 $wp_scripts             = new WP_Scripts;
     100$wp_scripts             = new WP_Scripts();
    101101$wp_scripts->registered = $registered;
    102102
    103103add_action( 'customize_controls_print_scripts', 'print_head_scripts', 20 );
  • src/wp-admin/includes/ajax-actions.php

    diff --git a/src/wp-admin/includes/ajax-actions.php b/src/wp-admin/includes/ajax-actions.php
    index bcc41e5465..8c8fd5ca84 100644
    a b function wp_ajax_add_menu_item() { 
    15701570                        'before'      => '',
    15711571                        'link_after'  => '',
    15721572                        'link_before' => '',
    1573                         'walker'      => new $walker_class_name,
     1573                        'walker'      => new $walker_class_name(),
    15741574                );
    15751575
    15761576                echo walk_nav_menu_tree( $menu_items, 0, (object) $args );
  • src/wp-admin/includes/bookmark.php

    diff --git a/src/wp-admin/includes/bookmark.php b/src/wp-admin/includes/bookmark.php
    index 8d26e27a5e..abb068319c 100644
    a b function edit_link( $link_id = 0 ) { 
    5959 * @return stdClass Default link object.
    6060 */
    6161function get_default_link_to_edit() {
    62         $link = new stdClass;
     62        $link = new stdClass();
    6363        if ( isset( $_GET['linkurl'] ) ) {
    6464                $link->link_url = esc_url( wp_unslash( $_GET['linkurl'] ) );
    6565        } else {
  • src/wp-admin/includes/class-language-pack-upgrader.php

    diff --git a/src/wp-admin/includes/class-language-pack-upgrader.php b/src/wp-admin/includes/class-language-pack-upgrader.php
    index 8c76b8361a..87a48b0f4f 100644
    a b class Language_Pack_Upgrader extends WP_Upgrader { 
    6262                 * Avoid messing with VCS installations, at least for now.
    6363                 * Noted: this is not the ideal way to accomplish this.
    6464                 */
    65                 $check_vcs = new WP_Automatic_Updater;
     65                $check_vcs = new WP_Automatic_Updater();
    6666                if ( $check_vcs->is_vcs_checkout( WP_CONTENT_DIR ) ) {
    6767                        return;
    6868                }
  • src/wp-admin/includes/class-wp-automatic-updater.php

    diff --git a/src/wp-admin/includes/class-wp-automatic-updater.php b/src/wp-admin/includes/class-wp-automatic-updater.php
    index 3bea5d600f..8e9b2ccc48 100644
    a b class WP_Automatic_Updater { 
    139139         */
    140140        public function should_update( $type, $item, $context ) {
    141141                // Used to see if WP_Filesystem is set up to allow unattended updates.
    142                 $skin = new Automatic_Upgrader_Skin;
     142                $skin = new Automatic_Upgrader_Skin();
    143143
    144144                if ( $this->is_disabled() ) {
    145145                        return false;
    class WP_Automatic_Updater { 
    305305         * @return null|WP_Error
    306306         */
    307307        public function update( $type, $item ) {
    308                 $skin = new Automatic_Upgrader_Skin;
     308                $skin = new Automatic_Upgrader_Skin();
    309309
    310310                switch ( $type ) {
    311311                        case 'core':
  • src/wp-admin/includes/class-wp-site-health-auto-updates.php

    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 b class WP_Site_Health_Auto_Updates { 
    280280                        require_once ABSPATH . 'wp-admin/includes/file.php';
    281281                }
    282282
    283                 $skin    = new Automatic_Upgrader_Skin;
     283                $skin    = new Automatic_Upgrader_Skin();
    284284                $success = $skin->request_filesystem_credentials( false, ABSPATH );
    285285
    286286                if ( ! $success ) {
    class WP_Site_Health_Auto_Updates { 
    313313
    314314                require ABSPATH . WPINC . '/version.php'; // $wp_version; // x.y.z
    315315
    316                 $skin    = new Automatic_Upgrader_Skin;
     316                $skin    = new Automatic_Upgrader_Skin();
    317317                $success = $skin->request_filesystem_credentials( false, ABSPATH );
    318318
    319319                if ( ! $success ) {
  • src/wp-admin/includes/image-edit.php

    diff --git a/src/wp-admin/includes/image-edit.php b/src/wp-admin/includes/image-edit.php
    index 6a72f302b4..b904a1f477 100644
    a b function wp_restore_image( $post_id ) { 
    739739        $backup_sizes     = get_post_meta( $post_id, '_wp_attachment_backup_sizes', true );
    740740        $old_backup_sizes = $backup_sizes;
    741741        $restored         = false;
    742         $msg              = new stdClass;
     742        $msg              = new stdClass();
    743743
    744744        if ( ! is_array( $backup_sizes ) ) {
    745745                $msg->error = __( 'Cannot load image metadata.' );
    function wp_restore_image( $post_id ) { 
    827827function wp_save_image( $post_id ) {
    828828        $_wp_additional_image_sizes = wp_get_additional_image_sizes();
    829829
    830         $return  = new stdClass;
     830        $return  = new stdClass();
    831831        $success = false;
    832832        $delete  = false;
    833833        $scaled  = false;
  • src/wp-admin/includes/nav-menu.php

    diff --git a/src/wp-admin/includes/nav-menu.php b/src/wp-admin/includes/nav-menu.php
    index 532940273e..027fc0fc29 100644
    a b function _wp_ajax_menu_quick_search( $request = array() ) { 
    3232        }
    3333
    3434        if ( 'markup' === $response_format ) {
    35                 $args['walker'] = new Walker_Nav_Menu_Checklist;
     35                $args['walker'] = new Walker_Nav_Menu_Checklist();
    3636        }
    3737
    3838        if ( 'get-post-item' === $type ) {
    function wp_nav_menu_item_post_type_meta_box( $data_object, $box ) { 
    429429        }
    430430
    431431        // @todo Transient caching of these results with proper invalidation on updating of a post of this type.
    432         $get_posts = new WP_Query;
     432        $get_posts = new WP_Query();
    433433        $posts     = $get_posts->query( $args );
    434434
    435435        // Only suppress and insert when more than just suppression pages available.
    436436        if ( ! $get_posts->post_count ) {
    437437                if ( ! empty( $suppress_page_ids ) ) {
    438438                        unset( $args['post__not_in'] );
    439                         $get_posts = new WP_Query;
     439                        $get_posts = new WP_Query();
    440440                        $posts     = $get_posts->query( $args );
    441441                } else {
    442442                        echo '<p>' . __( 'No items.' ) . '</p>';
    function wp_get_nav_menu_to_edit( $menu_id = 0 ) { 
    10591059                $walker_class_name = apply_filters( 'wp_edit_nav_menu_walker', 'Walker_Nav_Menu_Edit', $menu_id );
    10601060
    10611061                if ( class_exists( $walker_class_name ) ) {
    1062                         $walker = new $walker_class_name;
     1062                        $walker = new $walker_class_name();
    10631063                } else {
    10641064                        return new WP_Error(
    10651065                                'menu_walker_not_exist',
  • src/wp-admin/includes/post.php

    diff --git a/src/wp-admin/includes/post.php b/src/wp-admin/includes/post.php
    index 65b36c4836..b72134d421 100644
    a b function get_default_post_to_edit( $post_type = 'post', $create_in_db = false ) 
    716716                        wp_schedule_event( time(), 'daily', 'wp_scheduled_auto_draft_delete' );
    717717                }
    718718        } else {
    719                 $post                 = new stdClass;
     719                $post                 = new stdClass();
    720720                $post->ID             = 0;
    721721                $post->post_author    = '';
    722722                $post->post_date      = '';
  • src/wp-admin/includes/privacy-tools.php

    diff --git a/src/wp-admin/includes/privacy-tools.php b/src/wp-admin/includes/privacy-tools.php
    index f974ea8a5d..9682e94fcf 100644
    a b function wp_privacy_generate_personal_data_export_file( $request_id ) { 
    535535                wp_delete_file( $archive_pathname );
    536536        }
    537537
    538         $zip = new ZipArchive;
     538        $zip = new ZipArchive();
    539539        if ( true === $zip->open( $archive_pathname, ZipArchive::CREATE ) ) {
    540540                if ( ! $zip->addFile( $json_report_pathname, 'export.json' ) ) {
    541541                        $error = __( 'Unable to archive the personal data export file (JSON format).' );
  • src/wp-admin/includes/schema.php

    diff --git a/src/wp-admin/includes/schema.php b/src/wp-admin/includes/schema.php
    index 57ffe69054..79fb80c205 100644
    a b function populate_network( $network_id = 1, $domain = '', $email = '', $site_nam 
    10501050         * created.
    10511051         */
    10521052        if ( ! is_multisite() ) {
    1053                 $current_site            = new stdClass;
     1053                $current_site            = new stdClass();
    10541054                $current_site->domain    = $domain;
    10551055                $current_site->path      = $path;
    10561056                $current_site->site_name = ucfirst( $domain );
  • src/wp-admin/includes/template.php

    diff --git a/src/wp-admin/includes/template.php b/src/wp-admin/includes/template.php
    index ecd7e79fed..ae2d185be0 100644
    a b function wp_terms_checklist( $post_id = 0, $args = array() ) { 
    104104        $parsed_args = wp_parse_args( $params, $defaults );
    105105
    106106        if ( empty( $parsed_args['walker'] ) || ! ( $parsed_args['walker'] instanceof Walker ) ) {
    107                 $walker = new Walker_Category_Checklist;
     107                $walker = new Walker_Category_Checklist();
    108108        } else {
    109109                $walker = $parsed_args['walker'];
    110110        }
  • src/wp-admin/includes/translation-install.php

    diff --git a/src/wp-admin/includes/translation-install.php b/src/wp-admin/includes/translation-install.php
    index dc7cb89a05..01c61bbb7b 100644
    a b function wp_download_language_pack( $download ) { 
    237237        $translation = (object) $translation;
    238238
    239239        require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
    240         $skin              = new Automatic_Upgrader_Skin;
     240        $skin              = new Automatic_Upgrader_Skin();
    241241        $upgrader          = new Language_Pack_Upgrader( $skin );
    242242        $translation->type = 'core';
    243243        $result            = $upgrader->upgrade( $translation, array( 'clear_update_cache' => false ) );
    function wp_can_install_language_pack() { 
    263263        }
    264264
    265265        require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
    266         $skin     = new Automatic_Upgrader_Skin;
     266        $skin     = new Automatic_Upgrader_Skin();
    267267        $upgrader = new Language_Pack_Upgrader( $skin );
    268268        $upgrader->init();
    269269
  • src/wp-admin/includes/update-core.php

    diff --git a/src/wp-admin/includes/update-core.php b/src/wp-admin/includes/update-core.php
    index 20a7390149..c240fb0ee6 100644
    a b function update_core( $from, $to ) { 
    13951395                                        // If a error occurs partway through this final step, keep the error flowing through, but keep process going.
    13961396                                        if ( is_wp_error( $_result ) ) {
    13971397                                                if ( ! is_wp_error( $result ) ) {
    1398                                                         $result = new WP_Error;
     1398                                                        $result = new WP_Error();
    13991399                                                }
    14001400
    14011401                                                $result->add(
  • src/wp-admin/includes/update.php

    diff --git a/src/wp-admin/includes/update.php b/src/wp-admin/includes/update.php
    index 8661af75b5..530406bc28 100644
    a b function find_core_auto_update() { 
    9393        require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
    9494
    9595        $auto_update = false;
    96         $upgrader    = new WP_Automatic_Updater;
     96        $upgrader    = new WP_Automatic_Updater();
    9797        foreach ( $updates->updates as $update ) {
    9898                if ( 'autoupdate' !== $update->response ) {
    9999                        continue;
    function core_update_footer( $msg = '' ) { 
    235235
    236236        $cur = get_preferred_from_update_core();
    237237        if ( ! is_object( $cur ) ) {
    238                 $cur = new stdClass;
     238                $cur = new stdClass();
    239239        }
    240240
    241241        if ( ! isset( $cur->current ) ) {
  • src/wp-admin/includes/upgrade.php

    diff --git a/src/wp-admin/includes/upgrade.php b/src/wp-admin/includes/upgrade.php
    index 3876c70e7a..858b9adabe 100644
    a b function maybe_convert_table_to_utf8mb4( $table ) { 
    26142614 */
    26152615function get_alloptions_110() {
    26162616        global $wpdb;
    2617         $all_options = new stdClass;
     2617        $all_options = new stdClass();
    26182618        $options     = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options" );
    26192619        if ( $options ) {
    26202620                foreach ( $options as $option ) {
  • src/wp-admin/includes/user.php

    diff --git a/src/wp-admin/includes/user.php b/src/wp-admin/includes/user.php
    index 134da30514..1df2739d48 100644
    a b function add_user() { 
    2929 */
    3030function edit_user( $user_id = 0 ) {
    3131        $wp_roles = wp_roles();
    32         $user     = new stdClass;
     32        $user     = new stdClass();
    3333        $user_id  = (int) $user_id;
    3434        if ( $user_id ) {
    3535                $update           = true;
  • src/wp-admin/user-edit.php

    diff --git a/src/wp-admin/user-edit.php b/src/wp-admin/user-edit.php
    index 681c7354f8..edcdfb1ac5 100644
    a b if ( is_multisite() 
    104104if ( IS_PROFILE_PAGE && isset( $_GET['newuseremail'] ) && $current_user->ID ) {
    105105        $new_email = get_user_meta( $current_user->ID, '_new_email', true );
    106106        if ( $new_email && hash_equals( $new_email['hash'], $_GET['newuseremail'] ) ) {
    107                 $user             = new stdClass;
     107                $user             = new stdClass();
    108108                $user->ID         = $current_user->ID;
    109109                $user->user_email = esc_html( trim( $new_email['newemail'] ) );
    110110                if ( is_multisite() && $wpdb->get_var( $wpdb->prepare( "SELECT user_login FROM {$wpdb->signups} WHERE user_login = %s", $current_user->user_login ) ) ) {
  • src/wp-includes/admin-bar.php

    diff --git a/src/wp-includes/admin-bar.php b/src/wp-includes/admin-bar.php
    index 9084a63cc3..4a5d604a1b 100644
    a b function _wp_admin_bar_init() { 
    4141         */
    4242        $admin_bar_class = apply_filters( 'wp_admin_bar_class', 'WP_Admin_Bar' );
    4343        if ( class_exists( $admin_bar_class ) ) {
    44                 $wp_admin_bar = new $admin_bar_class;
     44                $wp_admin_bar = new $admin_bar_class();
    4545        } else {
    4646                return false;
    4747        }
  • src/wp-includes/capabilities.php

    diff --git a/src/wp-includes/capabilities.php b/src/wp-includes/capabilities.php
    index d06887a2bb..2b16174666 100644
    a b function user_can( $user, $capability, ...$args ) { 
    975975        if ( empty( $user ) ) {
    976976                // User is logged out, create anonymous user object.
    977977                $user = new WP_User( 0 );
    978                 $user->init( new stdClass );
     978                $user->init( new stdClass() );
    979979        }
    980980
    981981        return $user->has_cap( $capability, ...$args );
  • src/wp-includes/category-template.php

    diff --git a/src/wp-includes/category-template.php b/src/wp-includes/category-template.php
    index dc0dfe7ef0..b35c17170d 100644
    a b function _wp_object_count_sort_cb( $a, $b ) { 
    11101110function walk_category_tree( ...$args ) {
    11111111        // The user's options are the third parameter.
    11121112        if ( empty( $args[2]['walker'] ) || ! ( $args[2]['walker'] instanceof Walker ) ) {
    1113                 $walker = new Walker_Category;
     1113                $walker = new Walker_Category();
    11141114        } else {
    11151115                /**
    11161116                 * @var Walker $walker
    function walk_category_tree( ...$args ) { 
    11361136function walk_category_dropdown_tree( ...$args ) {
    11371137        // The user's options are the third parameter.
    11381138        if ( empty( $args[2]['walker'] ) || ! ( $args[2]['walker'] instanceof Walker ) ) {
    1139                 $walker = new Walker_CategoryDropdown;
     1139                $walker = new Walker_CategoryDropdown();
    11401140        } else {
    11411141                /**
    11421142                 * @var Walker $walker
  • src/wp-includes/class-wp-admin-bar.php

    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 b class WP_Admin_Bar { 
    4141         * @since 3.1.0
    4242         */
    4343        public function initialize() {
    44                 $this->user = new stdClass;
     44                $this->user = new stdClass();
    4545
    4646                if ( is_user_logged_in() ) {
    4747                        /* Populate settings we need for the menu based on the current user. */
  • src/wp-includes/class-wp-editor.php

    diff --git a/src/wp-includes/class-wp-editor.php b/src/wp-includes/class-wp-editor.php
    index 41f379a838..16805f7a16 100644
    a b final class _WP_Editors { 
    17991799                $query = apply_filters( 'wp_link_query_args', $query );
    18001800
    18011801                // Do main query.
    1802                 $get_posts = new WP_Query;
     1802                $get_posts = new WP_Query();
    18031803                $posts     = $get_posts->query( $query );
    18041804
    18051805                // Build results.
  • src/wp-includes/class-wp-http.php

    diff --git a/src/wp-includes/class-wp-http.php b/src/wp-includes/class-wp-http.php
    index 6c997272b6..aff4ae5617 100644
    a b class WP_Http { 
    581581
    582582                // Transport claims to support request, instantiate it and give it a whirl.
    583583                if ( empty( $transports[ $class ] ) ) {
    584                         $transports[ $class ] = new $class;
     584                        $transports[ $class ] = new $class();
    585585                }
    586586
    587587                $response = $transports[ $class ]->request( $url, $args );
  • src/wp-includes/class-wp-oembed.php

    diff --git a/src/wp-includes/class-wp-oembed.php b/src/wp-includes/class-wp-oembed.php
    index 8b24cf752b..e177223435 100644
    a b class WP_oEmbed { 
    639639                        return false;
    640640                }
    641641
    642                 $dom     = new DOMDocument;
     642                $dom     = new DOMDocument();
    643643                $success = $dom->loadXML( $response_body );
    644644                if ( ! $success ) {
    645645                        return false;
    class WP_oEmbed { 
    660660                        return false;
    661661                }
    662662
    663                 $return = new stdClass;
     663                $return = new stdClass();
    664664                foreach ( $xml as $key => $value ) {
    665665                        $return->$key = (string) $value;
    666666                }
  • src/wp-includes/class-wp-text-diff-renderer-table.php

    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 9f85d932e8..e093c698b7 100644
    a b class WP_Text_Diff_Renderer_Table extends Text_Diff_Renderer { 
    268268                foreach ( $orig_matches as $o => $f ) {
    269269                        if ( is_numeric( $o ) && is_numeric( $f ) ) {
    270270                                $text_diff = new Text_Diff( 'auto', array( array( $orig[ $o ] ), array( $final[ $f ] ) ) );
    271                                 $renderer  = new $this->inline_diff_renderer;
     271                                $renderer  = new $this->inline_diff_renderer();
    272272                                $diff      = $renderer->render( $text_diff );
    273273
    274274                                // If they're too different, don't include any <ins> or <del>'s.
  • src/wp-includes/class-wp-user.php

    diff --git a/src/wp-includes/class-wp-user.php b/src/wp-includes/class-wp-user.php
    index b190960009..ecfa1a5920 100644
    a b class WP_User { 
    156156                if ( $data ) {
    157157                        $this->init( $data, $site_id );
    158158                } else {
    159                         $this->data = new stdClass;
     159                        $this->data = new stdClass();
    160160                }
    161161        }
    162162
  • src/wp-includes/comment-template.php

    diff --git a/src/wp-includes/comment-template.php b/src/wp-includes/comment-template.php
    index a89a081531..780b77a436 100644
    a b function wp_list_comments( $args = array(), $comments = null ) { 
    22382238        wp_queue_comments_for_comment_meta_lazyload( $_comments );
    22392239
    22402240        if ( empty( $parsed_args['walker'] ) ) {
    2241                 $walker = new Walker_Comment;
     2241                $walker = new Walker_Comment();
    22422242        } else {
    22432243                $walker = $parsed_args['walker'];
    22442244        }
  • src/wp-includes/comment.php

    diff --git a/src/wp-includes/comment.php b/src/wp-includes/comment.php
    index 6b04b01517..a92cb2ce42 100644
    a b function get_approved_comments( $post_id, $args = array() ) { 
    171171        );
    172172        $parsed_args = wp_parse_args( $args, $defaults );
    173173
    174         $query = new WP_Comment_Query;
     174        $query = new WP_Comment_Query();
    175175        return $query->query( $parsed_args );
    176176}
    177177
    function get_comment( $comment = null, $output = OBJECT ) { 
    240240 * @return WP_Comment[]|int[]|int List of comments or number of found comments if `$count` argument is true.
    241241 */
    242242function get_comments( $args = '' ) {
    243         $query = new WP_Comment_Query;
     243        $query = new WP_Comment_Query();
    244244        return $query->query( $args );
    245245}
    246246
    function get_comment_pages_count( $comments = null, $per_page = null, $threaded 
    10231023        }
    10241024
    10251025        if ( $threaded ) {
    1026                 $walker = new Walker_Comment;
     1026                $walker = new Walker_Comment();
    10271027                $count  = ceil( $walker->get_number_of_root_elements( $comments ) / $per_page );
    10281028        } else {
    10291029                $count = ceil( count( $comments ) / $per_page );
  • src/wp-includes/functions.php

    diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php
    index 77d84ae63d..330a4f4f80 100644
    a b function _wp_json_sanity_check( $data, $depth ) { 
    43024302                        }
    43034303                }
    43044304        } elseif ( is_object( $data ) ) {
    4305                 $output = new stdClass;
     4305                $output = new stdClass();
    43064306                foreach ( $data as $id => $el ) {
    43074307                        if ( is_string( $id ) ) {
    43084308                                $clean_id = _wp_json_convert_string( $id );
  • src/wp-includes/l10n.php

    diff --git a/src/wp-includes/l10n.php b/src/wp-includes/l10n.php
    index 40c653fdbe..d7642c7038 100644
    a b function get_translations_for_domain( $domain ) { 
    13061306
    13071307        static $noop_translations = null;
    13081308        if ( null === $noop_translations ) {
    1309                 $noop_translations = new NOOP_Translations;
     1309                $noop_translations = new NOOP_Translations();
    13101310        }
    13111311
    13121312        return $noop_translations;
  • src/wp-includes/ms-load.php

    diff --git a/src/wp-includes/ms-load.php b/src/wp-includes/ms-load.php
    index 35942df0f8..c7f74167f4 100644
    a b function ms_load_current_site_and_network( $domain, $path, $subdomain = false ) 
    297297
    298298        // If the network is defined in wp-config.php, we can simply use that.
    299299        if ( defined( 'DOMAIN_CURRENT_SITE' ) && defined( 'PATH_CURRENT_SITE' ) ) {
    300                 $current_site         = new stdClass;
     300                $current_site         = new stdClass();
    301301                $current_site->id     = defined( 'SITE_ID_CURRENT_SITE' ) ? SITE_ID_CURRENT_SITE : 1;
    302302                $current_site->domain = DOMAIN_CURRENT_SITE;
    303303                $current_site->path   = PATH_CURRENT_SITE;
    function ms_load_current_site_and_network( $domain, $path, $subdomain = false ) 
    387387
    388388        // During activation of a new subdomain, the requested site does not yet exist.
    389389        if ( empty( $current_blog ) && wp_installing() ) {
    390                 $current_blog          = new stdClass;
     390                $current_blog          = new stdClass();
    391391                $current_blog->blog_id = 1;
    392392                $blog_id               = 1;
    393393                $current_blog->public  = 1;
  • src/wp-includes/nav-menu-template.php

    diff --git a/src/wp-includes/nav-menu-template.php b/src/wp-includes/nav-menu-template.php
    index 0673bf36ed..893727c44c 100644
    a b function _wp_menu_item_classes_by_context( &$menu_items ) { 
    617617 * @return string The HTML list content for the menu items.
    618618 */
    619619function walk_nav_menu_tree( $items, $depth, $args ) {
    620         $walker = ( empty( $args->walker ) ) ? new Walker_Nav_Menu : $args->walker;
     620        $walker = ( empty( $args->walker ) ) ? new Walker_Nav_Menu() : $args->walker;
    621621
    622622        return $walker->walk( $items, $depth, $args );
    623623}
  • src/wp-includes/nav-menu.php

    diff --git a/src/wp-includes/nav-menu.php b/src/wp-includes/nav-menu.php
    index 3ef281f643..87b51182e3 100644
    a b function wp_get_associated_nav_menu_items( $object_id = 0, $object_type = 'post_ 
    10101010        $object_id     = (int) $object_id;
    10111011        $menu_item_ids = array();
    10121012
    1013         $query      = new WP_Query;
     1013        $query      = new WP_Query();
    10141014        $menu_items = $query->query(
    10151015                array(
    10161016                        'meta_key'       => '_menu_item_object_id',
  • src/wp-includes/pluggable.php

    diff --git a/src/wp-includes/pluggable.php b/src/wp-includes/pluggable.php
    index 013e0632a8..7ed917001b 100644
    a b if ( ! function_exists( 'get_user_by' ) ) : 
    105105                        return false;
    106106                }
    107107
    108                 $user = new WP_User;
     108                $user = new WP_User();
    109109                $user->init( $userdata );
    110110
    111111                return $user;
  • src/wp-includes/post-template.php

    diff --git a/src/wp-includes/post-template.php b/src/wp-includes/post-template.php
    index 03178a3dd5..3ce819c2b0 100644
    a b function wp_page_menu( $args = array() ) { 
    15461546 */
    15471547function walk_page_tree( $pages, $depth, $current_page, $args ) {
    15481548        if ( empty( $args['walker'] ) ) {
    1549                 $walker = new Walker_Page;
     1549                $walker = new Walker_Page();
    15501550        } else {
    15511551                /**
    15521552                 * @var Walker $walker
    function walk_page_tree( $pages, $depth, $current_page, $args ) { 
    15781578 */
    15791579function walk_page_dropdown_tree( ...$args ) {
    15801580        if ( empty( $args[2]['walker'] ) ) { // The user's options are the third parameter.
    1581                 $walker = new Walker_PageDropdown;
     1581                $walker = new Walker_PageDropdown();
    15821582        } else {
    15831583                /**
    15841584                 * @var Walker $walker
  • src/wp-includes/post.php

    diff --git a/src/wp-includes/post.php b/src/wp-includes/post.php
    index 62a54dc15b..9629e2df02 100644
    a b function get_posts( $args = null ) { 
    24102410        $parsed_args['ignore_sticky_posts'] = true;
    24112411        $parsed_args['no_found_rows']       = true;
    24122412
    2413         $get_posts = new WP_Query;
     2413        $get_posts = new WP_Query();
    24142414        return $get_posts->query( $parsed_args );
    24152415}
    24162416
    function wp_count_posts( $type = 'post', $perm = '' ) { 
    30123012        global $wpdb;
    30133013
    30143014        if ( ! post_type_exists( $type ) ) {
    3015                 return new stdClass;
     3015                return new stdClass();
    30163016        }
    30173017
    30183018        $cache_key = _count_posts_cache_key( $type, $perm );
  • src/wp-includes/rest-api.php

    diff --git a/src/wp-includes/rest-api.php b/src/wp-includes/rest-api.php
    index b611745ebd..3953b74392 100644
    a b function create_initial_rest_routes() { 
    255255        }
    256256
    257257        // Post types.
    258         $controller = new WP_REST_Post_Types_Controller;
     258        $controller = new WP_REST_Post_Types_Controller();
    259259        $controller->register_routes();
    260260
    261261        // Post statuses.
    262         $controller = new WP_REST_Post_Statuses_Controller;
     262        $controller = new WP_REST_Post_Statuses_Controller();
    263263        $controller->register_routes();
    264264
    265265        // Taxonomies.
    266         $controller = new WP_REST_Taxonomies_Controller;
     266        $controller = new WP_REST_Taxonomies_Controller();
    267267        $controller->register_routes();
    268268
    269269        // Terms.
    function create_initial_rest_routes() { 
    278278        }
    279279
    280280        // Users.
    281         $controller = new WP_REST_Users_Controller;
     281        $controller = new WP_REST_Users_Controller();
    282282        $controller->register_routes();
    283283
    284284        // Application Passwords
    function create_initial_rest_routes() { 
    286286        $controller->register_routes();
    287287
    288288        // Comments.
    289         $controller = new WP_REST_Comments_Controller;
     289        $controller = new WP_REST_Comments_Controller();
    290290        $controller->register_routes();
    291291
    292292        $search_handlers = array(
    function create_initial_rest_routes() { 
    318318        $controller->register_routes();
    319319
    320320        // Global Styles.
    321         $controller = new WP_REST_Global_Styles_Controller;
     321        $controller = new WP_REST_Global_Styles_Controller();
    322322        $controller->register_routes();
    323323
    324324        // Settings.
    325         $controller = new WP_REST_Settings_Controller;
     325        $controller = new WP_REST_Settings_Controller();
    326326        $controller->register_routes();
    327327
    328328        // Themes.
    329         $controller = new WP_REST_Themes_Controller;
     329        $controller = new WP_REST_Themes_Controller();
    330330        $controller->register_routes();
    331331
    332332        // Plugins.
    function rest_get_server() { 
    562562                 * @param string $class_name The name of the server class. Default 'WP_REST_Server'.
    563563                 */
    564564                $wp_rest_server_class = apply_filters( 'wp_rest_server_class', 'WP_REST_Server' );
    565                 $wp_rest_server       = new $wp_rest_server_class;
     565                $wp_rest_server       = new $wp_rest_server_class();
    566566
    567567                /**
    568568                 * Fires when preparing to serve a REST API request.
  • src/wp-includes/rest-api/class-wp-rest-response.php

    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 b class WP_REST_Response extends WP_HTTP_Response { 
    227227                        return null;
    228228                }
    229229
    230                 $error = new WP_Error;
     230                $error = new WP_Error();
    231231
    232232                if ( is_array( $this->get_data() ) ) {
    233233                        $data = $this->get_data();
  • src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php

    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 b class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller { 
    766766
    767767                        // Ensure empty details is an empty object.
    768768                        if ( empty( $data['media_details'] ) ) {
    769                                 $data['media_details'] = new stdClass;
     769                                $data['media_details'] = new stdClass();
    770770                        } elseif ( ! empty( $data['media_details']['sizes'] ) ) {
    771771
    772772                                foreach ( $data['media_details']['sizes'] as $size => &$size_data ) {
    class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller { 
    797797                                        );
    798798                                }
    799799                        } else {
    800                                 $data['media_details']['sizes'] = new stdClass;
     800                                $data['media_details']['sizes'] = new stdClass();
    801801                        }
    802802                }
    803803
  • src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php

    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 b class WP_REST_Comments_Controller extends WP_REST_Controller { 
    274274                 */
    275275                $prepared_args = apply_filters( 'rest_comment_query', $prepared_args, $request );
    276276
    277                 $query        = new WP_Comment_Query;
     277                $query        = new WP_Comment_Query();
    278278                $query_result = $query->query( $prepared_args );
    279279
    280280                $comments = array();
    class WP_REST_Comments_Controller extends WP_REST_Controller { 
    295295                        // Out-of-bounds, run the query again without LIMIT for total count.
    296296                        unset( $prepared_args['number'], $prepared_args['offset'] );
    297297
    298                         $query                  = new WP_Comment_Query;
     298                        $query                  = new WP_Comment_Query();
    299299                        $prepared_args['count'] = true;
    300300
    301301                        $total_comments = $query->query( $prepared_args );
  • src/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php

    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 b class WP_REST_Terms_Controller extends WP_REST_Controller { 
    807807         * @return object Term object.
    808808         */
    809809        public function prepare_item_for_database( $request ) {
    810                 $prepared_term = new stdClass;
     810                $prepared_term = new stdClass();
    811811
    812812                $schema = $this->get_item_schema();
    813813                if ( isset( $request['name'] ) && ! empty( $schema['properties']['name'] ) ) {
  • src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php

    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 b class WP_REST_Users_Controller extends WP_REST_Controller { 
    11211121         * @return object User object.
    11221122         */
    11231123        protected function prepare_item_for_database( $request ) {
    1124                 $prepared_user = new stdClass;
     1124                $prepared_user = new stdClass();
    11251125
    11261126                $schema = $this->get_item_schema();
    11271127
  • src/wp-includes/rest-api/endpoints/class-wp-rest-widget-types-controller.php

    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 b class WP_REST_Widget_Types_Controller extends WP_REST_Controller { 
    529529
    530530                if ( ! empty( $widget_object->widget_options['show_instance_in_rest'] ) ) {
    531531                        // Use new stdClass so that JSON result is {} and not [].
    532                         $response['instance']['raw'] = empty( $instance ) ? new stdClass : $instance;
     532                        $response['instance']['raw'] = empty( $instance ) ? new stdClass() : $instance;
    533533                }
    534534
    535535                return rest_ensure_response( $response );
  • src/wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php

    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 b class WP_REST_Widgets_Controller extends WP_REST_Controller { 
    715715
    716716                                if ( ! empty( $widget_object->widget_options['show_instance_in_rest'] ) ) {
    717717                                        // Use new stdClass so that JSON result is {} and not [].
    718                                         $prepared['instance']['raw'] = empty( $instance ) ? new stdClass : $instance;
     718                                        $prepared['instance']['raw'] = empty( $instance ) ? new stdClass() : $instance;
    719719                                }
    720720                        }
    721721                }
  • src/wp-includes/theme.php

    diff --git a/src/wp-includes/theme.php b/src/wp-includes/theme.php
    index 61d5c13284..47fe9cb162 100644
    a b function _get_random_header_data() { 
    13311331                }
    13321332
    13331333                if ( empty( $headers ) ) {
    1334                         return new stdClass;
     1334                        return new stdClass();
    13351335                }
    13361336
    13371337                $_wp_random_header = (object) $headers[ array_rand( $headers ) ];
  • src/wp-includes/update.php

    diff --git a/src/wp-includes/update.php b/src/wp-includes/update.php
    index f352cab7c2..5136912037 100644
    a b function wp_version_check( $extra_stats = array(), $force_check = false ) { 
    4444        }
    4545
    4646        if ( ! is_object( $current ) ) {
    47                 $current                  = new stdClass;
     47                $current                  = new stdClass();
    4848                $current->updates         = array();
    4949                $current->version_checked = $wp_version;
    5050        }
    function wp_update_plugins( $extra_stats = array() ) { 
    327327        $current = get_site_transient( 'update_plugins' );
    328328
    329329        if ( ! is_object( $current ) ) {
    330                 $current = new stdClass;
     330                $current = new stdClass();
    331331        }
    332332
    333         $updates               = new stdClass;
     333        $updates               = new stdClass();
    334334        $updates->last_checked = time();
    335335        $updates->response     = array();
    336336        $updates->translations = array();
    function wp_update_themes( $extra_stats = array() ) { 
    595595        $last_update = get_site_transient( 'update_themes' );
    596596
    597597        if ( ! is_object( $last_update ) ) {
    598                 $last_update = new stdClass;
     598                $last_update = new stdClass();
    599599        }
    600600
    601601        $themes  = array();
    function wp_update_themes( $extra_stats = array() ) { 
    734734                return;
    735735        }
    736736
    737         $new_update               = new stdClass;
     737        $new_update               = new stdClass();
    738738        $new_update->last_checked = time();
    739739        $new_update->checked      = $checked;
    740740
    function wp_maybe_auto_update() { 
    846846        include_once ABSPATH . 'wp-admin/includes/admin.php';
    847847        require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
    848848
    849         $upgrader = new WP_Automatic_Updater;
     849        $upgrader = new WP_Automatic_Updater();
    850850        $upgrader->run();
    851851}
    852852
  • src/wp-includes/user.php

    diff --git a/src/wp-includes/user.php b/src/wp-includes/user.php
    index 2d88f87e26..073101bb20 100644
    a b function get_blogs_of_user( $user_id, $all = false ) { 
    951951
    952952        if ( ! is_multisite() ) {
    953953                $site_id                        = get_current_blog_id();
    954                 $sites                          = array( $site_id => new stdClass );
     954                $sites                          = array( $site_id => new stdClass() );
    955955                $sites[ $site_id ]->userblog_id = $site_id;
    956956                $sites[ $site_id ]->blogname    = get_option( 'blogname' );
    957957                $sites[ $site_id ]->domain      = '';
  • src/xmlrpc.php

    diff --git a/src/xmlrpc.php b/src/xmlrpc.php
    index ecac4c7c7a..3f35815525 100644
    a b $post_default_title = ''; 
    8181 * @param string $class The name of the XML-RPC server class.
    8282 */
    8383$wp_xmlrpc_server_class = apply_filters( 'wp_xmlrpc_server_class', 'wp_xmlrpc_server' );
    84 $wp_xmlrpc_server       = new $wp_xmlrpc_server_class;
     84$wp_xmlrpc_server       = new $wp_xmlrpc_server_class();
    8585
    8686// Fire off the request.
    8787$wp_xmlrpc_server->serve_request();
  • tests/phpunit/includes/testcase-rest-controller.php

    diff --git a/tests/phpunit/includes/testcase-rest-controller.php b/tests/phpunit/includes/testcase-rest-controller.php
    index 67a7970b66..9a4c2a0b61 100644
    a b abstract class WP_Test_REST_Controller_Testcase extends WP_Test_REST_TestCase { 
    99                add_filter( 'rest_url', array( $this, 'filter_rest_url_for_leading_slash' ), 10, 2 );
    1010                /** @var WP_REST_Server $wp_rest_server */
    1111                global $wp_rest_server;
    12                 $wp_rest_server = new Spy_REST_Server;
     12                $wp_rest_server = new Spy_REST_Server();
    1313                do_action( 'rest_api_init', $wp_rest_server );
    1414        }
    1515
  • tests/phpunit/tests/adminbar.php

    diff --git a/tests/phpunit/tests/adminbar.php b/tests/phpunit/tests/adminbar.php
    index 228063e911..cec80d0cae 100644
    a b class Tests_AdminBar extends WP_UnitTestCase { 
    3737
    3838                register_post_type( 'content', array( 'show_in_admin_bar' => true ) );
    3939
    40                 $admin_bar = new WP_Admin_Bar;
     40                $admin_bar = new WP_Admin_Bar();
    4141
    4242                wp_admin_bar_new_content_menu( $admin_bar );
    4343
    class Tests_AdminBar extends WP_UnitTestCase { 
    5454        public function test_merging_existing_meta_values() {
    5555                wp_set_current_user( self::$editor_id );
    5656
    57                 $admin_bar = new WP_Admin_Bar;
     57                $admin_bar = new WP_Admin_Bar();
    5858
    5959                $admin_bar->add_node(
    6060                        array(
  • tests/phpunit/tests/blocks/editor.php

    diff --git a/tests/phpunit/tests/blocks/editor.php b/tests/phpunit/tests/blocks/editor.php
    index 076b3026fa..e3a4fdccfc 100644
    a b class Tests_Blocks_Editor extends WP_UnitTestCase { 
    3131                $post = self::factory()->post->create_and_get( $args );
    3232
    3333                global $wp_rest_server;
    34                 $wp_rest_server = new Spy_REST_Server;
     34                $wp_rest_server = new Spy_REST_Server();
    3535                do_action( 'rest_api_init', $wp_rest_server );
    3636        }
    3737
  • tests/phpunit/tests/cache.php

    diff --git a/tests/phpunit/tests/cache.php b/tests/phpunit/tests/cache.php
    index f65096c597..faf64de5a0 100644
    a b class Tests_Cache extends WP_UnitTestCase { 
    230230        // Make sure objects are cloned going to and from the cache.
    231231        public function test_object_refs() {
    232232                $key           = __FUNCTION__ . '_1';
    233                 $object_a      = new stdClass;
     233                $object_a      = new stdClass();
    234234                $object_a->foo = 'alpha';
    235235                $this->cache->set( $key, $object_a );
    236236                $object_a->foo = 'bravo';
    class Tests_Cache extends WP_UnitTestCase { 
    240240                $this->assertSame( 'bravo', $object_a->foo );
    241241
    242242                $key           = __FUNCTION__ . '_2';
    243                 $object_a      = new stdClass;
     243                $object_a      = new stdClass();
    244244                $object_a->foo = 'alpha';
    245245                $this->cache->add( $key, $object_a );
    246246                $object_a->foo = 'bravo';
  • tests/phpunit/tests/dependencies.php

    diff --git a/tests/phpunit/tests/dependencies.php b/tests/phpunit/tests/dependencies.php
    index 5f07f6b5f0..91971beb88 100644
    a b  
    55 */
    66class Tests_Dependencies extends WP_UnitTestCase {
    77        public function test_add() {
    8                 $dep = new WP_Dependencies;
     8                $dep = new WP_Dependencies();
    99
    1010                $this->assertTrue( $dep->add( 'one', '' ) );
    1111                $this->assertTrue( $dep->add( 'two', '' ) );
    class Tests_Dependencies extends WP_UnitTestCase { 
    1818        }
    1919
    2020        public function test_remove() {
    21                 $dep = new WP_Dependencies;
     21                $dep = new WP_Dependencies();
    2222
    2323                $this->assertTrue( $dep->add( 'one', '' ) );
    2424                $this->assertTrue( $dep->add( 'two', '' ) );
    class Tests_Dependencies extends WP_UnitTestCase { 
    3030        }
    3131
    3232        public function test_enqueue() {
    33                 $dep = new WP_Dependencies;
     33                $dep = new WP_Dependencies();
    3434
    3535                $this->assertTrue( $dep->add( 'one', '' ) );
    3636                $this->assertTrue( $dep->add( 'two', '' ) );
    class Tests_Dependencies extends WP_UnitTestCase { 
    4646        }
    4747
    4848        public function test_dequeue() {
    49                 $dep = new WP_Dependencies;
     49                $dep = new WP_Dependencies();
    5050
    5151                $this->assertTrue( $dep->add( 'one', '' ) );
    5252                $this->assertTrue( $dep->add( 'two', '' ) );
    class Tests_Dependencies extends WP_UnitTestCase { 
    6666        }
    6767
    6868        public function test_enqueue_args() {
    69                 $dep = new WP_Dependencies;
     69                $dep = new WP_Dependencies();
    7070
    7171                $this->assertTrue( $dep->add( 'one', '' ) );
    7272                $this->assertTrue( $dep->add( 'two', '' ) );
    class Tests_Dependencies extends WP_UnitTestCase { 
    8484        }
    8585
    8686        public function test_dequeue_args() {
    87                 $dep = new WP_Dependencies;
     87                $dep = new WP_Dependencies();
    8888
    8989                $this->assertTrue( $dep->add( 'one', '' ) );
    9090                $this->assertTrue( $dep->add( 'two', '' ) );
    class Tests_Dependencies extends WP_UnitTestCase { 
    111111         * @ticket 21741
    112112         */
    113113        public function test_query_and_registered_enqueued() {
    114                 $dep = new WP_Dependencies;
     114                $dep = new WP_Dependencies();
    115115
    116116                $this->assertTrue( $dep->add( 'one', '' ) );
    117117                $this->assertInstanceOf( '_WP_Dependency', $dep->query( 'one' ) );
    class Tests_Dependencies extends WP_UnitTestCase { 
    136136        }
    137137
    138138        function test_enqueue_before_register() {
    139                 $dep = new WP_Dependencies;
     139                $dep = new WP_Dependencies();
    140140
    141141                $this->assertArrayNotHasKey( 'one', $dep->registered );
    142142
  • tests/phpunit/tests/dependencies/jquery.php

    diff --git a/tests/phpunit/tests/dependencies/jquery.php b/tests/phpunit/tests/dependencies/jquery.php
    index 62243fe581..aa44b0047a 100644
    a b class Tests_Dependencies_jQuery extends WP_UnitTestCase { 
    1010         * @covers WP_Scripts::query
    1111         */
    1212        public function test_location_of_jquery() {
    13                 $scripts = new WP_Scripts;
     13                $scripts = new WP_Scripts();
    1414                wp_default_scripts( $scripts );
    1515
    1616                if ( SCRIPT_DEBUG ) {
    class Tests_Dependencies_jQuery extends WP_UnitTestCase { 
    106106         * @covers WP_Scripts::do_items
    107107         */
    108108        public function test_jquery_in_footer() {
    109                 $scripts = new WP_Scripts;
     109                $scripts = new WP_Scripts();
    110110                $scripts->add( 'jquery', false, array( 'jquery-core', 'jquery-migrate' ) );
    111111                $scripts->add( 'jquery-core', '/jquery.js', array() );
    112112                $scripts->add( 'jquery-migrate', '/jquery-migrate.js', array() );
  • tests/phpunit/tests/dependencies/scripts.php

    diff --git a/tests/phpunit/tests/dependencies/scripts.php b/tests/phpunit/tests/dependencies/scripts.php
    index b64edfeff9..3897c6aa25 100644
    a b JS; 
    276276         * @covers WP_Dependencies::do_items
    277277         */
    278278        public function test_group_mismatch_in_deps() {
    279                 $scripts = new WP_Scripts;
     279                $scripts = new WP_Scripts();
    280280                $scripts->add( 'one', 'one', array(), 'v1', 1 );
    281281                $scripts->add( 'two', 'two', array( 'one' ) );
    282282                $scripts->add( 'three', 'three', array( 'two' ), 'v1', 1 );
    JS; 
    295295                $this->assertContains( 'two', $scripts->done );
    296296                $this->assertContains( 'three', $scripts->done );
    297297
    298                 $scripts = new WP_Scripts;
     298                $scripts = new WP_Scripts();
    299299                $scripts->add( 'one', 'one', array(), 'v1', 1 );
    300300                $scripts->add( 'two', 'two', array( 'one' ), 'v1', 1 );
    301301                $scripts->add( 'three', 'three', array( 'one' ) );
  • tests/phpunit/tests/formatting/sanitizeTextField.php

    diff --git a/tests/phpunit/tests/formatting/sanitizeTextField.php b/tests/phpunit/tests/formatting/sanitizeTextField.php
    index 3dac60c465..f3e88fe755 100644
    a b class Tests_Formatting_SanitizeTextField extends WP_UnitTestCase { 
    105105                                '',
    106106                        ),
    107107                        array(
    108                                 new WP_Query,
     108                                new WP_Query(),
    109109                                '',
    110110                        ),
    111111                        array(
  • tests/phpunit/tests/formatting/stripslashesDeep.php

    diff --git a/tests/phpunit/tests/formatting/stripslashesDeep.php b/tests/phpunit/tests/formatting/stripslashesDeep.php
    index 76f9e8b019..ea2c913954 100644
    a b class Tests_Formatting_StripslashesDeep extends WP_UnitTestCase { 
    2626                $this->assertSame( $arr, stripslashes_deep( $arr ) ); // Keyed array.
    2727                $this->assertSame( array_values( $arr ), stripslashes_deep( array_values( $arr ) ) ); // Non-keyed.
    2828
    29                 $obj = new stdClass;
     29                $obj = new stdClass();
    3030                foreach ( $arr as $k => $v ) {
    3131                        $obj->$k = $v;
    3232                }
    class Tests_Formatting_StripslashesDeep extends WP_UnitTestCase { 
    4141                $this->assertSame( array( 'a' => $new ), stripslashes_deep( array( 'a' => $old ) ) ); // Keyed array.
    4242                $this->assertSame( array( $new ), stripslashes_deep( array( $old ) ) ); // Non-keyed.
    4343
    44                 $obj_old    = new stdClass;
     44                $obj_old    = new stdClass();
    4545                $obj_old->a = $old;
    46                 $obj_new    = new stdClass;
     46                $obj_new    = new stdClass();
    4747                $obj_new->a = $new;
    4848                $this->assertEquals( $obj_new, stripslashes_deep( $obj_old ) );
    4949        }
  • tests/phpunit/tests/formatting/wpSlash.php

    diff --git a/tests/phpunit/tests/formatting/wpSlash.php b/tests/phpunit/tests/formatting/wpSlash.php
    index 39a7c32a01..a1ac591c7a 100644
    a b class Tests_Formatting_wpSlash extends WP_UnitTestCase { 
    8484                $this->assertSame( $arr, wp_slash( $arr ) ); // Keyed array.
    8585                $this->assertSame( array_values( $arr ), wp_slash( array_values( $arr ) ) ); // Non-keyed.
    8686
    87                 $obj = new stdClass;
     87                $obj = new stdClass();
    8888                foreach ( $arr as $k => $v ) {
    8989                        $obj->$k = $v;
    9090                }
  • tests/phpunit/tests/functions.php

    diff --git a/tests/phpunit/tests/functions.php b/tests/phpunit/tests/functions.php
    index 7f855e110f..42d70fd774 100644
    a b  
    55 */
    66class Tests_Functions extends WP_UnitTestCase {
    77        public function test_wp_parse_args_object() {
    8                 $x        = new MockClass;
     8                $x        = new MockClass();
    99                $x->_baba = 5;
    1010                $x->yZ    = 'baba'; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
    1111                $x->a     = array( 5, 111, 'x' );
    class Tests_Functions extends WP_UnitTestCase { 
    1717                        ),
    1818                        wp_parse_args( $x )
    1919                );
    20                 $y = new MockClass;
     20                $y = new MockClass();
    2121                $this->assertSame( array(), wp_parse_args( $y ) );
    2222        }
    2323
    class Tests_Functions extends WP_UnitTestCase { 
    4141        }
    4242
    4343        public function test_wp_parse_args_defaults() {
    44                 $x        = new MockClass;
     44                $x        = new MockClass();
    4545                $x->_baba = 5;
    4646                $x->yZ    = 'baba'; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
    4747                $x->a     = array( 5, 111, 'x' );
    class Tests_Functions extends WP_UnitTestCase { 
    11131113         * @ticket 28786
    11141114         */
    11151115        public function test_wp_json_encode_object() {
    1116                 $object    = new stdClass;
     1116                $object    = new stdClass();
    11171117                $object->a = 'b';
    11181118                $this->assertSame( wp_json_encode( $object ), '{"a":"b"}' );
    11191119        }
  • tests/phpunit/tests/import/parser.php

    diff --git a/tests/phpunit/tests/import/parser.php b/tests/phpunit/tests/import/parser.php
    index 2c05bb8f35..f302cefa29 100644
    a b class Tests_Import_Parser extends WP_Import_UnitTestCase { 
    3333
    3434                // Regex based parser cannot detect malformed XML.
    3535                foreach ( array( 'WXR_Parser_SimpleXML', 'WXR_Parser_XML' ) as $p ) {
    36                         $parser = new $p;
     36                        $parser = new $p();
    3737                        $result = $parser->parse( $file );
    3838                        $this->assertWPError( $result );
    3939                        $this->assertSame( 'There was an error when reading this WXR file', $result->get_error_message() );
    class Tests_Import_Parser extends WP_Import_UnitTestCase { 
    5151
    5252                foreach ( array( 'WXR_Parser_SimpleXML', 'WXR_Parser_XML', 'WXR_Parser_Regex' ) as $p ) {
    5353                        foreach ( array( $f1, $f2 ) as $file ) {
    54                                 $parser = new $p;
     54                                $parser = new $p();
    5555                                $result = $parser->parse( $file );
    5656                                $this->assertWPError( $result );
    5757                                $this->assertSame( 'This does not appear to be a WXR file, missing/invalid WXR version number', $result->get_error_message() );
    class Tests_Import_Parser extends WP_Import_UnitTestCase { 
    6969
    7070                foreach ( array( 'WXR_Parser_SimpleXML', 'WXR_Parser_XML', 'WXR_Parser_Regex' ) as $p ) {
    7171                        $message = $p . ' failed';
    72                         $parser  = new $p;
     72                        $parser  = new $p();
    7373                        $result  = $parser->parse( $file );
    7474
    7575                        $this->assertIsArray( $result, $message );
    class Tests_Import_Parser extends WP_Import_UnitTestCase { 
    167167
    168168                foreach ( array( 'WXR_Parser_SimpleXML', 'WXR_Parser_XML', 'WXR_Parser_Regex' ) as $p ) {
    169169                        $message = $p . ' failed';
    170                         $parser  = new $p;
     170                        $parser  = new $p();
    171171                        $result  = $parser->parse( $file );
    172172
    173173                        $this->assertIsArray( $result, $message );
    class Tests_Import_Parser extends WP_Import_UnitTestCase { 
    265265
    266266                foreach ( array( 'WXR_Parser_SimpleXML', 'WXR_Parser_XML', 'WXR_Parser_Regex' ) as $p ) {
    267267                        $message = 'Parser ' . $p;
    268                         $parser  = new $p;
     268                        $parser  = new $p();
    269269                        $result  = $parser->parse( $file );
    270270
    271271                        $post = $result['posts'][0];
    class Tests_Import_Parser extends WP_Import_UnitTestCase { 
    298298        public function test_unescaped_cdata_closing_sequence() {
    299299                $file = DIR_TESTDATA . '/export/crazy-cdata.xml';
    300300
    301                 $parser = new WXR_Parser_Regex;
     301                $parser = new WXR_Parser_Regex();
    302302                $result = $parser->parse( $file );
    303303
    304304                $post = $result['posts'][0];
  • tests/phpunit/tests/media.php

    diff --git a/tests/phpunit/tests/media.php b/tests/phpunit/tests/media.php
    index 27eac8c3bb..3a8e6544d2 100644
    a b https://w.org</a>', 
    360360         * @dataProvider data_autoembed
    361361         */
    362362        public function test_autoembed( $content, $result = null ) {
    363                 $wp_embed = new Test_Autoembed;
     363                $wp_embed = new Test_Autoembed();
    364364
    365365                $this->assertSame( $wp_embed->autoembed( $content ), $result ? $result : $content );
    366366        }
  • tests/phpunit/tests/menu/wpExpandNavMenuPostData.php

    diff --git a/tests/phpunit/tests/menu/wpExpandNavMenuPostData.php b/tests/phpunit/tests/menu/wpExpandNavMenuPostData.php
    index 7d5c21fde8..b7e6b17c23 100644
    a b class Tests_Menu_WpExpandNavMenuPostData extends WP_UnitTestCase { 
    1313                }
    1414
    1515                $data                   = array();
    16                 $data[0]                = new StdClass;
     16                $data[0]                = new StdClass();
    1717                $data[0]->name          = 'yesorno';
    1818                $data[0]->value         = 'yes';
    1919                $_POST['nav-menu-data'] = addslashes( json_encode( $data ) );
    class Tests_Menu_WpExpandNavMenuPostData extends WP_UnitTestCase { 
    3636                }
    3737
    3838                $data                   = array();
    39                 $data[0]                = new StdClass;
     39                $data[0]                = new StdClass();
    4040                $data[0]->name          = 'would[1][do][the][trick]';
    4141                $data[0]->value         = 'yes';
    4242                $_POST['nav-menu-data'] = addslashes( json_encode( $data ) );
    class Tests_Menu_WpExpandNavMenuPostData extends WP_UnitTestCase { 
    6666                }
    6767
    6868                $data                   = array();
    69                 $data[0]                = new StdClass;
     69                $data[0]                = new StdClass();
    7070                $data[0]->name          = 'would[1][do][the][trick]';
    7171                $data[0]->value         = 'yes';
    72                 $data[1]                = new StdClass;
     72                $data[1]                = new StdClass();
    7373                $data[1]->name          = 'would[2][do][the][trick]';
    7474                $data[1]->value         = 'yes';
    75                 $data[2]                = new StdClass;
     75                $data[2]                = new StdClass();
    7676                $data[2]->name          = 'would[2][do][the][job]';
    7777                $data[2]->value         = 'yes';
    7878                $_POST['nav-menu-data'] = addslashes( json_encode( $data ) );
  • tests/phpunit/tests/meta.php

    diff --git a/tests/phpunit/tests/meta.php b/tests/phpunit/tests/meta.php
    index 52c108fb07..9b53befeb6 100644
    a b class Tests_Meta extends WP_UnitTestCase { 
    401401         * @ticket 15030
    402402         */
    403403        public function test_get_metadata_with_empty_key_object_value() {
    404                 $data      = new stdClass;
     404                $data      = new stdClass();
    405405                $data->foo = 'bar';
    406406                $value     = serialize( $data );
    407407                add_metadata( 'user', $this->author->ID, 'foo', $data );
  • tests/phpunit/tests/oembed/controller.php

    diff --git a/tests/phpunit/tests/oembed/controller.php b/tests/phpunit/tests/oembed/controller.php
    index 6b674b7291..17262d66f4 100644
    a b class Test_oEmbed_Controller extends WP_UnitTestCase { 
    4949
    5050                /** @var WP_REST_Server $wp_rest_server */
    5151                global $wp_rest_server;
    52                 $wp_rest_server = new Spy_REST_Server;
     52                $wp_rest_server = new Spy_REST_Server();
    5353                do_action( 'rest_api_init', $wp_rest_server );
    5454
    5555                add_filter( 'pre_http_request', array( $this, 'mock_embed_request' ), 10, 3 );
  • tests/phpunit/tests/pomo/mo.php

    diff --git a/tests/phpunit/tests/pomo/mo.php b/tests/phpunit/tests/pomo/mo.php
    index 6d5f539467..7ae73abf6c 100644
    a b class Tests_POMO_MO extends WP_UnitTestCase { 
    144144
    145145        public function test_export_should_not_include_empty_translations() {
    146146                $entries = array();
    147                 $mo      = new MO;
     147                $mo      = new MO();
    148148                $mo->add_entry(
    149149                        array(
    150150                                'singular'     => 'baba',
  • tests/phpunit/tests/pomo/noopTranslations.php

    diff --git a/tests/phpunit/tests/pomo/noopTranslations.php b/tests/phpunit/tests/pomo/noopTranslations.php
    index 3fcfed6b57..44f46c1880 100644
    a b class Tests_POMO_NOOPTranslations extends WP_UnitTestCase { 
    2828
    2929        public function set_up() {
    3030                parent::set_up();
    31                 $this->noop         = new NOOP_Translations;
     31                $this->noop         = new NOOP_Translations();
    3232                $this->entry        = new Translation_Entry( array( 'singular' => 'baba' ) );
    3333                $this->plural_entry = new Translation_Entry(
    3434                        array(
  • tests/phpunit/tests/pomo/translations.php

    diff --git a/tests/phpunit/tests/pomo/translations.php b/tests/phpunit/tests/pomo/translations.php
    index 1e5cc2d037..0d2a3383b0 100644
    a b class Tests_POMO_Translations extends WP_UnitTestCase { 
    121121                $domain        = new Translations();
    122122                $domain->add_entry( $entry_digit_1 );
    123123                $domain->add_entry( $entry_digit_2 );
    124                 $dummy_translation = new Translations;
     124                $dummy_translation = new Translations();
    125125                $this->assertSame( '1', $domain->translate( '1' ) );
    126126                $domain->merge_with( $dummy_translation );
    127127                $this->assertSame( '1', $domain->translate( '1' ) );
  • tests/phpunit/tests/post.php

    diff --git a/tests/phpunit/tests/post.php b/tests/phpunit/tests/post.php
    index 551cbd8c56..484b890af4 100644
    a b class Tests_Post extends WP_UnitTestCase { 
    158158
    159159                _unregister_post_type( $post_type );
    160160                $count = wp_count_posts( $post_type, 'readable' );
    161                 $this->assertEquals( new stdClass, $count );
     161                $this->assertEquals( new stdClass(), $count );
    162162        }
    163163
    164164        public function test_wp_count_posts_filtered() {
    class Tests_Post extends WP_UnitTestCase { 
    601601                        '1 int'     => array( 1 ),
    602602                        'null'      => array( null ),
    603603                        'true'      => array( true ),
    604                         'an object' => array( new stdClass ),
     604                        'an object' => array( new stdClass() ),
    605605                );
    606606        }
    607607
  • tests/phpunit/tests/post/meta.php

    diff --git a/tests/phpunit/tests/post/meta.php b/tests/phpunit/tests/post/meta.php
    index 0fd573d2ea..84a8558b75 100644
    a b class Tests_Post_Meta extends WP_UnitTestCase { 
    166166                $mid = add_post_meta( self::$post_id, 'get_post_meta_by_key', 'get_post_meta_by_key_value', true );
    167167                $this->assertIsInt( $mid );
    168168
    169                 $mobj             = new stdClass;
     169                $mobj             = new stdClass();
    170170                $mobj->meta_id    = $mid;
    171171                $mobj->post_id    = self::$post_id;
    172172                $mobj->meta_key   = 'get_post_meta_by_key';
  • tests/phpunit/tests/post/types.php

    diff --git a/tests/phpunit/tests/post/types.php b/tests/phpunit/tests/post/types.php
    index 5ea10cbb2c..df1543fa0c 100644
    a b class Tests_Post_Types extends WP_UnitTestCase { 
    256256                $this->assertNotNull( get_post_type_object( 'foo' ) );
    257257                $this->assertNull( get_post_type_object( array() ) );
    258258                $this->assertNull( get_post_type_object( array( 'foo' ) ) );
    259                 $this->assertNull( get_post_type_object( new stdClass ) );
     259                $this->assertNull( get_post_type_object( new stdClass() ) );
    260260
    261261                _unregister_post_type( 'foo' );
    262262
  • tests/phpunit/tests/query.php

    diff --git a/tests/phpunit/tests/query.php b/tests/phpunit/tests/query.php
    index 5ef98e1f72..9c4ca439a5 100644
    a b class Tests_Query extends WP_UnitTestCase { 
    3333         * @ticket 16471
    3434         */
    3535        public function test_default_query_var() {
    36                 $query = new WP_Query;
     36                $query = new WP_Query();
    3737                $this->assertSame( '', $query->get( 'nonexistent' ) );
    3838                $this->assertFalse( $query->get( 'nonexistent', false ) );
    3939                $this->assertTrue( $query->get( 'nonexistent', true ) );
  • tests/phpunit/tests/query/generatePostdata.php

    diff --git a/tests/phpunit/tests/query/generatePostdata.php b/tests/phpunit/tests/query/generatePostdata.php
    index c223e4b598..5d39dfb5d4 100644
    a b class Tests_Query_GeneratePostdata extends WP_UnitTestCase { 
    1919         * @ticket 42814
    2020         */
    2121        public function test_setup_by_fake_post() {
    22                 $fake     = new stdClass;
     22                $fake     = new stdClass();
    2323                $fake->ID = 98765;
    2424                $data     = generate_postdata( $fake->ID );
    2525
  • tests/phpunit/tests/query/setupPostdata.php

    diff --git a/tests/phpunit/tests/query/setupPostdata.php b/tests/phpunit/tests/query/setupPostdata.php
    index cabfba7c5b..985ae06f7a 100644
    a b class Tests_Query_SetupPostdata extends WP_UnitTestCase { 
    3333         * @ticket 30970
    3434         */
    3535        public function test_setup_by_fake_post() {
    36                 $fake     = new stdClass;
     36                $fake     = new stdClass();
    3737                $fake->ID = 98765;
    3838                setup_postdata( $fake->ID );
    3939
  • tests/phpunit/tests/rest-api/rest-block-type-controller.php

    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 970d195770..c738428198 100644
    a b class REST_Block_Type_Controller_Test extends WP_Test_REST_Controller_Testcase { 
    620620         * @ticket 47620
    621621         */
    622622        public function test_prepare_item() {
    623                 $registry = new WP_Block_Type_Registry;
     623                $registry = new WP_Block_Type_Registry();
    624624                $settings = array(
    625625                        'icon'            => 'text',
    626626                        'render_callback' => '__return_null',
    627627                );
    628628                $registry->register( 'fake/line', $settings );
    629629                $block_type = $registry->get_registered( 'fake/line' );
    630                 $endpoint   = new WP_REST_Block_Types_Controller;
    631                 $request    = new WP_REST_Request;
     630                $endpoint   = new WP_REST_Block_Types_Controller();
     631                $request    = new WP_REST_Request();
    632632                $request->set_param( 'context', 'edit' );
    633633                $response = $endpoint->prepare_item_for_response( $block_type, $request );
    634634                $this->check_block_type_object( $block_type, $response->get_data(), $response->get_links() );
    class REST_Block_Type_Controller_Test extends WP_Test_REST_Controller_Testcase { 
    638638         * @ticket 47620
    639639         */
    640640        public function test_prepare_item_limit_fields() {
    641                 $registry = new WP_Block_Type_Registry;
     641                $registry = new WP_Block_Type_Registry();
    642642                $settings = array(
    643643                        'icon'            => 'text',
    644644                        'render_callback' => '__return_null',
    645645                );
    646646                $registry->register( 'fake/line', $settings );
    647647                $block_type = $registry->get_registered( 'fake/line' );
    648                 $request    = new WP_REST_Request;
    649                 $endpoint   = new WP_REST_Block_Types_Controller;
     648                $request    = new WP_REST_Request();
     649                $endpoint   = new WP_REST_Block_Types_Controller();
    650650                $request->set_param( 'context', 'edit' );
    651651                $request->set_param( '_fields', 'name' );
    652652                $response = $endpoint->prepare_item_for_response( $block_type, $request );
  • tests/phpunit/tests/rest-api/rest-categories-controller.php

    diff --git a/tests/phpunit/tests/rest-api/rest-categories-controller.php b/tests/phpunit/tests/rest-api/rest-categories-controller.php
    index 8ccad4fe2e..13b0eb1a7f 100644
    a b class WP_Test_REST_Categories_Controller extends WP_Test_REST_Controller_Testcas 
    10931093        }
    10941094
    10951095        public function test_prepare_item_limit_fields() {
    1096                 $request  = new WP_REST_Request;
     1096                $request  = new WP_REST_Request();
    10971097                $endpoint = new WP_REST_Terms_Controller( 'category' );
    10981098                $request->set_param( '_fields', 'id,name' );
    10991099                $term     = get_term( 1, 'category' );
  • tests/phpunit/tests/rest-api/rest-comments-controller.php

    diff --git a/tests/phpunit/tests/rest-api/rest-comments-controller.php b/tests/phpunit/tests/rest-api/rest-comments-controller.php
    index 931aa626cf..3d4f33ab28 100644
    a b class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    152152
    153153        public function set_up() {
    154154                parent::set_up();
    155                 $this->endpoint = new WP_REST_Comments_Controller;
     155                $this->endpoint = new WP_REST_Comments_Controller();
    156156                if ( is_multisite() ) {
    157157                        update_site_option( 'site_admins', array( 'superadmin' ) );
    158158                }
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    953953        public function test_prepare_item_limit_fields() {
    954954                wp_set_current_user( self::$admin_id );
    955955
    956                 $endpoint = new WP_REST_Comments_Controller;
     956                $endpoint = new WP_REST_Comments_Controller();
    957957                $request  = new WP_REST_Request( 'GET', sprintf( '/wp/v2/comments/%d', self::$approved_id ) );
    958958                $request->set_param( 'context', 'edit' );
    959959                $request->set_param( '_fields', 'id,status' );
  • tests/phpunit/tests/rest-api/rest-post-meta-fields.php

    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 b class WP_Test_REST_Post_Meta_Fields extends WP_Test_REST_TestCase { 
    247247
    248248                /** @var WP_REST_Server $wp_rest_server */
    249249                global $wp_rest_server;
    250                 $wp_rest_server = new Spy_REST_Server;
     250                $wp_rest_server = new Spy_REST_Server();
    251251                do_action( 'rest_api_init', $wp_rest_server );
    252252        }
    253253
    class WP_Test_REST_Post_Meta_Fields extends WP_Test_REST_TestCase { 
    380380
    381381                /** @var WP_REST_Server $wp_rest_server */
    382382                global $wp_rest_server;
    383                 $wp_rest_server = new Spy_REST_Server;
     383                $wp_rest_server = new Spy_REST_Server();
    384384                do_action( 'rest_api_init', $wp_rest_server );
    385385
    386386                add_post_meta( self::$post_id, 'test_string', 42 );
  • tests/phpunit/tests/rest-api/rest-post-statuses-controller.php

    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 b class WP_Test_REST_Post_Statuses_Controller extends WP_Test_REST_Controller_Test 
    125125
    126126        public function test_prepare_item() {
    127127                $obj      = get_post_status_object( 'publish' );
    128                 $endpoint = new WP_REST_Post_Statuses_Controller;
    129                 $request  = new WP_REST_Request;
     128                $endpoint = new WP_REST_Post_Statuses_Controller();
     129                $request  = new WP_REST_Request();
    130130                $request->set_param( 'context', 'edit' );
    131131                $data = $endpoint->prepare_item_for_response( $obj, $request );
    132132                $this->check_post_status_obj( $obj, $data->get_data(), $data->get_links() );
    class WP_Test_REST_Post_Statuses_Controller extends WP_Test_REST_Controller_Test 
    134134
    135135        public function test_prepare_item_limit_fields() {
    136136                $obj      = get_post_status_object( 'publish' );
    137                 $request  = new WP_REST_Request;
    138                 $endpoint = new WP_REST_Post_Statuses_Controller;
     137                $request  = new WP_REST_Request();
     138                $endpoint = new WP_REST_Post_Statuses_Controller();
    139139                $request->set_param( 'context', 'edit' );
    140140                $request->set_param( '_fields', 'id,name' );
    141141                $response = $endpoint->prepare_item_for_response( $obj, $request );
  • tests/phpunit/tests/rest-api/rest-post-types-controller.php

    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 b class WP_Test_REST_Post_Types_Controller extends WP_Test_REST_Controller_Testcas 
    133133
    134134        public function test_prepare_item() {
    135135                $obj      = get_post_type_object( 'post' );
    136                 $endpoint = new WP_REST_Post_Types_Controller;
    137                 $request  = new WP_REST_Request;
     136                $endpoint = new WP_REST_Post_Types_Controller();
     137                $request  = new WP_REST_Request();
    138138                $request->set_param( 'context', 'edit' );
    139139                $response = $endpoint->prepare_item_for_response( $obj, $request );
    140140                $this->check_post_type_obj( 'edit', $obj, $response->get_data(), $response->get_links() );
    class WP_Test_REST_Post_Types_Controller extends WP_Test_REST_Controller_Testcas 
    142142
    143143        public function test_prepare_item_limit_fields() {
    144144                $obj      = get_post_type_object( 'post' );
    145                 $request  = new WP_REST_Request;
    146                 $endpoint = new WP_REST_Post_Types_Controller;
     145                $request  = new WP_REST_Request();
     146                $endpoint = new WP_REST_Post_Types_Controller();
    147147                $request->set_param( 'context', 'edit' );
    148148                $request->set_param( '_fields', 'id,name' );
    149149                $response = $endpoint->prepare_item_for_response( $obj, $request );
  • tests/phpunit/tests/rest-api/rest-schema-setup.php

    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 b class WP_Test_REST_Schema_Initialization extends WP_Test_REST_TestCase { 
    2020
    2121                /** @var WP_REST_Server $wp_rest_server */
    2222                global $wp_rest_server;
    23                 $wp_rest_server = new Spy_REST_Server;
     23                $wp_rest_server = new Spy_REST_Server();
    2424                do_action( 'rest_api_init', $wp_rest_server );
    2525
    2626                add_filter( 'pre_http_request', array( $this, 'mock_embed_request' ), 10, 3 );
  • tests/phpunit/tests/rest-api/rest-tags-controller.php

    diff --git a/tests/phpunit/tests/rest-api/rest-tags-controller.php b/tests/phpunit/tests/rest-api/rest-tags-controller.php
    index 88fb0c20c7..fd25e0de83 100644
    a b class WP_Test_REST_Tags_Controller extends WP_Test_REST_Controller_Testcase { 
    12111211        }
    12121212
    12131213        public function test_prepare_item_limit_fields() {
    1214                 $request  = new WP_REST_Request;
     1214                $request  = new WP_REST_Request();
    12151215                $endpoint = new WP_REST_Terms_Controller( 'post_tag' );
    12161216                $request->set_param( '_fields', 'id,name' );
    12171217                $term     = get_term_by( 'id', self::factory()->tag->create(), 'post_tag' );
  • tests/phpunit/tests/rest-api/rest-taxonomies-controller.php

    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 b class WP_Test_REST_Taxonomies_Controller extends WP_Test_REST_Controller_Testcas 
    174174
    175175        public function test_prepare_item() {
    176176                $tax      = get_taxonomy( 'category' );
    177                 $endpoint = new WP_REST_Taxonomies_Controller;
    178                 $request  = new WP_REST_Request;
     177                $endpoint = new WP_REST_Taxonomies_Controller();
     178                $request  = new WP_REST_Request();
    179179                $request->set_param( 'context', 'edit' );
    180180                $response = $endpoint->prepare_item_for_response( $tax, $request );
    181181                $this->check_taxonomy_object( 'edit', $tax, $response->get_data(), $response->get_links() );
    class WP_Test_REST_Taxonomies_Controller extends WP_Test_REST_Controller_Testcas 
    183183
    184184        public function test_prepare_item_limit_fields() {
    185185                $tax      = get_taxonomy( 'category' );
    186                 $request  = new WP_REST_Request;
    187                 $endpoint = new WP_REST_Taxonomies_Controller;
     186                $request  = new WP_REST_Request();
     187                $endpoint = new WP_REST_Taxonomies_Controller();
    188188                $request->set_param( 'context', 'edit' );
    189189                $request->set_param( '_fields', 'id,name' );
    190190                $response = $endpoint->prepare_item_for_response( $tax, $request );
  • tests/phpunit/tests/rest-api/rest-term-meta-fields.php

    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 b class WP_Test_REST_Term_Meta_Fields extends WP_Test_REST_TestCase { 
    194194
    195195                /** @var WP_REST_Server $wp_rest_server */
    196196                global $wp_rest_server;
    197                 $wp_rest_server = new Spy_REST_Server;
     197                $wp_rest_server = new Spy_REST_Server();
    198198                do_action( 'rest_api_init', $wp_rest_server );
    199199        }
    200200
    class WP_Test_REST_Term_Meta_Fields extends WP_Test_REST_TestCase { 
    327327
    328328                /** @var WP_REST_Server $wp_rest_server */
    329329                global $wp_rest_server;
    330                 $wp_rest_server = new Spy_REST_Server;
     330                $wp_rest_server = new Spy_REST_Server();
    331331                do_action( 'rest_api_init', $wp_rest_server );
    332332
    333333                add_term_meta( self::$category_id, 'test_string', 42 );
  • tests/phpunit/tests/rest-api/rest-users-controller.php

    diff --git a/tests/phpunit/tests/rest-api/rest-users-controller.php b/tests/phpunit/tests/rest-api/rest-users-controller.php
    index 7a7193b3c6..3952543e4f 100644
    a b class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { 
    973973        public function test_prepare_item() {
    974974                wp_set_current_user( self::$user );
    975975
    976                 $request = new WP_REST_Request;
     976                $request = new WP_REST_Request();
    977977                $request->set_param( 'context', 'edit' );
    978978                $user = get_user_by( 'id', get_current_user_id() );
    979979                $data = $this->endpoint->prepare_item_for_response( $user, $request );
    class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { 
    983983        public function test_prepare_item_limit_fields() {
    984984                wp_set_current_user( self::$user );
    985985
    986                 $request = new WP_REST_Request;
     986                $request = new WP_REST_Request();
    987987                $request->set_param( 'context', 'edit' );
    988988                $request->set_param( '_fields', 'id,name' );
    989989                $user     = get_user_by( 'id', get_current_user_id() );
  • tests/phpunit/tests/rest-api/rest-widget-types-controller.php

    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 b class WP_Test_REST_Widget_Types_Controller extends WP_Test_REST_Controller_Testc 
    118118                $response = rest_get_server()->dispatch( $request );
    119119                $data     = $response->get_data();
    120120                $this->assertGreaterThan( 1, count( $data ) );
    121                 $endpoint = new WP_REST_Widget_Types_Controller;
     121                $endpoint = new WP_REST_Widget_Types_Controller();
    122122                foreach ( $data as $item ) {
    123123                        $widget_type = $endpoint->get_widget( $item['name'] );
    124124                        $this->check_widget_type_object( $widget_type, $item, $item['_links'] );
    class WP_Test_REST_Widget_Types_Controller extends WP_Test_REST_Controller_Testc 
    180180                wp_set_current_user( self::$admin_id );
    181181                $request     = new WP_REST_Request( 'GET', '/wp/v2/widget-types/' . $widget_name );
    182182                $response    = rest_get_server()->dispatch( $request );
    183                 $endpoint    = new WP_REST_Widget_Types_Controller;
     183                $endpoint    = new WP_REST_Widget_Types_Controller();
    184184                $widget_type = $endpoint->get_widget( $widget_name );
    185185                $this->check_widget_type_object( $widget_type, $response->get_data(), $response->get_links() );
    186186        }
    class WP_Test_REST_Widget_Types_Controller extends WP_Test_REST_Controller_Testc 
    198198                wp_set_current_user( self::$admin_id );
    199199                $request     = new WP_REST_Request( 'GET', '/wp/v2/widget-types/' . $widget_id );
    200200                $response    = rest_get_server()->dispatch( $request );
    201                 $endpoint    = new WP_REST_Widget_Types_Controller;
     201                $endpoint    = new WP_REST_Widget_Types_Controller();
    202202                $widget_type = $endpoint->get_widget( $widget_id );
    203203                $this->check_widget_type_object( $widget_type, $response->get_data(), $response->get_links() );
    204204        }
    class WP_Test_REST_Widget_Types_Controller extends WP_Test_REST_Controller_Testc 
    298298         * @ticket 41683
    299299         */
    300300        public function test_prepare_item() {
    301                 $endpoint    = new WP_REST_Widget_Types_Controller;
     301                $endpoint    = new WP_REST_Widget_Types_Controller();
    302302                $widget_type = $endpoint->get_widget( 'calendar' );
    303                 $request     = new WP_REST_Request;
     303                $request     = new WP_REST_Request();
    304304                $request->set_param( 'context', 'edit' );
    305305                $response = $endpoint->prepare_item_for_response( $widget_type, $request );
    306306                $this->check_widget_type_object( $widget_type, $response->get_data(), $response->get_links() );
    class WP_Test_REST_Widget_Types_Controller extends WP_Test_REST_Controller_Testc 
    366366                        array(
    367367                                'encoded' => base64_encode( serialize( array() ) ),
    368368                                'hash'    => wp_hash( serialize( array() ) ),
    369                                 'raw'     => new stdClass,
     369                                'raw'     => new stdClass(),
    370370                        ),
    371371                        $data['instance']
    372372                );
    class WP_Test_REST_Widget_Types_Controller extends WP_Test_REST_Controller_Testc 
    402402                        array(
    403403                                'encoded' => base64_encode( serialize( array() ) ),
    404404                                'hash'    => wp_hash( serialize( array() ) ),
    405                                 'raw'     => new stdClass,
     405                                'raw'     => new stdClass(),
    406406                        ),
    407407                        $data['instance']
    408408                );