Make WordPress Core


Ignore:
Timestamp:
08/17/2018 01:50:26 AM (8 years ago)
Author:
pento
Message:

Coding Standards: Upgrade WPCS to 1.0.0

WPCS 1.0.0 includes a bunch of new auto-fixers, which drops the number of coding standards issues across WordPress significantly. Prior to running the auto-fixers, there were 15,312 issues detected. With this commit, we now drop to 4,769 issues.

This change includes three notable additions:

  • Multiline function calls must now put each parameter on a new line.
  • Auto-formatting files is now part of the grunt precommit script.
  • Auto-fixable coding standards issues will now cause Travis failures.

Fixes #44600.

File:
1 edited

Legend:

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

    r43439 r43571  
    7676                parent::setUp();
    7777                register_post_type(
    78                         'youseeme', array(
     78                        'youseeme',
     79                        array(
    7980                                'supports'     => array(),
    8081                                'show_in_rest' => true,
     
    162163                                'tags',
    163164                                'tags_exclude',
    164                         ), $keys
     165                        ),
     166                        $keys
    165167                );
    166168        }
     
    11091111                        array(
    11101112                                'page' => 2,
    1111                         ), rest_url( '/wp/v2/posts' )
     1113                        ),
     1114                        rest_url( '/wp/v2/posts' )
    11121115                );
    11131116                $this->assertFalse( stripos( $headers['Link'], 'rel="prev"' ) );
     
    11281131                        array(
    11291132                                'page' => 2,
    1130                         ), rest_url( '/wp/v2/posts' )
     1133                        ),
     1134                        rest_url( '/wp/v2/posts' )
    11311135                );
    11321136                $this->assertContains( '<' . $prev_link . '>; rel="prev"', $headers['Link'] );
     
    11341138                        array(
    11351139                                'page' => 4,
    1136                         ), rest_url( '/wp/v2/posts' )
     1140                        ),
     1141                        rest_url( '/wp/v2/posts' )
    11371142                );
    11381143                $this->assertContains( '<' . $next_link . '>; rel="next"', $headers['Link'] );
     
    11471152                        array(
    11481153                                'page' => 5,
    1149                         ), rest_url( '/wp/v2/posts' )
     1154                        ),
     1155                        rest_url( '/wp/v2/posts' )
    11501156                );
    11511157                $this->assertContains( '<' . $prev_link . '>; rel="prev"', $headers['Link'] );
     
    11751181                                'per_page' => 5,
    11761182                                'page'     => 1,
    1177                         ), rest_url( '/wp/v2/posts' )
     1183                        ),
     1184                        rest_url( '/wp/v2/posts' )
    11781185                );
    11791186                $this->assertContains( '<' . $prev_link . '>; rel="prev"', $headers['Link'] );
     
    11821189                                'per_page' => 5,
    11831190                                'page'     => 3,
    1184                         ), rest_url( '/wp/v2/posts' )
     1191                        ),
     1192                        rest_url( '/wp/v2/posts' )
    11851193                );
    11861194                $this->assertContains( '<' . $next_link . '>; rel="next"', $headers['Link'] );
     
    15321540                $obj      = get_post( self::$post_id );
    15331541                $response = $endpoint->prepare_item_for_response( $obj, $request );
    1534                 $this->assertEquals( array(
    1535                         'id',
    1536                         'slug',
    1537                 ), array_keys( $response->get_data() ) );
     1542                $this->assertEquals(
     1543                        array(
     1544                                'id',
     1545                                'slug',
     1546                        ),
     1547                        array_keys( $response->get_data() )
     1548                );
    15381549        }
    15391550
     
    20192030                $file                = DIR_TESTDATA . '/images/canola.jpg';
    20202031                $this->attachment_id = $this->factory->attachment->create_object(
    2021                         $file, 0, array(
     2032                        $file,
     2033                        0,
     2034                        array(
    20222035                                'post_mime_type' => 'image/jpeg',
    20232036                                'menu_order'     => rand( 1, 100 ),
     
    32543267                                        'content' => '<div>div</div> <strong>strong</strong> <script>oh noes</script>',
    32553268                                        'excerpt' => '<div>div</div> <strong>strong</strong> <script>oh noes</script>',
    3256                                 ), array(
     3269                                ),
     3270                                array(
    32573271                                        'title'   => array(
    32583272                                                'raw'      => 'div <strong>strong</strong> oh noes',
     
    32763290                                        'content' => '<div>div</div> <strong>strong</strong> <script>oh noes</script>',
    32773291                                        'excerpt' => '<div>div</div> <strong>strong</strong> <script>oh noes</script>',
    3278                                 ), array(
     3292                                ),
     3293                                array(
    32793294                                        'title'   => array(
    32803295                                                'raw'      => '<div>div</div> <strong>strong</strong> <script>oh noes</script>',
     
    33023317                                'content' => '<div>div</div> <strong>strong</strong> <script>oh noes</script>',
    33033318                                'excerpt' => '<div>div</div> <strong>strong</strong> <script>oh noes</script>',
    3304                         ), array(
     3319                        ),
     3320                        array(
    33053321                                'title'   => array(
    33063322                                        'raw'      => '<div>div</div> <strong>strong</strong> <script>oh noes</script>',
     
    33883404
    33893405                register_post_type(
    3390                         'invalid-controller', array(
     3406                        'invalid-controller',
     3407                        array(
    33913408                                'show_in_rest'          => true,
    33923409                                'rest_controller_class' => 'Fake_Class_Baba',
     
    35573574                                        'any',
    35583575                                ),
    3559                         ), $status_arg['items']
     3576                        ),
     3577                        $status_arg['items']
    35603578                );
    35613579        }
     
    35713589
    35723590                register_rest_field(
    3573                         'post', 'my_custom_int', array(
     3591                        'post',
     3592                        'my_custom_int',
     3593                        array(
    35743594                                'schema'          => $schema,
    35753595                                'get_callback'    => array( $this, 'additional_field_get_callback' ),
     
    36303650
    36313651                register_rest_field(
    3632                         'post', 'my_custom_int', array(
     3652                        'post',
     3653                        'my_custom_int',
     3654                        array(
    36333655                                'schema'          => $schema,
    36343656                                'get_callback'    => array( $this, 'additional_field_get_callback' ),
Note: See TracChangeset for help on using the changeset viewer.