-
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 ) ) { |
97 | 97 | } |
98 | 98 | |
99 | 99 | $registered = $wp_scripts->registered; |
100 | | $wp_scripts = new WP_Scripts; |
| 100 | $wp_scripts = new WP_Scripts(); |
101 | 101 | $wp_scripts->registered = $registered; |
102 | 102 | |
103 | 103 | add_action( 'customize_controls_print_scripts', 'print_head_scripts', 20 ); |
-
diff --git a/src/wp-admin/includes/ajax-actions.php b/src/wp-admin/includes/ajax-actions.php
index bcc41e5465..8c8fd5ca84 100644
a
|
b
|
function wp_ajax_add_menu_item() { |
1570 | 1570 | 'before' => '', |
1571 | 1571 | 'link_after' => '', |
1572 | 1572 | 'link_before' => '', |
1573 | | 'walker' => new $walker_class_name, |
| 1573 | 'walker' => new $walker_class_name(), |
1574 | 1574 | ); |
1575 | 1575 | |
1576 | 1576 | echo walk_nav_menu_tree( $menu_items, 0, (object) $args ); |
-
diff --git a/src/wp-admin/includes/bookmark.php b/src/wp-admin/includes/bookmark.php
index 8d26e27a5e..abb068319c 100644
a
|
b
|
function edit_link( $link_id = 0 ) { |
59 | 59 | * @return stdClass Default link object. |
60 | 60 | */ |
61 | 61 | function get_default_link_to_edit() { |
62 | | $link = new stdClass; |
| 62 | $link = new stdClass(); |
63 | 63 | if ( isset( $_GET['linkurl'] ) ) { |
64 | 64 | $link->link_url = esc_url( wp_unslash( $_GET['linkurl'] ) ); |
65 | 65 | } else { |
-
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 { |
62 | 62 | * Avoid messing with VCS installations, at least for now. |
63 | 63 | * Noted: this is not the ideal way to accomplish this. |
64 | 64 | */ |
65 | | $check_vcs = new WP_Automatic_Updater; |
| 65 | $check_vcs = new WP_Automatic_Updater(); |
66 | 66 | if ( $check_vcs->is_vcs_checkout( WP_CONTENT_DIR ) ) { |
67 | 67 | return; |
68 | 68 | } |
-
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 { |
139 | 139 | */ |
140 | 140 | public function should_update( $type, $item, $context ) { |
141 | 141 | // 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(); |
143 | 143 | |
144 | 144 | if ( $this->is_disabled() ) { |
145 | 145 | return false; |
… |
… |
class WP_Automatic_Updater { |
305 | 305 | * @return null|WP_Error |
306 | 306 | */ |
307 | 307 | public function update( $type, $item ) { |
308 | | $skin = new Automatic_Upgrader_Skin; |
| 308 | $skin = new Automatic_Upgrader_Skin(); |
309 | 309 | |
310 | 310 | switch ( $type ) { |
311 | 311 | case 'core': |
-
diff --git a/src/wp-admin/includes/class-wp-site-health-auto-updates.php b/src/wp-admin/includes/class-wp-site-health-auto-updates.php
index e3c02d0620..541bbd1f23 100644
a
|
b
|
class WP_Site_Health_Auto_Updates { |
280 | 280 | require_once ABSPATH . 'wp-admin/includes/file.php'; |
281 | 281 | } |
282 | 282 | |
283 | | $skin = new Automatic_Upgrader_Skin; |
| 283 | $skin = new Automatic_Upgrader_Skin(); |
284 | 284 | $success = $skin->request_filesystem_credentials( false, ABSPATH ); |
285 | 285 | |
286 | 286 | if ( ! $success ) { |
… |
… |
class WP_Site_Health_Auto_Updates { |
313 | 313 | |
314 | 314 | require ABSPATH . WPINC . '/version.php'; // $wp_version; // x.y.z |
315 | 315 | |
316 | | $skin = new Automatic_Upgrader_Skin; |
| 316 | $skin = new Automatic_Upgrader_Skin(); |
317 | 317 | $success = $skin->request_filesystem_credentials( false, ABSPATH ); |
318 | 318 | |
319 | 319 | if ( ! $success ) { |
-
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 ) { |
739 | 739 | $backup_sizes = get_post_meta( $post_id, '_wp_attachment_backup_sizes', true ); |
740 | 740 | $old_backup_sizes = $backup_sizes; |
741 | 741 | $restored = false; |
742 | | $msg = new stdClass; |
| 742 | $msg = new stdClass(); |
743 | 743 | |
744 | 744 | if ( ! is_array( $backup_sizes ) ) { |
745 | 745 | $msg->error = __( 'Cannot load image metadata.' ); |
… |
… |
function wp_restore_image( $post_id ) { |
827 | 827 | function wp_save_image( $post_id ) { |
828 | 828 | $_wp_additional_image_sizes = wp_get_additional_image_sizes(); |
829 | 829 | |
830 | | $return = new stdClass; |
| 830 | $return = new stdClass(); |
831 | 831 | $success = false; |
832 | 832 | $delete = false; |
833 | 833 | $scaled = false; |
-
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() ) { |
32 | 32 | } |
33 | 33 | |
34 | 34 | if ( 'markup' === $response_format ) { |
35 | | $args['walker'] = new Walker_Nav_Menu_Checklist; |
| 35 | $args['walker'] = new Walker_Nav_Menu_Checklist(); |
36 | 36 | } |
37 | 37 | |
38 | 38 | if ( 'get-post-item' === $type ) { |
… |
… |
function wp_nav_menu_item_post_type_meta_box( $data_object, $box ) { |
429 | 429 | } |
430 | 430 | |
431 | 431 | // @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(); |
433 | 433 | $posts = $get_posts->query( $args ); |
434 | 434 | |
435 | 435 | // Only suppress and insert when more than just suppression pages available. |
436 | 436 | if ( ! $get_posts->post_count ) { |
437 | 437 | if ( ! empty( $suppress_page_ids ) ) { |
438 | 438 | unset( $args['post__not_in'] ); |
439 | | $get_posts = new WP_Query; |
| 439 | $get_posts = new WP_Query(); |
440 | 440 | $posts = $get_posts->query( $args ); |
441 | 441 | } else { |
442 | 442 | echo '<p>' . __( 'No items.' ) . '</p>'; |
… |
… |
function wp_get_nav_menu_to_edit( $menu_id = 0 ) { |
1059 | 1059 | $walker_class_name = apply_filters( 'wp_edit_nav_menu_walker', 'Walker_Nav_Menu_Edit', $menu_id ); |
1060 | 1060 | |
1061 | 1061 | if ( class_exists( $walker_class_name ) ) { |
1062 | | $walker = new $walker_class_name; |
| 1062 | $walker = new $walker_class_name(); |
1063 | 1063 | } else { |
1064 | 1064 | return new WP_Error( |
1065 | 1065 | 'menu_walker_not_exist', |
-
diff --git a/src/wp-admin/includes/post.php b/src/wp-admin/includes/post.php
index 65b36c4836..b72134d421 100644
a
|
b
|
function get_default_post_to_edit( $post_type = 'post', $create_in_db = false ) |
716 | 716 | wp_schedule_event( time(), 'daily', 'wp_scheduled_auto_draft_delete' ); |
717 | 717 | } |
718 | 718 | } else { |
719 | | $post = new stdClass; |
| 719 | $post = new stdClass(); |
720 | 720 | $post->ID = 0; |
721 | 721 | $post->post_author = ''; |
722 | 722 | $post->post_date = ''; |
-
diff --git a/src/wp-admin/includes/privacy-tools.php b/src/wp-admin/includes/privacy-tools.php
index f974ea8a5d..9682e94fcf 100644
a
|
b
|
function wp_privacy_generate_personal_data_export_file( $request_id ) { |
535 | 535 | wp_delete_file( $archive_pathname ); |
536 | 536 | } |
537 | 537 | |
538 | | $zip = new ZipArchive; |
| 538 | $zip = new ZipArchive(); |
539 | 539 | if ( true === $zip->open( $archive_pathname, ZipArchive::CREATE ) ) { |
540 | 540 | if ( ! $zip->addFile( $json_report_pathname, 'export.json' ) ) { |
541 | 541 | $error = __( 'Unable to archive the personal data export file (JSON format).' ); |
-
diff --git a/src/wp-admin/includes/schema.php b/src/wp-admin/includes/schema.php
index 57ffe69054..79fb80c205 100644
a
|
b
|
function populate_network( $network_id = 1, $domain = '', $email = '', $site_nam |
1050 | 1050 | * created. |
1051 | 1051 | */ |
1052 | 1052 | if ( ! is_multisite() ) { |
1053 | | $current_site = new stdClass; |
| 1053 | $current_site = new stdClass(); |
1054 | 1054 | $current_site->domain = $domain; |
1055 | 1055 | $current_site->path = $path; |
1056 | 1056 | $current_site->site_name = ucfirst( $domain ); |
-
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() ) { |
104 | 104 | $parsed_args = wp_parse_args( $params, $defaults ); |
105 | 105 | |
106 | 106 | if ( empty( $parsed_args['walker'] ) || ! ( $parsed_args['walker'] instanceof Walker ) ) { |
107 | | $walker = new Walker_Category_Checklist; |
| 107 | $walker = new Walker_Category_Checklist(); |
108 | 108 | } else { |
109 | 109 | $walker = $parsed_args['walker']; |
110 | 110 | } |
-
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 ) { |
237 | 237 | $translation = (object) $translation; |
238 | 238 | |
239 | 239 | require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; |
240 | | $skin = new Automatic_Upgrader_Skin; |
| 240 | $skin = new Automatic_Upgrader_Skin(); |
241 | 241 | $upgrader = new Language_Pack_Upgrader( $skin ); |
242 | 242 | $translation->type = 'core'; |
243 | 243 | $result = $upgrader->upgrade( $translation, array( 'clear_update_cache' => false ) ); |
… |
… |
function wp_can_install_language_pack() { |
263 | 263 | } |
264 | 264 | |
265 | 265 | require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; |
266 | | $skin = new Automatic_Upgrader_Skin; |
| 266 | $skin = new Automatic_Upgrader_Skin(); |
267 | 267 | $upgrader = new Language_Pack_Upgrader( $skin ); |
268 | 268 | $upgrader->init(); |
269 | 269 | |
-
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 ) { |
1395 | 1395 | // If a error occurs partway through this final step, keep the error flowing through, but keep process going. |
1396 | 1396 | if ( is_wp_error( $_result ) ) { |
1397 | 1397 | if ( ! is_wp_error( $result ) ) { |
1398 | | $result = new WP_Error; |
| 1398 | $result = new WP_Error(); |
1399 | 1399 | } |
1400 | 1400 | |
1401 | 1401 | $result->add( |
-
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() { |
93 | 93 | require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; |
94 | 94 | |
95 | 95 | $auto_update = false; |
96 | | $upgrader = new WP_Automatic_Updater; |
| 96 | $upgrader = new WP_Automatic_Updater(); |
97 | 97 | foreach ( $updates->updates as $update ) { |
98 | 98 | if ( 'autoupdate' !== $update->response ) { |
99 | 99 | continue; |
… |
… |
function core_update_footer( $msg = '' ) { |
235 | 235 | |
236 | 236 | $cur = get_preferred_from_update_core(); |
237 | 237 | if ( ! is_object( $cur ) ) { |
238 | | $cur = new stdClass; |
| 238 | $cur = new stdClass(); |
239 | 239 | } |
240 | 240 | |
241 | 241 | if ( ! isset( $cur->current ) ) { |
-
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 ) { |
2614 | 2614 | */ |
2615 | 2615 | function get_alloptions_110() { |
2616 | 2616 | global $wpdb; |
2617 | | $all_options = new stdClass; |
| 2617 | $all_options = new stdClass(); |
2618 | 2618 | $options = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options" ); |
2619 | 2619 | if ( $options ) { |
2620 | 2620 | foreach ( $options as $option ) { |
-
diff --git a/src/wp-admin/includes/user.php b/src/wp-admin/includes/user.php
index 134da30514..1df2739d48 100644
a
|
b
|
function add_user() { |
29 | 29 | */ |
30 | 30 | function edit_user( $user_id = 0 ) { |
31 | 31 | $wp_roles = wp_roles(); |
32 | | $user = new stdClass; |
| 32 | $user = new stdClass(); |
33 | 33 | $user_id = (int) $user_id; |
34 | 34 | if ( $user_id ) { |
35 | 35 | $update = true; |
-
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() |
104 | 104 | if ( IS_PROFILE_PAGE && isset( $_GET['newuseremail'] ) && $current_user->ID ) { |
105 | 105 | $new_email = get_user_meta( $current_user->ID, '_new_email', true ); |
106 | 106 | if ( $new_email && hash_equals( $new_email['hash'], $_GET['newuseremail'] ) ) { |
107 | | $user = new stdClass; |
| 107 | $user = new stdClass(); |
108 | 108 | $user->ID = $current_user->ID; |
109 | 109 | $user->user_email = esc_html( trim( $new_email['newemail'] ) ); |
110 | 110 | if ( is_multisite() && $wpdb->get_var( $wpdb->prepare( "SELECT user_login FROM {$wpdb->signups} WHERE user_login = %s", $current_user->user_login ) ) ) { |
-
diff --git a/src/wp-includes/admin-bar.php b/src/wp-includes/admin-bar.php
index 9084a63cc3..4a5d604a1b 100644
a
|
b
|
function _wp_admin_bar_init() { |
41 | 41 | */ |
42 | 42 | $admin_bar_class = apply_filters( 'wp_admin_bar_class', 'WP_Admin_Bar' ); |
43 | 43 | if ( class_exists( $admin_bar_class ) ) { |
44 | | $wp_admin_bar = new $admin_bar_class; |
| 44 | $wp_admin_bar = new $admin_bar_class(); |
45 | 45 | } else { |
46 | 46 | return false; |
47 | 47 | } |
-
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 ) { |
975 | 975 | if ( empty( $user ) ) { |
976 | 976 | // User is logged out, create anonymous user object. |
977 | 977 | $user = new WP_User( 0 ); |
978 | | $user->init( new stdClass ); |
| 978 | $user->init( new stdClass() ); |
979 | 979 | } |
980 | 980 | |
981 | 981 | return $user->has_cap( $capability, ...$args ); |
-
diff --git a/src/wp-includes/category-template.php b/src/wp-includes/category-template.php
index dc0dfe7ef0..b35c17170d 100644
a
|
b
|
function _wp_object_count_sort_cb( $a, $b ) { |
1110 | 1110 | function walk_category_tree( ...$args ) { |
1111 | 1111 | // The user's options are the third parameter. |
1112 | 1112 | if ( empty( $args[2]['walker'] ) || ! ( $args[2]['walker'] instanceof Walker ) ) { |
1113 | | $walker = new Walker_Category; |
| 1113 | $walker = new Walker_Category(); |
1114 | 1114 | } else { |
1115 | 1115 | /** |
1116 | 1116 | * @var Walker $walker |
… |
… |
function walk_category_tree( ...$args ) { |
1136 | 1136 | function walk_category_dropdown_tree( ...$args ) { |
1137 | 1137 | // The user's options are the third parameter. |
1138 | 1138 | if ( empty( $args[2]['walker'] ) || ! ( $args[2]['walker'] instanceof Walker ) ) { |
1139 | | $walker = new Walker_CategoryDropdown; |
| 1139 | $walker = new Walker_CategoryDropdown(); |
1140 | 1140 | } else { |
1141 | 1141 | /** |
1142 | 1142 | * @var Walker $walker |
-
diff --git a/src/wp-includes/class-wp-admin-bar.php b/src/wp-includes/class-wp-admin-bar.php
index 406d76459b..dc6ea0993c 100644
a
|
b
|
class WP_Admin_Bar { |
41 | 41 | * @since 3.1.0 |
42 | 42 | */ |
43 | 43 | public function initialize() { |
44 | | $this->user = new stdClass; |
| 44 | $this->user = new stdClass(); |
45 | 45 | |
46 | 46 | if ( is_user_logged_in() ) { |
47 | 47 | /* Populate settings we need for the menu based on the current user. */ |
-
diff --git a/src/wp-includes/class-wp-editor.php b/src/wp-includes/class-wp-editor.php
index 41f379a838..16805f7a16 100644
a
|
b
|
final class _WP_Editors { |
1799 | 1799 | $query = apply_filters( 'wp_link_query_args', $query ); |
1800 | 1800 | |
1801 | 1801 | // Do main query. |
1802 | | $get_posts = new WP_Query; |
| 1802 | $get_posts = new WP_Query(); |
1803 | 1803 | $posts = $get_posts->query( $query ); |
1804 | 1804 | |
1805 | 1805 | // Build results. |
-
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 { |
581 | 581 | |
582 | 582 | // Transport claims to support request, instantiate it and give it a whirl. |
583 | 583 | if ( empty( $transports[ $class ] ) ) { |
584 | | $transports[ $class ] = new $class; |
| 584 | $transports[ $class ] = new $class(); |
585 | 585 | } |
586 | 586 | |
587 | 587 | $response = $transports[ $class ]->request( $url, $args ); |
-
diff --git a/src/wp-includes/class-wp-oembed.php b/src/wp-includes/class-wp-oembed.php
index 8b24cf752b..e177223435 100644
a
|
b
|
class WP_oEmbed { |
639 | 639 | return false; |
640 | 640 | } |
641 | 641 | |
642 | | $dom = new DOMDocument; |
| 642 | $dom = new DOMDocument(); |
643 | 643 | $success = $dom->loadXML( $response_body ); |
644 | 644 | if ( ! $success ) { |
645 | 645 | return false; |
… |
… |
class WP_oEmbed { |
660 | 660 | return false; |
661 | 661 | } |
662 | 662 | |
663 | | $return = new stdClass; |
| 663 | $return = new stdClass(); |
664 | 664 | foreach ( $xml as $key => $value ) { |
665 | 665 | $return->$key = (string) $value; |
666 | 666 | } |
-
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 { |
268 | 268 | foreach ( $orig_matches as $o => $f ) { |
269 | 269 | if ( is_numeric( $o ) && is_numeric( $f ) ) { |
270 | 270 | $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(); |
272 | 272 | $diff = $renderer->render( $text_diff ); |
273 | 273 | |
274 | 274 | // If they're too different, don't include any <ins> or <del>'s. |
-
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 { |
156 | 156 | if ( $data ) { |
157 | 157 | $this->init( $data, $site_id ); |
158 | 158 | } else { |
159 | | $this->data = new stdClass; |
| 159 | $this->data = new stdClass(); |
160 | 160 | } |
161 | 161 | } |
162 | 162 | |
-
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 ) { |
2238 | 2238 | wp_queue_comments_for_comment_meta_lazyload( $_comments ); |
2239 | 2239 | |
2240 | 2240 | if ( empty( $parsed_args['walker'] ) ) { |
2241 | | $walker = new Walker_Comment; |
| 2241 | $walker = new Walker_Comment(); |
2242 | 2242 | } else { |
2243 | 2243 | $walker = $parsed_args['walker']; |
2244 | 2244 | } |
-
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() ) { |
171 | 171 | ); |
172 | 172 | $parsed_args = wp_parse_args( $args, $defaults ); |
173 | 173 | |
174 | | $query = new WP_Comment_Query; |
| 174 | $query = new WP_Comment_Query(); |
175 | 175 | return $query->query( $parsed_args ); |
176 | 176 | } |
177 | 177 | |
… |
… |
function get_comment( $comment = null, $output = OBJECT ) { |
240 | 240 | * @return WP_Comment[]|int[]|int List of comments or number of found comments if `$count` argument is true. |
241 | 241 | */ |
242 | 242 | function get_comments( $args = '' ) { |
243 | | $query = new WP_Comment_Query; |
| 243 | $query = new WP_Comment_Query(); |
244 | 244 | return $query->query( $args ); |
245 | 245 | } |
246 | 246 | |
… |
… |
function get_comment_pages_count( $comments = null, $per_page = null, $threaded |
1023 | 1023 | } |
1024 | 1024 | |
1025 | 1025 | if ( $threaded ) { |
1026 | | $walker = new Walker_Comment; |
| 1026 | $walker = new Walker_Comment(); |
1027 | 1027 | $count = ceil( $walker->get_number_of_root_elements( $comments ) / $per_page ); |
1028 | 1028 | } else { |
1029 | 1029 | $count = ceil( count( $comments ) / $per_page ); |
-
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 ) { |
4302 | 4302 | } |
4303 | 4303 | } |
4304 | 4304 | } elseif ( is_object( $data ) ) { |
4305 | | $output = new stdClass; |
| 4305 | $output = new stdClass(); |
4306 | 4306 | foreach ( $data as $id => $el ) { |
4307 | 4307 | if ( is_string( $id ) ) { |
4308 | 4308 | $clean_id = _wp_json_convert_string( $id ); |
-
diff --git a/src/wp-includes/l10n.php b/src/wp-includes/l10n.php
index 40c653fdbe..d7642c7038 100644
a
|
b
|
function get_translations_for_domain( $domain ) { |
1306 | 1306 | |
1307 | 1307 | static $noop_translations = null; |
1308 | 1308 | if ( null === $noop_translations ) { |
1309 | | $noop_translations = new NOOP_Translations; |
| 1309 | $noop_translations = new NOOP_Translations(); |
1310 | 1310 | } |
1311 | 1311 | |
1312 | 1312 | return $noop_translations; |
-
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 ) |
297 | 297 | |
298 | 298 | // If the network is defined in wp-config.php, we can simply use that. |
299 | 299 | if ( defined( 'DOMAIN_CURRENT_SITE' ) && defined( 'PATH_CURRENT_SITE' ) ) { |
300 | | $current_site = new stdClass; |
| 300 | $current_site = new stdClass(); |
301 | 301 | $current_site->id = defined( 'SITE_ID_CURRENT_SITE' ) ? SITE_ID_CURRENT_SITE : 1; |
302 | 302 | $current_site->domain = DOMAIN_CURRENT_SITE; |
303 | 303 | $current_site->path = PATH_CURRENT_SITE; |
… |
… |
function ms_load_current_site_and_network( $domain, $path, $subdomain = false ) |
387 | 387 | |
388 | 388 | // During activation of a new subdomain, the requested site does not yet exist. |
389 | 389 | if ( empty( $current_blog ) && wp_installing() ) { |
390 | | $current_blog = new stdClass; |
| 390 | $current_blog = new stdClass(); |
391 | 391 | $current_blog->blog_id = 1; |
392 | 392 | $blog_id = 1; |
393 | 393 | $current_blog->public = 1; |
-
diff --git a/src/wp-includes/nav-menu-template.php b/src/wp-includes/nav-menu-template.php
index 0673bf36ed..893727c44c 100644
a
|
b
|
function _wp_menu_item_classes_by_context( &$menu_items ) { |
617 | 617 | * @return string The HTML list content for the menu items. |
618 | 618 | */ |
619 | 619 | function 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; |
621 | 621 | |
622 | 622 | return $walker->walk( $items, $depth, $args ); |
623 | 623 | } |
-
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_ |
1010 | 1010 | $object_id = (int) $object_id; |
1011 | 1011 | $menu_item_ids = array(); |
1012 | 1012 | |
1013 | | $query = new WP_Query; |
| 1013 | $query = new WP_Query(); |
1014 | 1014 | $menu_items = $query->query( |
1015 | 1015 | array( |
1016 | 1016 | 'meta_key' => '_menu_item_object_id', |
-
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' ) ) : |
105 | 105 | return false; |
106 | 106 | } |
107 | 107 | |
108 | | $user = new WP_User; |
| 108 | $user = new WP_User(); |
109 | 109 | $user->init( $userdata ); |
110 | 110 | |
111 | 111 | return $user; |
-
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() ) { |
1546 | 1546 | */ |
1547 | 1547 | function walk_page_tree( $pages, $depth, $current_page, $args ) { |
1548 | 1548 | if ( empty( $args['walker'] ) ) { |
1549 | | $walker = new Walker_Page; |
| 1549 | $walker = new Walker_Page(); |
1550 | 1550 | } else { |
1551 | 1551 | /** |
1552 | 1552 | * @var Walker $walker |
… |
… |
function walk_page_tree( $pages, $depth, $current_page, $args ) { |
1578 | 1578 | */ |
1579 | 1579 | function walk_page_dropdown_tree( ...$args ) { |
1580 | 1580 | if ( empty( $args[2]['walker'] ) ) { // The user's options are the third parameter. |
1581 | | $walker = new Walker_PageDropdown; |
| 1581 | $walker = new Walker_PageDropdown(); |
1582 | 1582 | } else { |
1583 | 1583 | /** |
1584 | 1584 | * @var Walker $walker |
-
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 ) { |
2410 | 2410 | $parsed_args['ignore_sticky_posts'] = true; |
2411 | 2411 | $parsed_args['no_found_rows'] = true; |
2412 | 2412 | |
2413 | | $get_posts = new WP_Query; |
| 2413 | $get_posts = new WP_Query(); |
2414 | 2414 | return $get_posts->query( $parsed_args ); |
2415 | 2415 | } |
2416 | 2416 | |
… |
… |
function wp_count_posts( $type = 'post', $perm = '' ) { |
3012 | 3012 | global $wpdb; |
3013 | 3013 | |
3014 | 3014 | if ( ! post_type_exists( $type ) ) { |
3015 | | return new stdClass; |
| 3015 | return new stdClass(); |
3016 | 3016 | } |
3017 | 3017 | |
3018 | 3018 | $cache_key = _count_posts_cache_key( $type, $perm ); |
-
diff --git a/src/wp-includes/rest-api.php b/src/wp-includes/rest-api.php
index b611745ebd..3953b74392 100644
a
|
b
|
function create_initial_rest_routes() { |
255 | 255 | } |
256 | 256 | |
257 | 257 | // Post types. |
258 | | $controller = new WP_REST_Post_Types_Controller; |
| 258 | $controller = new WP_REST_Post_Types_Controller(); |
259 | 259 | $controller->register_routes(); |
260 | 260 | |
261 | 261 | // Post statuses. |
262 | | $controller = new WP_REST_Post_Statuses_Controller; |
| 262 | $controller = new WP_REST_Post_Statuses_Controller(); |
263 | 263 | $controller->register_routes(); |
264 | 264 | |
265 | 265 | // Taxonomies. |
266 | | $controller = new WP_REST_Taxonomies_Controller; |
| 266 | $controller = new WP_REST_Taxonomies_Controller(); |
267 | 267 | $controller->register_routes(); |
268 | 268 | |
269 | 269 | // Terms. |
… |
… |
function create_initial_rest_routes() { |
278 | 278 | } |
279 | 279 | |
280 | 280 | // Users. |
281 | | $controller = new WP_REST_Users_Controller; |
| 281 | $controller = new WP_REST_Users_Controller(); |
282 | 282 | $controller->register_routes(); |
283 | 283 | |
284 | 284 | // Application Passwords |
… |
… |
function create_initial_rest_routes() { |
286 | 286 | $controller->register_routes(); |
287 | 287 | |
288 | 288 | // Comments. |
289 | | $controller = new WP_REST_Comments_Controller; |
| 289 | $controller = new WP_REST_Comments_Controller(); |
290 | 290 | $controller->register_routes(); |
291 | 291 | |
292 | 292 | $search_handlers = array( |
… |
… |
function create_initial_rest_routes() { |
318 | 318 | $controller->register_routes(); |
319 | 319 | |
320 | 320 | // Global Styles. |
321 | | $controller = new WP_REST_Global_Styles_Controller; |
| 321 | $controller = new WP_REST_Global_Styles_Controller(); |
322 | 322 | $controller->register_routes(); |
323 | 323 | |
324 | 324 | // Settings. |
325 | | $controller = new WP_REST_Settings_Controller; |
| 325 | $controller = new WP_REST_Settings_Controller(); |
326 | 326 | $controller->register_routes(); |
327 | 327 | |
328 | 328 | // Themes. |
329 | | $controller = new WP_REST_Themes_Controller; |
| 329 | $controller = new WP_REST_Themes_Controller(); |
330 | 330 | $controller->register_routes(); |
331 | 331 | |
332 | 332 | // Plugins. |
… |
… |
function rest_get_server() { |
562 | 562 | * @param string $class_name The name of the server class. Default 'WP_REST_Server'. |
563 | 563 | */ |
564 | 564 | $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(); |
566 | 566 | |
567 | 567 | /** |
568 | 568 | * Fires when preparing to serve a REST API request. |
-
diff --git a/src/wp-includes/rest-api/class-wp-rest-response.php b/src/wp-includes/rest-api/class-wp-rest-response.php
index cb890f5b0b..c6ea11be83 100644
a
|
b
|
class WP_REST_Response extends WP_HTTP_Response { |
227 | 227 | return null; |
228 | 228 | } |
229 | 229 | |
230 | | $error = new WP_Error; |
| 230 | $error = new WP_Error(); |
231 | 231 | |
232 | 232 | if ( is_array( $this->get_data() ) ) { |
233 | 233 | $data = $this->get_data(); |
-
diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php
index ff3c1dc42f..98c0a1bb64 100644
a
|
b
|
class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller { |
766 | 766 | |
767 | 767 | // Ensure empty details is an empty object. |
768 | 768 | if ( empty( $data['media_details'] ) ) { |
769 | | $data['media_details'] = new stdClass; |
| 769 | $data['media_details'] = new stdClass(); |
770 | 770 | } elseif ( ! empty( $data['media_details']['sizes'] ) ) { |
771 | 771 | |
772 | 772 | foreach ( $data['media_details']['sizes'] as $size => &$size_data ) { |
… |
… |
class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller { |
797 | 797 | ); |
798 | 798 | } |
799 | 799 | } else { |
800 | | $data['media_details']['sizes'] = new stdClass; |
| 800 | $data['media_details']['sizes'] = new stdClass(); |
801 | 801 | } |
802 | 802 | } |
803 | 803 | |
-
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 { |
274 | 274 | */ |
275 | 275 | $prepared_args = apply_filters( 'rest_comment_query', $prepared_args, $request ); |
276 | 276 | |
277 | | $query = new WP_Comment_Query; |
| 277 | $query = new WP_Comment_Query(); |
278 | 278 | $query_result = $query->query( $prepared_args ); |
279 | 279 | |
280 | 280 | $comments = array(); |
… |
… |
class WP_REST_Comments_Controller extends WP_REST_Controller { |
295 | 295 | // Out-of-bounds, run the query again without LIMIT for total count. |
296 | 296 | unset( $prepared_args['number'], $prepared_args['offset'] ); |
297 | 297 | |
298 | | $query = new WP_Comment_Query; |
| 298 | $query = new WP_Comment_Query(); |
299 | 299 | $prepared_args['count'] = true; |
300 | 300 | |
301 | 301 | $total_comments = $query->query( $prepared_args ); |
-
diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php
index 4ef48fa366..4fda654746 100644
a
|
b
|
class WP_REST_Terms_Controller extends WP_REST_Controller { |
807 | 807 | * @return object Term object. |
808 | 808 | */ |
809 | 809 | public function prepare_item_for_database( $request ) { |
810 | | $prepared_term = new stdClass; |
| 810 | $prepared_term = new stdClass(); |
811 | 811 | |
812 | 812 | $schema = $this->get_item_schema(); |
813 | 813 | if ( isset( $request['name'] ) && ! empty( $schema['properties']['name'] ) ) { |
-
diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php
index 52e8fcf0cd..62b9bc7e5d 100644
a
|
b
|
class WP_REST_Users_Controller extends WP_REST_Controller { |
1121 | 1121 | * @return object User object. |
1122 | 1122 | */ |
1123 | 1123 | protected function prepare_item_for_database( $request ) { |
1124 | | $prepared_user = new stdClass; |
| 1124 | $prepared_user = new stdClass(); |
1125 | 1125 | |
1126 | 1126 | $schema = $this->get_item_schema(); |
1127 | 1127 | |
-
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 { |
529 | 529 | |
530 | 530 | if ( ! empty( $widget_object->widget_options['show_instance_in_rest'] ) ) { |
531 | 531 | // 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; |
533 | 533 | } |
534 | 534 | |
535 | 535 | return rest_ensure_response( $response ); |
-
diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php
index e6ac11cf88..596e78aecf 100644
a
|
b
|
class WP_REST_Widgets_Controller extends WP_REST_Controller { |
715 | 715 | |
716 | 716 | if ( ! empty( $widget_object->widget_options['show_instance_in_rest'] ) ) { |
717 | 717 | // 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; |
719 | 719 | } |
720 | 720 | } |
721 | 721 | } |
-
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() { |
1331 | 1331 | } |
1332 | 1332 | |
1333 | 1333 | if ( empty( $headers ) ) { |
1334 | | return new stdClass; |
| 1334 | return new stdClass(); |
1335 | 1335 | } |
1336 | 1336 | |
1337 | 1337 | $_wp_random_header = (object) $headers[ array_rand( $headers ) ]; |
-
diff --git a/src/wp-includes/update.php b/src/wp-includes/update.php
index f352cab7c2..5136912037 100644
a
|
b
|
function wp_version_check( $extra_stats = array(), $force_check = false ) { |
44 | 44 | } |
45 | 45 | |
46 | 46 | if ( ! is_object( $current ) ) { |
47 | | $current = new stdClass; |
| 47 | $current = new stdClass(); |
48 | 48 | $current->updates = array(); |
49 | 49 | $current->version_checked = $wp_version; |
50 | 50 | } |
… |
… |
function wp_update_plugins( $extra_stats = array() ) { |
327 | 327 | $current = get_site_transient( 'update_plugins' ); |
328 | 328 | |
329 | 329 | if ( ! is_object( $current ) ) { |
330 | | $current = new stdClass; |
| 330 | $current = new stdClass(); |
331 | 331 | } |
332 | 332 | |
333 | | $updates = new stdClass; |
| 333 | $updates = new stdClass(); |
334 | 334 | $updates->last_checked = time(); |
335 | 335 | $updates->response = array(); |
336 | 336 | $updates->translations = array(); |
… |
… |
function wp_update_themes( $extra_stats = array() ) { |
595 | 595 | $last_update = get_site_transient( 'update_themes' ); |
596 | 596 | |
597 | 597 | if ( ! is_object( $last_update ) ) { |
598 | | $last_update = new stdClass; |
| 598 | $last_update = new stdClass(); |
599 | 599 | } |
600 | 600 | |
601 | 601 | $themes = array(); |
… |
… |
function wp_update_themes( $extra_stats = array() ) { |
734 | 734 | return; |
735 | 735 | } |
736 | 736 | |
737 | | $new_update = new stdClass; |
| 737 | $new_update = new stdClass(); |
738 | 738 | $new_update->last_checked = time(); |
739 | 739 | $new_update->checked = $checked; |
740 | 740 | |
… |
… |
function wp_maybe_auto_update() { |
846 | 846 | include_once ABSPATH . 'wp-admin/includes/admin.php'; |
847 | 847 | require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; |
848 | 848 | |
849 | | $upgrader = new WP_Automatic_Updater; |
| 849 | $upgrader = new WP_Automatic_Updater(); |
850 | 850 | $upgrader->run(); |
851 | 851 | } |
852 | 852 | |
-
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 ) { |
951 | 951 | |
952 | 952 | if ( ! is_multisite() ) { |
953 | 953 | $site_id = get_current_blog_id(); |
954 | | $sites = array( $site_id => new stdClass ); |
| 954 | $sites = array( $site_id => new stdClass() ); |
955 | 955 | $sites[ $site_id ]->userblog_id = $site_id; |
956 | 956 | $sites[ $site_id ]->blogname = get_option( 'blogname' ); |
957 | 957 | $sites[ $site_id ]->domain = ''; |
-
diff --git a/src/xmlrpc.php b/src/xmlrpc.php
index ecac4c7c7a..3f35815525 100644
a
|
b
|
$post_default_title = ''; |
81 | 81 | * @param string $class The name of the XML-RPC server class. |
82 | 82 | */ |
83 | 83 | $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(); |
85 | 85 | |
86 | 86 | // Fire off the request. |
87 | 87 | $wp_xmlrpc_server->serve_request(); |
-
diff --git a/tests/phpunit/includes/testcase-rest-controller.php b/tests/phpunit/includes/testcase-rest-controller.php
index 67a7970b66..9a4c2a0b61 100644
a
|
b
|
abstract class WP_Test_REST_Controller_Testcase extends WP_Test_REST_TestCase { |
9 | 9 | add_filter( 'rest_url', array( $this, 'filter_rest_url_for_leading_slash' ), 10, 2 ); |
10 | 10 | /** @var WP_REST_Server $wp_rest_server */ |
11 | 11 | global $wp_rest_server; |
12 | | $wp_rest_server = new Spy_REST_Server; |
| 12 | $wp_rest_server = new Spy_REST_Server(); |
13 | 13 | do_action( 'rest_api_init', $wp_rest_server ); |
14 | 14 | } |
15 | 15 | |
-
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 { |
37 | 37 | |
38 | 38 | register_post_type( 'content', array( 'show_in_admin_bar' => true ) ); |
39 | 39 | |
40 | | $admin_bar = new WP_Admin_Bar; |
| 40 | $admin_bar = new WP_Admin_Bar(); |
41 | 41 | |
42 | 42 | wp_admin_bar_new_content_menu( $admin_bar ); |
43 | 43 | |
… |
… |
class Tests_AdminBar extends WP_UnitTestCase { |
54 | 54 | public function test_merging_existing_meta_values() { |
55 | 55 | wp_set_current_user( self::$editor_id ); |
56 | 56 | |
57 | | $admin_bar = new WP_Admin_Bar; |
| 57 | $admin_bar = new WP_Admin_Bar(); |
58 | 58 | |
59 | 59 | $admin_bar->add_node( |
60 | 60 | array( |
-
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 { |
31 | 31 | $post = self::factory()->post->create_and_get( $args ); |
32 | 32 | |
33 | 33 | global $wp_rest_server; |
34 | | $wp_rest_server = new Spy_REST_Server; |
| 34 | $wp_rest_server = new Spy_REST_Server(); |
35 | 35 | do_action( 'rest_api_init', $wp_rest_server ); |
36 | 36 | } |
37 | 37 | |
-
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 { |
230 | 230 | // Make sure objects are cloned going to and from the cache. |
231 | 231 | public function test_object_refs() { |
232 | 232 | $key = __FUNCTION__ . '_1'; |
233 | | $object_a = new stdClass; |
| 233 | $object_a = new stdClass(); |
234 | 234 | $object_a->foo = 'alpha'; |
235 | 235 | $this->cache->set( $key, $object_a ); |
236 | 236 | $object_a->foo = 'bravo'; |
… |
… |
class Tests_Cache extends WP_UnitTestCase { |
240 | 240 | $this->assertSame( 'bravo', $object_a->foo ); |
241 | 241 | |
242 | 242 | $key = __FUNCTION__ . '_2'; |
243 | | $object_a = new stdClass; |
| 243 | $object_a = new stdClass(); |
244 | 244 | $object_a->foo = 'alpha'; |
245 | 245 | $this->cache->add( $key, $object_a ); |
246 | 246 | $object_a->foo = 'bravo'; |
-
diff --git a/tests/phpunit/tests/dependencies.php b/tests/phpunit/tests/dependencies.php
index 5f07f6b5f0..91971beb88 100644
a
|
b
|
|
5 | 5 | */ |
6 | 6 | class Tests_Dependencies extends WP_UnitTestCase { |
7 | 7 | public function test_add() { |
8 | | $dep = new WP_Dependencies; |
| 8 | $dep = new WP_Dependencies(); |
9 | 9 | |
10 | 10 | $this->assertTrue( $dep->add( 'one', '' ) ); |
11 | 11 | $this->assertTrue( $dep->add( 'two', '' ) ); |
… |
… |
class Tests_Dependencies extends WP_UnitTestCase { |
18 | 18 | } |
19 | 19 | |
20 | 20 | public function test_remove() { |
21 | | $dep = new WP_Dependencies; |
| 21 | $dep = new WP_Dependencies(); |
22 | 22 | |
23 | 23 | $this->assertTrue( $dep->add( 'one', '' ) ); |
24 | 24 | $this->assertTrue( $dep->add( 'two', '' ) ); |
… |
… |
class Tests_Dependencies extends WP_UnitTestCase { |
30 | 30 | } |
31 | 31 | |
32 | 32 | public function test_enqueue() { |
33 | | $dep = new WP_Dependencies; |
| 33 | $dep = new WP_Dependencies(); |
34 | 34 | |
35 | 35 | $this->assertTrue( $dep->add( 'one', '' ) ); |
36 | 36 | $this->assertTrue( $dep->add( 'two', '' ) ); |
… |
… |
class Tests_Dependencies extends WP_UnitTestCase { |
46 | 46 | } |
47 | 47 | |
48 | 48 | public function test_dequeue() { |
49 | | $dep = new WP_Dependencies; |
| 49 | $dep = new WP_Dependencies(); |
50 | 50 | |
51 | 51 | $this->assertTrue( $dep->add( 'one', '' ) ); |
52 | 52 | $this->assertTrue( $dep->add( 'two', '' ) ); |
… |
… |
class Tests_Dependencies extends WP_UnitTestCase { |
66 | 66 | } |
67 | 67 | |
68 | 68 | public function test_enqueue_args() { |
69 | | $dep = new WP_Dependencies; |
| 69 | $dep = new WP_Dependencies(); |
70 | 70 | |
71 | 71 | $this->assertTrue( $dep->add( 'one', '' ) ); |
72 | 72 | $this->assertTrue( $dep->add( 'two', '' ) ); |
… |
… |
class Tests_Dependencies extends WP_UnitTestCase { |
84 | 84 | } |
85 | 85 | |
86 | 86 | public function test_dequeue_args() { |
87 | | $dep = new WP_Dependencies; |
| 87 | $dep = new WP_Dependencies(); |
88 | 88 | |
89 | 89 | $this->assertTrue( $dep->add( 'one', '' ) ); |
90 | 90 | $this->assertTrue( $dep->add( 'two', '' ) ); |
… |
… |
class Tests_Dependencies extends WP_UnitTestCase { |
111 | 111 | * @ticket 21741 |
112 | 112 | */ |
113 | 113 | public function test_query_and_registered_enqueued() { |
114 | | $dep = new WP_Dependencies; |
| 114 | $dep = new WP_Dependencies(); |
115 | 115 | |
116 | 116 | $this->assertTrue( $dep->add( 'one', '' ) ); |
117 | 117 | $this->assertInstanceOf( '_WP_Dependency', $dep->query( 'one' ) ); |
… |
… |
class Tests_Dependencies extends WP_UnitTestCase { |
136 | 136 | } |
137 | 137 | |
138 | 138 | function test_enqueue_before_register() { |
139 | | $dep = new WP_Dependencies; |
| 139 | $dep = new WP_Dependencies(); |
140 | 140 | |
141 | 141 | $this->assertArrayNotHasKey( 'one', $dep->registered ); |
142 | 142 | |
-
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 { |
10 | 10 | * @covers WP_Scripts::query |
11 | 11 | */ |
12 | 12 | public function test_location_of_jquery() { |
13 | | $scripts = new WP_Scripts; |
| 13 | $scripts = new WP_Scripts(); |
14 | 14 | wp_default_scripts( $scripts ); |
15 | 15 | |
16 | 16 | if ( SCRIPT_DEBUG ) { |
… |
… |
class Tests_Dependencies_jQuery extends WP_UnitTestCase { |
106 | 106 | * @covers WP_Scripts::do_items |
107 | 107 | */ |
108 | 108 | public function test_jquery_in_footer() { |
109 | | $scripts = new WP_Scripts; |
| 109 | $scripts = new WP_Scripts(); |
110 | 110 | $scripts->add( 'jquery', false, array( 'jquery-core', 'jquery-migrate' ) ); |
111 | 111 | $scripts->add( 'jquery-core', '/jquery.js', array() ); |
112 | 112 | $scripts->add( 'jquery-migrate', '/jquery-migrate.js', array() ); |
-
diff --git a/tests/phpunit/tests/dependencies/scripts.php b/tests/phpunit/tests/dependencies/scripts.php
index b64edfeff9..3897c6aa25 100644
a
|
b
|
JS; |
276 | 276 | * @covers WP_Dependencies::do_items |
277 | 277 | */ |
278 | 278 | public function test_group_mismatch_in_deps() { |
279 | | $scripts = new WP_Scripts; |
| 279 | $scripts = new WP_Scripts(); |
280 | 280 | $scripts->add( 'one', 'one', array(), 'v1', 1 ); |
281 | 281 | $scripts->add( 'two', 'two', array( 'one' ) ); |
282 | 282 | $scripts->add( 'three', 'three', array( 'two' ), 'v1', 1 ); |
… |
… |
JS; |
295 | 295 | $this->assertContains( 'two', $scripts->done ); |
296 | 296 | $this->assertContains( 'three', $scripts->done ); |
297 | 297 | |
298 | | $scripts = new WP_Scripts; |
| 298 | $scripts = new WP_Scripts(); |
299 | 299 | $scripts->add( 'one', 'one', array(), 'v1', 1 ); |
300 | 300 | $scripts->add( 'two', 'two', array( 'one' ), 'v1', 1 ); |
301 | 301 | $scripts->add( 'three', 'three', array( 'one' ) ); |
-
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 { |
105 | 105 | '', |
106 | 106 | ), |
107 | 107 | array( |
108 | | new WP_Query, |
| 108 | new WP_Query(), |
109 | 109 | '', |
110 | 110 | ), |
111 | 111 | array( |
-
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 { |
26 | 26 | $this->assertSame( $arr, stripslashes_deep( $arr ) ); // Keyed array. |
27 | 27 | $this->assertSame( array_values( $arr ), stripslashes_deep( array_values( $arr ) ) ); // Non-keyed. |
28 | 28 | |
29 | | $obj = new stdClass; |
| 29 | $obj = new stdClass(); |
30 | 30 | foreach ( $arr as $k => $v ) { |
31 | 31 | $obj->$k = $v; |
32 | 32 | } |
… |
… |
class Tests_Formatting_StripslashesDeep extends WP_UnitTestCase { |
41 | 41 | $this->assertSame( array( 'a' => $new ), stripslashes_deep( array( 'a' => $old ) ) ); // Keyed array. |
42 | 42 | $this->assertSame( array( $new ), stripslashes_deep( array( $old ) ) ); // Non-keyed. |
43 | 43 | |
44 | | $obj_old = new stdClass; |
| 44 | $obj_old = new stdClass(); |
45 | 45 | $obj_old->a = $old; |
46 | | $obj_new = new stdClass; |
| 46 | $obj_new = new stdClass(); |
47 | 47 | $obj_new->a = $new; |
48 | 48 | $this->assertEquals( $obj_new, stripslashes_deep( $obj_old ) ); |
49 | 49 | } |
-
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 { |
84 | 84 | $this->assertSame( $arr, wp_slash( $arr ) ); // Keyed array. |
85 | 85 | $this->assertSame( array_values( $arr ), wp_slash( array_values( $arr ) ) ); // Non-keyed. |
86 | 86 | |
87 | | $obj = new stdClass; |
| 87 | $obj = new stdClass(); |
88 | 88 | foreach ( $arr as $k => $v ) { |
89 | 89 | $obj->$k = $v; |
90 | 90 | } |
-
diff --git a/tests/phpunit/tests/functions.php b/tests/phpunit/tests/functions.php
index 7f855e110f..42d70fd774 100644
a
|
b
|
|
5 | 5 | */ |
6 | 6 | class Tests_Functions extends WP_UnitTestCase { |
7 | 7 | public function test_wp_parse_args_object() { |
8 | | $x = new MockClass; |
| 8 | $x = new MockClass(); |
9 | 9 | $x->_baba = 5; |
10 | 10 | $x->yZ = 'baba'; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase |
11 | 11 | $x->a = array( 5, 111, 'x' ); |
… |
… |
class Tests_Functions extends WP_UnitTestCase { |
17 | 17 | ), |
18 | 18 | wp_parse_args( $x ) |
19 | 19 | ); |
20 | | $y = new MockClass; |
| 20 | $y = new MockClass(); |
21 | 21 | $this->assertSame( array(), wp_parse_args( $y ) ); |
22 | 22 | } |
23 | 23 | |
… |
… |
class Tests_Functions extends WP_UnitTestCase { |
41 | 41 | } |
42 | 42 | |
43 | 43 | public function test_wp_parse_args_defaults() { |
44 | | $x = new MockClass; |
| 44 | $x = new MockClass(); |
45 | 45 | $x->_baba = 5; |
46 | 46 | $x->yZ = 'baba'; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase |
47 | 47 | $x->a = array( 5, 111, 'x' ); |
… |
… |
class Tests_Functions extends WP_UnitTestCase { |
1113 | 1113 | * @ticket 28786 |
1114 | 1114 | */ |
1115 | 1115 | public function test_wp_json_encode_object() { |
1116 | | $object = new stdClass; |
| 1116 | $object = new stdClass(); |
1117 | 1117 | $object->a = 'b'; |
1118 | 1118 | $this->assertSame( wp_json_encode( $object ), '{"a":"b"}' ); |
1119 | 1119 | } |
-
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 { |
33 | 33 | |
34 | 34 | // Regex based parser cannot detect malformed XML. |
35 | 35 | foreach ( array( 'WXR_Parser_SimpleXML', 'WXR_Parser_XML' ) as $p ) { |
36 | | $parser = new $p; |
| 36 | $parser = new $p(); |
37 | 37 | $result = $parser->parse( $file ); |
38 | 38 | $this->assertWPError( $result ); |
39 | 39 | $this->assertSame( 'There was an error when reading this WXR file', $result->get_error_message() ); |
… |
… |
class Tests_Import_Parser extends WP_Import_UnitTestCase { |
51 | 51 | |
52 | 52 | foreach ( array( 'WXR_Parser_SimpleXML', 'WXR_Parser_XML', 'WXR_Parser_Regex' ) as $p ) { |
53 | 53 | foreach ( array( $f1, $f2 ) as $file ) { |
54 | | $parser = new $p; |
| 54 | $parser = new $p(); |
55 | 55 | $result = $parser->parse( $file ); |
56 | 56 | $this->assertWPError( $result ); |
57 | 57 | $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 { |
69 | 69 | |
70 | 70 | foreach ( array( 'WXR_Parser_SimpleXML', 'WXR_Parser_XML', 'WXR_Parser_Regex' ) as $p ) { |
71 | 71 | $message = $p . ' failed'; |
72 | | $parser = new $p; |
| 72 | $parser = new $p(); |
73 | 73 | $result = $parser->parse( $file ); |
74 | 74 | |
75 | 75 | $this->assertIsArray( $result, $message ); |
… |
… |
class Tests_Import_Parser extends WP_Import_UnitTestCase { |
167 | 167 | |
168 | 168 | foreach ( array( 'WXR_Parser_SimpleXML', 'WXR_Parser_XML', 'WXR_Parser_Regex' ) as $p ) { |
169 | 169 | $message = $p . ' failed'; |
170 | | $parser = new $p; |
| 170 | $parser = new $p(); |
171 | 171 | $result = $parser->parse( $file ); |
172 | 172 | |
173 | 173 | $this->assertIsArray( $result, $message ); |
… |
… |
class Tests_Import_Parser extends WP_Import_UnitTestCase { |
265 | 265 | |
266 | 266 | foreach ( array( 'WXR_Parser_SimpleXML', 'WXR_Parser_XML', 'WXR_Parser_Regex' ) as $p ) { |
267 | 267 | $message = 'Parser ' . $p; |
268 | | $parser = new $p; |
| 268 | $parser = new $p(); |
269 | 269 | $result = $parser->parse( $file ); |
270 | 270 | |
271 | 271 | $post = $result['posts'][0]; |
… |
… |
class Tests_Import_Parser extends WP_Import_UnitTestCase { |
298 | 298 | public function test_unescaped_cdata_closing_sequence() { |
299 | 299 | $file = DIR_TESTDATA . '/export/crazy-cdata.xml'; |
300 | 300 | |
301 | | $parser = new WXR_Parser_Regex; |
| 301 | $parser = new WXR_Parser_Regex(); |
302 | 302 | $result = $parser->parse( $file ); |
303 | 303 | |
304 | 304 | $post = $result['posts'][0]; |
-
diff --git a/tests/phpunit/tests/media.php b/tests/phpunit/tests/media.php
index 27eac8c3bb..3a8e6544d2 100644
a
|
b
|
https://w.org</a>', |
360 | 360 | * @dataProvider data_autoembed |
361 | 361 | */ |
362 | 362 | public function test_autoembed( $content, $result = null ) { |
363 | | $wp_embed = new Test_Autoembed; |
| 363 | $wp_embed = new Test_Autoembed(); |
364 | 364 | |
365 | 365 | $this->assertSame( $wp_embed->autoembed( $content ), $result ? $result : $content ); |
366 | 366 | } |
-
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 { |
13 | 13 | } |
14 | 14 | |
15 | 15 | $data = array(); |
16 | | $data[0] = new StdClass; |
| 16 | $data[0] = new StdClass(); |
17 | 17 | $data[0]->name = 'yesorno'; |
18 | 18 | $data[0]->value = 'yes'; |
19 | 19 | $_POST['nav-menu-data'] = addslashes( json_encode( $data ) ); |
… |
… |
class Tests_Menu_WpExpandNavMenuPostData extends WP_UnitTestCase { |
36 | 36 | } |
37 | 37 | |
38 | 38 | $data = array(); |
39 | | $data[0] = new StdClass; |
| 39 | $data[0] = new StdClass(); |
40 | 40 | $data[0]->name = 'would[1][do][the][trick]'; |
41 | 41 | $data[0]->value = 'yes'; |
42 | 42 | $_POST['nav-menu-data'] = addslashes( json_encode( $data ) ); |
… |
… |
class Tests_Menu_WpExpandNavMenuPostData extends WP_UnitTestCase { |
66 | 66 | } |
67 | 67 | |
68 | 68 | $data = array(); |
69 | | $data[0] = new StdClass; |
| 69 | $data[0] = new StdClass(); |
70 | 70 | $data[0]->name = 'would[1][do][the][trick]'; |
71 | 71 | $data[0]->value = 'yes'; |
72 | | $data[1] = new StdClass; |
| 72 | $data[1] = new StdClass(); |
73 | 73 | $data[1]->name = 'would[2][do][the][trick]'; |
74 | 74 | $data[1]->value = 'yes'; |
75 | | $data[2] = new StdClass; |
| 75 | $data[2] = new StdClass(); |
76 | 76 | $data[2]->name = 'would[2][do][the][job]'; |
77 | 77 | $data[2]->value = 'yes'; |
78 | 78 | $_POST['nav-menu-data'] = addslashes( json_encode( $data ) ); |
-
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 { |
401 | 401 | * @ticket 15030 |
402 | 402 | */ |
403 | 403 | public function test_get_metadata_with_empty_key_object_value() { |
404 | | $data = new stdClass; |
| 404 | $data = new stdClass(); |
405 | 405 | $data->foo = 'bar'; |
406 | 406 | $value = serialize( $data ); |
407 | 407 | add_metadata( 'user', $this->author->ID, 'foo', $data ); |
-
diff --git a/tests/phpunit/tests/oembed/controller.php b/tests/phpunit/tests/oembed/controller.php
index 6b674b7291..17262d66f4 100644
a
|
b
|
class Test_oEmbed_Controller extends WP_UnitTestCase { |
49 | 49 | |
50 | 50 | /** @var WP_REST_Server $wp_rest_server */ |
51 | 51 | global $wp_rest_server; |
52 | | $wp_rest_server = new Spy_REST_Server; |
| 52 | $wp_rest_server = new Spy_REST_Server(); |
53 | 53 | do_action( 'rest_api_init', $wp_rest_server ); |
54 | 54 | |
55 | 55 | add_filter( 'pre_http_request', array( $this, 'mock_embed_request' ), 10, 3 ); |
-
diff --git a/tests/phpunit/tests/pomo/mo.php b/tests/phpunit/tests/pomo/mo.php
index 6d5f539467..7ae73abf6c 100644
a
|
b
|
class Tests_POMO_MO extends WP_UnitTestCase { |
144 | 144 | |
145 | 145 | public function test_export_should_not_include_empty_translations() { |
146 | 146 | $entries = array(); |
147 | | $mo = new MO; |
| 147 | $mo = new MO(); |
148 | 148 | $mo->add_entry( |
149 | 149 | array( |
150 | 150 | 'singular' => 'baba', |
-
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 { |
28 | 28 | |
29 | 29 | public function set_up() { |
30 | 30 | parent::set_up(); |
31 | | $this->noop = new NOOP_Translations; |
| 31 | $this->noop = new NOOP_Translations(); |
32 | 32 | $this->entry = new Translation_Entry( array( 'singular' => 'baba' ) ); |
33 | 33 | $this->plural_entry = new Translation_Entry( |
34 | 34 | array( |
-
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 { |
121 | 121 | $domain = new Translations(); |
122 | 122 | $domain->add_entry( $entry_digit_1 ); |
123 | 123 | $domain->add_entry( $entry_digit_2 ); |
124 | | $dummy_translation = new Translations; |
| 124 | $dummy_translation = new Translations(); |
125 | 125 | $this->assertSame( '1', $domain->translate( '1' ) ); |
126 | 126 | $domain->merge_with( $dummy_translation ); |
127 | 127 | $this->assertSame( '1', $domain->translate( '1' ) ); |
-
diff --git a/tests/phpunit/tests/post.php b/tests/phpunit/tests/post.php
index 551cbd8c56..484b890af4 100644
a
|
b
|
class Tests_Post extends WP_UnitTestCase { |
158 | 158 | |
159 | 159 | _unregister_post_type( $post_type ); |
160 | 160 | $count = wp_count_posts( $post_type, 'readable' ); |
161 | | $this->assertEquals( new stdClass, $count ); |
| 161 | $this->assertEquals( new stdClass(), $count ); |
162 | 162 | } |
163 | 163 | |
164 | 164 | public function test_wp_count_posts_filtered() { |
… |
… |
class Tests_Post extends WP_UnitTestCase { |
601 | 601 | '1 int' => array( 1 ), |
602 | 602 | 'null' => array( null ), |
603 | 603 | 'true' => array( true ), |
604 | | 'an object' => array( new stdClass ), |
| 604 | 'an object' => array( new stdClass() ), |
605 | 605 | ); |
606 | 606 | } |
607 | 607 | |
-
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 { |
166 | 166 | $mid = add_post_meta( self::$post_id, 'get_post_meta_by_key', 'get_post_meta_by_key_value', true ); |
167 | 167 | $this->assertIsInt( $mid ); |
168 | 168 | |
169 | | $mobj = new stdClass; |
| 169 | $mobj = new stdClass(); |
170 | 170 | $mobj->meta_id = $mid; |
171 | 171 | $mobj->post_id = self::$post_id; |
172 | 172 | $mobj->meta_key = 'get_post_meta_by_key'; |
-
diff --git a/tests/phpunit/tests/post/types.php b/tests/phpunit/tests/post/types.php
index 5ea10cbb2c..df1543fa0c 100644
a
|
b
|
class Tests_Post_Types extends WP_UnitTestCase { |
256 | 256 | $this->assertNotNull( get_post_type_object( 'foo' ) ); |
257 | 257 | $this->assertNull( get_post_type_object( array() ) ); |
258 | 258 | $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() ) ); |
260 | 260 | |
261 | 261 | _unregister_post_type( 'foo' ); |
262 | 262 | |
-
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 { |
33 | 33 | * @ticket 16471 |
34 | 34 | */ |
35 | 35 | public function test_default_query_var() { |
36 | | $query = new WP_Query; |
| 36 | $query = new WP_Query(); |
37 | 37 | $this->assertSame( '', $query->get( 'nonexistent' ) ); |
38 | 38 | $this->assertFalse( $query->get( 'nonexistent', false ) ); |
39 | 39 | $this->assertTrue( $query->get( 'nonexistent', true ) ); |
-
diff --git a/tests/phpunit/tests/query/generatePostdata.php b/tests/phpunit/tests/query/generatePostdata.php
index c223e4b598..5d39dfb5d4 100644
a
|
b
|
class Tests_Query_GeneratePostdata extends WP_UnitTestCase { |
19 | 19 | * @ticket 42814 |
20 | 20 | */ |
21 | 21 | public function test_setup_by_fake_post() { |
22 | | $fake = new stdClass; |
| 22 | $fake = new stdClass(); |
23 | 23 | $fake->ID = 98765; |
24 | 24 | $data = generate_postdata( $fake->ID ); |
25 | 25 | |
-
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 { |
33 | 33 | * @ticket 30970 |
34 | 34 | */ |
35 | 35 | public function test_setup_by_fake_post() { |
36 | | $fake = new stdClass; |
| 36 | $fake = new stdClass(); |
37 | 37 | $fake->ID = 98765; |
38 | 38 | setup_postdata( $fake->ID ); |
39 | 39 | |
-
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 { |
620 | 620 | * @ticket 47620 |
621 | 621 | */ |
622 | 622 | public function test_prepare_item() { |
623 | | $registry = new WP_Block_Type_Registry; |
| 623 | $registry = new WP_Block_Type_Registry(); |
624 | 624 | $settings = array( |
625 | 625 | 'icon' => 'text', |
626 | 626 | 'render_callback' => '__return_null', |
627 | 627 | ); |
628 | 628 | $registry->register( 'fake/line', $settings ); |
629 | 629 | $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(); |
632 | 632 | $request->set_param( 'context', 'edit' ); |
633 | 633 | $response = $endpoint->prepare_item_for_response( $block_type, $request ); |
634 | 634 | $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 { |
638 | 638 | * @ticket 47620 |
639 | 639 | */ |
640 | 640 | public function test_prepare_item_limit_fields() { |
641 | | $registry = new WP_Block_Type_Registry; |
| 641 | $registry = new WP_Block_Type_Registry(); |
642 | 642 | $settings = array( |
643 | 643 | 'icon' => 'text', |
644 | 644 | 'render_callback' => '__return_null', |
645 | 645 | ); |
646 | 646 | $registry->register( 'fake/line', $settings ); |
647 | 647 | $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(); |
650 | 650 | $request->set_param( 'context', 'edit' ); |
651 | 651 | $request->set_param( '_fields', 'name' ); |
652 | 652 | $response = $endpoint->prepare_item_for_response( $block_type, $request ); |
-
diff --git a/tests/phpunit/tests/rest-api/rest-categories-controller.php b/tests/phpunit/tests/rest-api/rest-categories-controller.php
index 8ccad4fe2e..13b0eb1a7f 100644
a
|
b
|
class WP_Test_REST_Categories_Controller extends WP_Test_REST_Controller_Testcas |
1093 | 1093 | } |
1094 | 1094 | |
1095 | 1095 | public function test_prepare_item_limit_fields() { |
1096 | | $request = new WP_REST_Request; |
| 1096 | $request = new WP_REST_Request(); |
1097 | 1097 | $endpoint = new WP_REST_Terms_Controller( 'category' ); |
1098 | 1098 | $request->set_param( '_fields', 'id,name' ); |
1099 | 1099 | $term = get_term( 1, 'category' ); |
-
diff --git a/tests/phpunit/tests/rest-api/rest-comments-controller.php b/tests/phpunit/tests/rest-api/rest-comments-controller.php
index 931aa626cf..3d4f33ab28 100644
a
|
b
|
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
152 | 152 | |
153 | 153 | public function set_up() { |
154 | 154 | parent::set_up(); |
155 | | $this->endpoint = new WP_REST_Comments_Controller; |
| 155 | $this->endpoint = new WP_REST_Comments_Controller(); |
156 | 156 | if ( is_multisite() ) { |
157 | 157 | update_site_option( 'site_admins', array( 'superadmin' ) ); |
158 | 158 | } |
… |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
953 | 953 | public function test_prepare_item_limit_fields() { |
954 | 954 | wp_set_current_user( self::$admin_id ); |
955 | 955 | |
956 | | $endpoint = new WP_REST_Comments_Controller; |
| 956 | $endpoint = new WP_REST_Comments_Controller(); |
957 | 957 | $request = new WP_REST_Request( 'GET', sprintf( '/wp/v2/comments/%d', self::$approved_id ) ); |
958 | 958 | $request->set_param( 'context', 'edit' ); |
959 | 959 | $request->set_param( '_fields', 'id,status' ); |
-
diff --git a/tests/phpunit/tests/rest-api/rest-post-meta-fields.php b/tests/phpunit/tests/rest-api/rest-post-meta-fields.php
index cc804a80fc..7101a38c7c 100644
a
|
b
|
class WP_Test_REST_Post_Meta_Fields extends WP_Test_REST_TestCase { |
247 | 247 | |
248 | 248 | /** @var WP_REST_Server $wp_rest_server */ |
249 | 249 | global $wp_rest_server; |
250 | | $wp_rest_server = new Spy_REST_Server; |
| 250 | $wp_rest_server = new Spy_REST_Server(); |
251 | 251 | do_action( 'rest_api_init', $wp_rest_server ); |
252 | 252 | } |
253 | 253 | |
… |
… |
class WP_Test_REST_Post_Meta_Fields extends WP_Test_REST_TestCase { |
380 | 380 | |
381 | 381 | /** @var WP_REST_Server $wp_rest_server */ |
382 | 382 | global $wp_rest_server; |
383 | | $wp_rest_server = new Spy_REST_Server; |
| 383 | $wp_rest_server = new Spy_REST_Server(); |
384 | 384 | do_action( 'rest_api_init', $wp_rest_server ); |
385 | 385 | |
386 | 386 | add_post_meta( self::$post_id, 'test_string', 42 ); |
-
diff --git a/tests/phpunit/tests/rest-api/rest-post-statuses-controller.php b/tests/phpunit/tests/rest-api/rest-post-statuses-controller.php
index 901e8bb357..2f1e92cbae 100644
a
|
b
|
class WP_Test_REST_Post_Statuses_Controller extends WP_Test_REST_Controller_Test |
125 | 125 | |
126 | 126 | public function test_prepare_item() { |
127 | 127 | $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(); |
130 | 130 | $request->set_param( 'context', 'edit' ); |
131 | 131 | $data = $endpoint->prepare_item_for_response( $obj, $request ); |
132 | 132 | $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 |
134 | 134 | |
135 | 135 | public function test_prepare_item_limit_fields() { |
136 | 136 | $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(); |
139 | 139 | $request->set_param( 'context', 'edit' ); |
140 | 140 | $request->set_param( '_fields', 'id,name' ); |
141 | 141 | $response = $endpoint->prepare_item_for_response( $obj, $request ); |
-
diff --git a/tests/phpunit/tests/rest-api/rest-post-types-controller.php b/tests/phpunit/tests/rest-api/rest-post-types-controller.php
index 58e1698426..a56aefa4ad 100644
a
|
b
|
class WP_Test_REST_Post_Types_Controller extends WP_Test_REST_Controller_Testcas |
133 | 133 | |
134 | 134 | public function test_prepare_item() { |
135 | 135 | $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(); |
138 | 138 | $request->set_param( 'context', 'edit' ); |
139 | 139 | $response = $endpoint->prepare_item_for_response( $obj, $request ); |
140 | 140 | $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 |
142 | 142 | |
143 | 143 | public function test_prepare_item_limit_fields() { |
144 | 144 | $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(); |
147 | 147 | $request->set_param( 'context', 'edit' ); |
148 | 148 | $request->set_param( '_fields', 'id,name' ); |
149 | 149 | $response = $endpoint->prepare_item_for_response( $obj, $request ); |
-
diff --git a/tests/phpunit/tests/rest-api/rest-schema-setup.php b/tests/phpunit/tests/rest-api/rest-schema-setup.php
index afc1ebc125..c58af7c346 100644
a
|
b
|
class WP_Test_REST_Schema_Initialization extends WP_Test_REST_TestCase { |
20 | 20 | |
21 | 21 | /** @var WP_REST_Server $wp_rest_server */ |
22 | 22 | global $wp_rest_server; |
23 | | $wp_rest_server = new Spy_REST_Server; |
| 23 | $wp_rest_server = new Spy_REST_Server(); |
24 | 24 | do_action( 'rest_api_init', $wp_rest_server ); |
25 | 25 | |
26 | 26 | add_filter( 'pre_http_request', array( $this, 'mock_embed_request' ), 10, 3 ); |
-
diff --git a/tests/phpunit/tests/rest-api/rest-tags-controller.php b/tests/phpunit/tests/rest-api/rest-tags-controller.php
index 88fb0c20c7..fd25e0de83 100644
a
|
b
|
class WP_Test_REST_Tags_Controller extends WP_Test_REST_Controller_Testcase { |
1211 | 1211 | } |
1212 | 1212 | |
1213 | 1213 | public function test_prepare_item_limit_fields() { |
1214 | | $request = new WP_REST_Request; |
| 1214 | $request = new WP_REST_Request(); |
1215 | 1215 | $endpoint = new WP_REST_Terms_Controller( 'post_tag' ); |
1216 | 1216 | $request->set_param( '_fields', 'id,name' ); |
1217 | 1217 | $term = get_term_by( 'id', self::factory()->tag->create(), 'post_tag' ); |
-
diff --git a/tests/phpunit/tests/rest-api/rest-taxonomies-controller.php b/tests/phpunit/tests/rest-api/rest-taxonomies-controller.php
index 78593e6bd8..e2901c6307 100644
a
|
b
|
class WP_Test_REST_Taxonomies_Controller extends WP_Test_REST_Controller_Testcas |
174 | 174 | |
175 | 175 | public function test_prepare_item() { |
176 | 176 | $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(); |
179 | 179 | $request->set_param( 'context', 'edit' ); |
180 | 180 | $response = $endpoint->prepare_item_for_response( $tax, $request ); |
181 | 181 | $this->check_taxonomy_object( 'edit', $tax, $response->get_data(), $response->get_links() ); |
… |
… |
class WP_Test_REST_Taxonomies_Controller extends WP_Test_REST_Controller_Testcas |
183 | 183 | |
184 | 184 | public function test_prepare_item_limit_fields() { |
185 | 185 | $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(); |
188 | 188 | $request->set_param( 'context', 'edit' ); |
189 | 189 | $request->set_param( '_fields', 'id,name' ); |
190 | 190 | $response = $endpoint->prepare_item_for_response( $tax, $request ); |
-
diff --git a/tests/phpunit/tests/rest-api/rest-term-meta-fields.php b/tests/phpunit/tests/rest-api/rest-term-meta-fields.php
index 5a61623387..21d4ca86cd 100644
a
|
b
|
class WP_Test_REST_Term_Meta_Fields extends WP_Test_REST_TestCase { |
194 | 194 | |
195 | 195 | /** @var WP_REST_Server $wp_rest_server */ |
196 | 196 | global $wp_rest_server; |
197 | | $wp_rest_server = new Spy_REST_Server; |
| 197 | $wp_rest_server = new Spy_REST_Server(); |
198 | 198 | do_action( 'rest_api_init', $wp_rest_server ); |
199 | 199 | } |
200 | 200 | |
… |
… |
class WP_Test_REST_Term_Meta_Fields extends WP_Test_REST_TestCase { |
327 | 327 | |
328 | 328 | /** @var WP_REST_Server $wp_rest_server */ |
329 | 329 | global $wp_rest_server; |
330 | | $wp_rest_server = new Spy_REST_Server; |
| 330 | $wp_rest_server = new Spy_REST_Server(); |
331 | 331 | do_action( 'rest_api_init', $wp_rest_server ); |
332 | 332 | |
333 | 333 | add_term_meta( self::$category_id, 'test_string', 42 ); |
-
diff --git a/tests/phpunit/tests/rest-api/rest-users-controller.php b/tests/phpunit/tests/rest-api/rest-users-controller.php
index 7a7193b3c6..3952543e4f 100644
a
|
b
|
class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { |
973 | 973 | public function test_prepare_item() { |
974 | 974 | wp_set_current_user( self::$user ); |
975 | 975 | |
976 | | $request = new WP_REST_Request; |
| 976 | $request = new WP_REST_Request(); |
977 | 977 | $request->set_param( 'context', 'edit' ); |
978 | 978 | $user = get_user_by( 'id', get_current_user_id() ); |
979 | 979 | $data = $this->endpoint->prepare_item_for_response( $user, $request ); |
… |
… |
class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { |
983 | 983 | public function test_prepare_item_limit_fields() { |
984 | 984 | wp_set_current_user( self::$user ); |
985 | 985 | |
986 | | $request = new WP_REST_Request; |
| 986 | $request = new WP_REST_Request(); |
987 | 987 | $request->set_param( 'context', 'edit' ); |
988 | 988 | $request->set_param( '_fields', 'id,name' ); |
989 | 989 | $user = get_user_by( 'id', get_current_user_id() ); |
-
diff --git a/tests/phpunit/tests/rest-api/rest-widget-types-controller.php b/tests/phpunit/tests/rest-api/rest-widget-types-controller.php
index 5c6f22bfee..5074205fb7 100644
a
|
b
|
class WP_Test_REST_Widget_Types_Controller extends WP_Test_REST_Controller_Testc |
118 | 118 | $response = rest_get_server()->dispatch( $request ); |
119 | 119 | $data = $response->get_data(); |
120 | 120 | $this->assertGreaterThan( 1, count( $data ) ); |
121 | | $endpoint = new WP_REST_Widget_Types_Controller; |
| 121 | $endpoint = new WP_REST_Widget_Types_Controller(); |
122 | 122 | foreach ( $data as $item ) { |
123 | 123 | $widget_type = $endpoint->get_widget( $item['name'] ); |
124 | 124 | $this->check_widget_type_object( $widget_type, $item, $item['_links'] ); |
… |
… |
class WP_Test_REST_Widget_Types_Controller extends WP_Test_REST_Controller_Testc |
180 | 180 | wp_set_current_user( self::$admin_id ); |
181 | 181 | $request = new WP_REST_Request( 'GET', '/wp/v2/widget-types/' . $widget_name ); |
182 | 182 | $response = rest_get_server()->dispatch( $request ); |
183 | | $endpoint = new WP_REST_Widget_Types_Controller; |
| 183 | $endpoint = new WP_REST_Widget_Types_Controller(); |
184 | 184 | $widget_type = $endpoint->get_widget( $widget_name ); |
185 | 185 | $this->check_widget_type_object( $widget_type, $response->get_data(), $response->get_links() ); |
186 | 186 | } |
… |
… |
class WP_Test_REST_Widget_Types_Controller extends WP_Test_REST_Controller_Testc |
198 | 198 | wp_set_current_user( self::$admin_id ); |
199 | 199 | $request = new WP_REST_Request( 'GET', '/wp/v2/widget-types/' . $widget_id ); |
200 | 200 | $response = rest_get_server()->dispatch( $request ); |
201 | | $endpoint = new WP_REST_Widget_Types_Controller; |
| 201 | $endpoint = new WP_REST_Widget_Types_Controller(); |
202 | 202 | $widget_type = $endpoint->get_widget( $widget_id ); |
203 | 203 | $this->check_widget_type_object( $widget_type, $response->get_data(), $response->get_links() ); |
204 | 204 | } |
… |
… |
class WP_Test_REST_Widget_Types_Controller extends WP_Test_REST_Controller_Testc |
298 | 298 | * @ticket 41683 |
299 | 299 | */ |
300 | 300 | public function test_prepare_item() { |
301 | | $endpoint = new WP_REST_Widget_Types_Controller; |
| 301 | $endpoint = new WP_REST_Widget_Types_Controller(); |
302 | 302 | $widget_type = $endpoint->get_widget( 'calendar' ); |
303 | | $request = new WP_REST_Request; |
| 303 | $request = new WP_REST_Request(); |
304 | 304 | $request->set_param( 'context', 'edit' ); |
305 | 305 | $response = $endpoint->prepare_item_for_response( $widget_type, $request ); |
306 | 306 | $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 |
366 | 366 | array( |
367 | 367 | 'encoded' => base64_encode( serialize( array() ) ), |
368 | 368 | 'hash' => wp_hash( serialize( array() ) ), |
369 | | 'raw' => new stdClass, |
| 369 | 'raw' => new stdClass(), |
370 | 370 | ), |
371 | 371 | $data['instance'] |
372 | 372 | ); |
… |
… |
class WP_Test_REST_Widget_Types_Controller extends WP_Test_REST_Controller_Testc |
402 | 402 | array( |
403 | 403 | 'encoded' => base64_encode( serialize( array() ) ), |
404 | 404 | 'hash' => wp_hash( serialize( array() ) ), |
405 | | 'raw' => new stdClass, |
| 405 | 'raw' => new stdClass(), |
406 | 406 | ), |
407 | 407 | $data['instance'] |
408 | 408 | ); |