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/functions.php

    r54889 r54891  
    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
     
    1818            wp_parse_args( $x )
    1919        );
    20         $y = new MockClass;
     20        $y = new MockClass();
    2121        $this->assertSame( array(), wp_parse_args( $y ) );
    2222    }
     
    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
     
    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"}' );
Note: See TracChangeset for help on using the changeset viewer.