Make WordPress Core


Ignore:
Timestamp:
11/29/2022 03:49:49 PM (2 years ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Always use parentheses when instantiating an object.

Note: This will be enforced by WPCS 3.0.0.

Props jrf.
See #56791.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/rest-api/rest-widget-types-controller.php

    r54058 r54891  
    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'] );
     
    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() );
     
    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() );
     
    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 );
     
    367367                'encoded' => base64_encode( serialize( array() ) ),
    368368                'hash'    => wp_hash( serialize( array() ) ),
    369                 'raw'     => new stdClass,
     369                'raw'     => new stdClass(),
    370370            ),
    371371            $data['instance']
     
    403403                'encoded' => base64_encode( serialize( array() ) ),
    404404                'hash'    => wp_hash( serialize( array() ) ),
    405                 'raw'     => new stdClass,
     405                'raw'     => new stdClass(),
    406406            ),
    407407            $data['instance']
Note: See TracChangeset for help on using the changeset viewer.