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/term/getTerms.php

    r42343 r43571  
    222222
    223223                $terms_id_parent = get_terms(
    224                         'post_tag', array(
     224                        'post_tag',
     225                        array(
    225226                                'hide_empty' => false,
    226227                                'fields'     => 'id=>parent',
     
    231232                                $term_id1 => 0,
    232233                                $term_id2 => $term_id1,
    233                         ), $terms_id_parent
     234                        ),
     235                        $terms_id_parent
    234236                );
    235237
    236238                $terms_ids = get_terms(
    237                         'post_tag', array(
     239                        'post_tag',
     240                        array(
    238241                                'hide_empty' => false,
    239242                                'fields'     => 'ids',
     
    243246
    244247                $terms_name = get_terms(
    245                         'post_tag', array(
     248                        'post_tag',
     249                        array(
    246250                                'hide_empty' => false,
    247251                                'fields'     => 'names',
     
    251255
    252256                $terms_id_name = get_terms(
    253                         'post_tag', array(
     257                        'post_tag',
     258                        array(
    254259                                'hide_empty' => false,
    255260                                'fields'     => 'id=>name',
     
    260265                                $term_id1 => 'WOO!',
    261266                                $term_id2 => 'HOO!',
    262                         ), $terms_id_name
     267                        ),
     268                        $terms_id_name
    263269                );
    264270
    265271                $terms_id_slug = get_terms(
    266                         'post_tag', array(
     272                        'post_tag',
     273                        array(
    267274                                'hide_empty' => false,
    268275                                'fields'     => 'id=>slug',
     
    273280                                $term_id1 => 'woo',
    274281                                $term_id2 => 'hoo',
    275                         ), $terms_id_slug
     282                        ),
     283                        $terms_id_slug
    276284                );
    277285        }
     
    286294                $term_id2  = self::factory()->tag->create();
    287295                $inc_terms = get_terms(
    288                         'post_tag', array(
     296                        'post_tag',
     297                        array(
    289298                                'include'    => array( $term_id1, $term_id2 ),
    290299                                'hide_empty' => false,
     
    294303
    295304                $exc_terms = get_terms(
    296                         'post_tag', array(
     305                        'post_tag',
     306                        array(
    297307                                'exclude'    => array( $term_id1, $term_id2 ),
    298308                                'hide_empty' => false,
     
    303313                // These should not generate query errors.
    304314                get_terms(
    305                         'post_tag', array(
     315                        'post_tag',
     316                        array(
    306317                                'exclude'    => array( 0 ),
    307318                                'hide_empty' => false,
     
    311322
    312323                get_terms(
    313                         'post_tag', array(
     324                        'post_tag',
     325                        array(
    314326                                'exclude'    => array( 'unexpected-string' ),
    315327                                'hide_empty' => false,
     
    319331
    320332                get_terms(
    321                         'post_tag', array(
     333                        'post_tag',
     334                        array(
    322335                                'include'    => array( 'unexpected-string' ),
    323336                                'hide_empty' => false,
     
    334347
    335348                $terms = self::factory()->term->create_many(
    336                         2, array(
     349                        2,
     350                        array(
    337351                                'taxonomy' => 'wptests_tax',
    338352                        )
     
    340354
    341355                $found = get_terms(
    342                         'wptests_tax', array(
     356                        'wptests_tax',
     357                        array(
    343358                                'taxonomy'     => 'wptests_tax',
    344359                                'hide_empty'   => false,
     
    366381
    367382                $terms = get_terms(
    368                         'category', array(
     383                        'category',
     384                        array(
    369385                                'exclude'    => $term_id_uncategorized,
    370386                                'fields'     => 'ids',
     
    375391
    376392                $terms = get_terms(
    377                         'category', array(
     393                        'category',
     394                        array(
    378395                                'fields'       => 'ids',
    379396                                'exclude_tree' => "$term_id1,$term_id_uncategorized",
     
    395412
    396413                $terms = get_terms(
    397                         'post_tag', array(
     414                        'post_tag',
     415                        array(
    398416                                'hide_empty' => false,
    399417                                'search'     => 'bur',
     
    422440
    423441                $terms = get_terms(
    424                         'post_tag', array(
     442                        'post_tag',
     443                        array(
    425444                                'hide_empty' => false,
    426445                                'name__like' => 'bur',
     
    431450
    432451                $terms2 = get_terms(
    433                         'post_tag', array(
     452                        'post_tag',
     453                        array(
    434454                                'hide_empty'        => false,
    435455                                'description__like' => 'bur',
     
    440460
    441461                $terms3 = get_terms(
    442                         'post_tag', array(
     462                        'post_tag',
     463                        array(
    443464                                'hide_empty' => false,
    444465                                'name__like' => 'Bur',
     
    449470
    450471                $terms4 = get_terms(
    451                         'post_tag', array(
     472                        'post_tag',
     473                        array(
    452474                                'hide_empty'        => false,
    453475                                'description__like' => 'Bur',
     
    458480
    459481                $terms5 = get_terms(
    460                         'post_tag', array(
     482                        'post_tag',
     483                        array(
    461484                                'hide_empty' => false,
    462485                                'name__like' => 'ENCHILADA',
     
    467490
    468491                $terms6 = get_terms(
    469                         'post_tag', array(
     492                        'post_tag',
     493                        array(
    470494                                'hide_empty'        => false,
    471495                                'description__like' => 'ENCHILADA',
     
    476500
    477501                $terms7 = get_terms(
    478                         'post_tag', array(
     502                        'post_tag',
     503                        array(
    479504                                'hide_empty' => false,
    480505                                'name__like' => 'o',
     
    485510
    486511                $terms8 = get_terms(
    487                         'post_tag', array(
     512                        'post_tag',
     513                        array(
    488514                                'hide_empty'        => false,
    489515                                'description__like' => '.',
     
    585611
    586612                $terms = get_terms(
    587                         $tax, array(
     613                        $tax,
     614                        array(
    588615                                'parent'       => 0,
    589616                                'cache_domain' => $tax,
     
    627654
    628655                $terms = get_terms(
    629                         $tax, array(
     656                        $tax,
     657                        array(
    630658                                'parent'       => 0,
    631659                                'cache_domain' => $tax,
     
    662690
    663691                $terms = get_terms(
    664                         $tax, array(
     692                        $tax,
     693                        array(
    665694                                'parent'       => 0,
    666695                                'cache_domain' => $tax,
     
    681710
    682711                $terms = get_terms(
    683                         'category', array(
     712                        'category',
     713                        array(
    684714                                'child_of'   => $parent,
    685715                                'hide_empty' => false,
     
    702732
    703733                $found = get_terms(
    704                         'wptests_tax', array(
     734                        'wptests_tax',
     735                        array(
    705736                                'hide_empty' => false,
    706737                                'child_of'   => $terms[0],
     
    729760
    730761                $found = get_terms(
    731                         array( 'wptests_tax1', 'wptests_tax2' ), array(
     762                        array( 'wptests_tax1', 'wptests_tax2' ),
     763                        array(
    732764                                'fields'     => 'ids',
    733765                                'hide_empty' => false,
     
    800832
    801833                $found = get_terms(
    802                         'post_tag', array(
     834                        'post_tag',
     835                        array(
    803836                                'hide_empty' => false,
    804837                                'fields'     => 'ids',
     
    819852
    820853                $found = get_terms(
    821                         'post_tag', array(
     854                        'post_tag',
     855                        array(
    822856                                'hide_empty' => false,
    823857                                'fields'     => 'ids',
     
    837871
    838872                $found = get_terms(
    839                         'post_tag', array(
     873                        'post_tag',
     874                        array(
    840875                                'hide_empty' => false,
    841876                                'fields'     => 'ids',
     
    856891
    857892                $found = get_terms(
    858                         'post_tag', array(
     893                        'post_tag',
     894                        array(
    859895                                'hide_empty' => false,
    860896                                'fields'     => 'ids',
     
    881917
    882918                $found = get_terms(
    883                         'wptests_tax', array(
     919                        'wptests_tax',
     920                        array(
    884921                                'hide_empty' => false,
    885922                                'fields'     => 'ids',
     
    891928                // array format.
    892929                $found = get_terms(
    893                         'wptests_tax', array(
     930                        'wptests_tax',
     931                        array(
    894932                                'hide_empty' => false,
    895933                                'fields'     => 'ids',
     
    920958
    921959                $found = get_terms(
    922                         'wptests_tax', array(
     960                        'wptests_tax',
     961                        array(
    923962                                'hide_empty' => false,
    924963                                'fields'     => 'ids',
     
    957996
    958997                $terms = get_terms(
    959                         $flat_tax, array(
     998                        $flat_tax,
     999                        array(
    9601000                                'childless'  => true,
    9611001                                'hide_empty' => false,
     
    10491089
    10501090                $terms = get_terms(
    1051                         $tax, array(
     1091                        $tax,
     1092                        array(
    10521093                                'childless'  => true,
    10531094                                'hide_empty' => false,
     
    11161157
    11171158                $terms = get_terms(
    1118                         $tax, array(
     1159                        $tax,
     1160                        array(
    11191161                                'childless'  => true,
    11201162                                'child_of'   => $quebec,
     
    11501192
    11511193                $found = get_terms(
    1152                         array( 'wptests_tax1', 'wptests_tax2' ), array(
     1194                        array( 'wptests_tax1', 'wptests_tax2' ),
     1195                        array(
    11531196                                'fields'     => 'ids',
    11541197                                'hide_empty' => false,
     
    11681211
    11691212                $found = get_terms(
    1170                         $tax, array(
     1213                        $tax,
     1214                        array(
    11711215                                'hide_empty' => false,
    11721216                                'fields'     => 'ids',
     
    11951239
    11961240                $found = get_terms(
    1197                         $tax, array(
     1241                        $tax,
     1242                        array(
    11981243                                'hide_empty' => true,
    11991244                                'fields'     => 'ids',
     
    12201265
    12211266                $found = get_terms(
    1222                         $tax, array(
     1267                        $tax,
     1268                        array(
    12231269                                'hide_empty'   => true,
    12241270                                'fields'       => 'ids',
     
    12451291
    12461292                $found = get_terms(
    1247                         $tax, array(
     1293                        $tax,
     1294                        array(
    12481295                                'hide_empty' => false,
    12491296                                'fields'     => 'names',
     
    12721319
    12731320                $found = get_terms(
    1274                         $tax, array(
     1321                        $tax,
     1322                        array(
    12751323                                'hide_empty' => true,
    12761324                                'fields'     => 'names',
     
    12971345
    12981346                $found = get_terms(
    1299                         $tax, array(
     1347                        $tax,
     1348                        array(
    13001349                                'hide_empty'   => true,
    13011350                                'fields'       => 'names',
     
    13221371
    13231372                $found = get_terms(
    1324                         $tax, array(
     1373                        $tax,
     1374                        array(
    13251375                                'hide_empty' => false,
    13261376                                'fields'     => 'count',
     
    13411391
    13421392                $found = get_terms(
    1343                         $tax, array(
     1393                        $tax,
     1394                        array(
    13441395                                'hide_empty' => true,
    13451396                                'fields'     => 'count',
     
    13611412
    13621413                $found = get_terms(
    1363                         $tax, array(
     1414                        $tax,
     1415                        array(
    13641416                                'hide_empty'   => true,
    13651417                                'fields'       => 'count',
     
    13811433
    13821434                $found = get_terms(
    1383                         $tax, array(
     1435                        $tax,
     1436                        array(
    13841437                                'hide_empty' => false,
    13851438                                'fields'     => 'id=>parent',
     
    14081461
    14091462                $found = get_terms(
    1410                         $tax, array(
     1463                        $tax,
     1464                        array(
    14111465                                'hide_empty' => true,
    14121466                                'fields'     => 'id=>parent',
     
    14331487
    14341488                $found = get_terms(
    1435                         $tax, array(
     1489                        $tax,
     1490                        array(
    14361491                                'hide_empty'   => true,
    14371492                                'fields'       => 'id=>parent',
     
    14581513
    14591514                $found = get_terms(
    1460                         $tax, array(
     1515                        $tax,
     1516                        array(
    14611517                                'hide_empty' => false,
    14621518                                'fields'     => 'id=>slug',
     
    14881544
    14891545                $found = get_terms(
    1490                         $tax, array(
     1546                        $tax,
     1547                        array(
    14911548                                'hide_empty' => true,
    14921549                                'fields'     => 'id=>slug',
     
    15131570
    15141571                $found = get_terms(
    1515                         $tax, array(
     1572                        $tax,
     1573                        array(
    15161574                                'hide_empty'   => true,
    15171575                                'fields'       => 'id=>slug',
     
    15381596
    15391597                $found = get_terms(
    1540                         $tax, array(
     1598                        $tax,
     1599                        array(
    15411600                                'hide_empty' => false,
    15421601                                'fields'     => 'id=>name',
     
    15681627
    15691628                $found = get_terms(
    1570                         $tax, array(
     1629                        $tax,
     1630                        array(
    15711631                                'hide_empty' => true,
    15721632                                'fields'     => 'id=>name',
     
    15931653
    15941654                $found = get_terms(
    1595                         $tax, array(
     1655                        $tax,
     1656                        array(
    15961657                                'hide_empty'   => true,
    15971658                                'fields'       => 'id=>name',
     
    16511712
    16521713                $found = get_terms(
    1653                         array( 'wptests_tax1', 'wptests_tax2' ), array(
     1714                        array( 'wptests_tax1', 'wptests_tax2' ),
     1715                        array(
    16541716                                'hierarchical' => true,
    16551717                                'hide_empty'   => true,
     
    16871749
    16881750                $found = get_terms(
    1689                         $tax, array(
     1751                        $tax,
     1752                        array(
    16901753                                'fields'     => 'ids',
    16911754                                'include'    => array( $t4, $t1, $t2 ),
     
    17331796
    17341797                $found = get_terms(
    1735                         $tax, array(
     1798                        $tax,
     1799                        array(
    17361800                                'fields'     => 'ids',
    17371801                                'orderby'    => 'description',
     
    17701834
    17711835                $found = get_terms(
    1772                         'wptests_tax', array(
     1836                        'wptests_tax',
     1837                        array(
    17731838                                'orderby'    => 'term_id',
    17741839                                'hide_empty' => false,
     
    17951860                // Matches the first meta query clause.
    17961861                $found = get_terms(
    1797                         'wptests_tax', array(
     1862                        'wptests_tax',
     1863                        array(
    17981864                                'hide_empty' => false,
    17991865                                'meta_query' => array(
     
    18321898                // Matches the first meta query clause.
    18331899                $found = get_terms(
    1834                         'wptests_tax', array(
     1900                        'wptests_tax',
     1901                        array(
    18351902                                'hide_empty' => false,
    18361903                                'meta_query' => array(
     
    18711938
    18721939                $found = get_terms(
    1873                         'wptests_tax', array(
     1940                        'wptests_tax',
     1941                        array(
    18741942                                'hide_empty' => false,
    18751943                                'meta_key'   => 'fee',
     
    18831951
    18841952                $found = get_terms(
    1885                         'wptests_tax', array(
     1953                        'wptests_tax',
     1954                        array(
    18861955                                'hide_empty' => false,
    18871956                                'meta_query' => array(
     
    19021971                // Matches the first meta query clause.
    19031972                $found = get_terms(
    1904                         'wptests_tax', array(
     1973                        'wptests_tax',
     1974                        array(
    19051975                                'hide_empty' => false,
    19061976                                'meta_query' => array(
     
    19261996                // Matches the meta query clause corresponding to the 'meta_key' param.
    19271997                $found = get_terms(
    1928                         'wptests_tax', array(
     1998                        'wptests_tax',
     1999                        array(
    19292000                                'hide_empty' => false,
    19302001                                'meta_query' => array(
     
    19662037
    19672038                $found = get_terms(
    1968                         'wptests_tax', array(
     2039                        'wptests_tax',
     2040                        array(
    19692041                                'hide_empty' => false,
    19702042                                'meta_key'   => 'fee',
     
    19782050
    19792051                $found = get_terms(
    1980                         'wptests_tax', array(
     2052                        'wptests_tax',
     2053                        array(
    19812054                                'hide_empty' => false,
    19822055                                'meta_query' => array(
     
    19962069
    19972070                $found = get_terms(
    1998                         'wptests_tax', array(
     2071                        'wptests_tax',
     2072                        array(
    19992073                                'hide_empty' => false,
    20002074                                'meta_query' => array(
     
    20192093
    20202094                $found = get_terms(
    2021                         'wptests_tax', array(
     2095                        'wptests_tax',
     2096                        array(
    20222097                                'hide_empty' => false,
    20232098                                'meta_query' => array(
     
    20562131
    20572132                $found = get_terms(
    2058                         'wptests_tax', array(
     2133                        'wptests_tax',
     2134                        array(
    20592135                                'hide_empty' => false,
    20602136                                'meta_query' => array(
     
    20782154
    20792155                $found = get_terms(
    2080                         'wptests_tax', array(
     2156                        'wptests_tax',
     2157                        array(
    20812158                                'hide_empty' => false,
    20822159                                'meta_query' => array(
     
    21002177
    21012178                $expected = get_terms(
    2102                         'wptests_tax', array(
     2179                        'wptests_tax',
     2180                        array(
    21032181                                'hide_empty' => false,
    21042182                                'meta_query' => array(
     
    21182196
    21192197                $found = get_terms(
    2120                         'wptests_tax', array(
     2198                        'wptests_tax',
     2199                        array(
    21212200                                'hide_empty' => false,
    21222201                                'meta_query' => array(
     
    21442223                // Case where hierarchical is false
    21452224                $terms = get_terms(
    2146                         'category', array(
     2225                        'category',
     2226                        array(
    21472227                                'hierarchical' => false,
    21482228                                'parent'       => $initial_terms['one_term']['term_id'],
     
    21622242                // Case where hierarchical is true
    21632243                $terms = get_terms(
    2164                         'category', array(
     2244                        'category',
     2245                        array(
    21652246                                'hierarchical' => true,
    21662247                                'parent'       => $initial_terms['one_term']['term_id'],
     
    21882269                // Case where hierarchical is false
    21892270                $terms = get_terms(
    2190                         'category', array(
     2271                        'category',
     2272                        array(
    21912273                                'hierarchical' => false,
    21922274                                'child_of'     => $initial_terms['one_term']['term_id'],
     
    22072289                // Case where hierarchical is false
    22082290                $terms = get_terms(
    2209                         'category', array(
     2291                        'category',
     2292                        array(
    22102293                                'hierarchical' => false,
    22112294                                'child_of'     => $initial_terms['one_term']['term_id'],
     
    22222305                // Case where hierarchical is true
    22232306                $terms = get_terms(
    2224                         'category', array(
     2307                        'category',
     2308                        array(
    22252309                                'hierarchical' => true,
    22262310                                'child_of'     => $initial_terms['one_term']['term_id'],
     
    22422326
    22432327                $terms = get_terms(
    2244                         'category', array(
     2328                        'category',
     2329                        array(
    22452330                                'hide_empty' => false,
    22462331                                'child_of'   => $initial_terms['one_term']['term_id'],
     
    22722357
    22732358                $found = get_terms(
    2274                         'wptests_tax', array(
     2359                        'wptests_tax',
     2360                        array(
    22752361                                'hide_empty' => false,
    22762362                                'parent'     => $terms[0],
     
    22992385
    23002386                $found = get_terms(
    2301                         array( 'wptests_tax1', 'wptests_tax2' ), array(
     2387                        array( 'wptests_tax1', 'wptests_tax2' ),
     2388                        array(
    23022389                                'fields'     => 'ids',
    23032390                                'hide_empty' => false,
     
    23142401                // Case where hierarchical is false
    23152402                $terms = get_terms(
    2316                         'category', array(
     2403                        'category',
     2404                        array(
    23172405                                'hierarchical' => false,
    23182406                                'child_of'     => $initial_terms['one_term']['term_id'],
     
    23332421                // Case where hierarchical is true
    23342422                $terms = get_terms(
    2335                         'category', array(
     2423                        'category',
     2424                        array(
    23362425                                'hierarchical' => true,
    23372426                                'child_of'     => $initial_terms['one_term']['term_id'],
     
    23772466
    23782467                $found = get_terms(
    2379                         'wptests_tax_1', array(
     2468                        'wptests_tax_1',
     2469                        array(
    23802470                                'pad_counts' => true,
    23812471                        )
     
    24142504
    24152505                $terms = get_terms(
    2416                         'category', array(
     2506                        'category',
     2507                        array(
    24172508                                'pad_counts' => true,
    24182509                        )
     
    24482539
    24492540                $found = get_terms(
    2450                         array( 'wptests_tax1', 'wptests_tax2' ), array(
     2541                        array( 'wptests_tax1', 'wptests_tax2' ),
     2542                        array(
    24512543                                'pad_counts' => true,
    24522544                        )
     
    24792571
    24802572                $found = get_terms(
    2481                         'wptests_tax', array(
     2573                        'wptests_tax',
     2574                        array(
    24822575                                'hide_empty' => false,
    24832576                                'include'    => $terms,
     
    25072600
    25082601                $found = get_terms(
    2509                         'wptests_tax', array(
     2602                        'wptests_tax',
     2603                        array(
    25102604                                'hide_empty'             => false,
    25112605                                'include'                => $terms,
     
    25352629
    25362630                $found = get_terms(
    2537                         'wptests_tax', array(
     2631                        'wptests_tax',
     2632                        array(
    25382633                                'hide_empty' => false,
    25392634                                'meta_query' => array(
     
    25602655
    25612656                $found = get_terms(
    2562                         'wptests_tax', array(
     2657                        'wptests_tax',
     2658                        array(
    25632659                                'hide_empty' => false,
    25642660                                'meta_query' => array(
     
    25842680
    25852681                $found = get_terms(
    2586                         'wptests_tax', array(
     2682                        'wptests_tax',
     2683                        array(
    25872684                                'hide_empty' => false,
    25882685                                'fields'     => 'all',
     
    26092706                // Prime the cache.
    26102707                get_terms(
    2611                         'wptests_tax', array(
     2708                        'wptests_tax',
     2709                        array(
    26122710                                'hide_empty' => false,
    26132711                                'fields'     => 'all',
     
    26182716
    26192717                $found = get_terms(
    2620                         'wptests_tax', array(
     2718                        'wptests_tax',
     2719                        array(
    26212720                                'hide_empty' => false,
    26222721                                'fields'     => 'all',
     
    26432742
    26442743                $found = get_terms(
    2645                         'wptests_tax', array(
     2744                        'wptests_tax',
     2745                        array(
    26462746                                'hide_empty' => false,
    26472747                                'fields'     => 'all',
     
    26632763
    26642764                $found = get_terms(
    2665                         'wptests_tax', array(
     2765                        'wptests_tax',
     2766                        array(
    26662767                                'hide_empty'   => false,
    26672768                                'fields'       => 'id=>parent',
     
    26852786
    26862787                $found = get_terms(
    2687                         'wptests_tax', array(
     2788                        'wptests_tax',
     2789                        array(
    26882790                                'number'     => 3,
    26892791                                'offset'     => 0,
     
    27042806
    27052807                $found = get_terms(
    2706                         'wptests_tax', array(
     2808                        'wptests_tax',
     2809                        array(
    27072810                                'number'     => 1,
    27082811                                'offset'     => 1,
     
    27252828
    27262829                $found = get_terms(
    2727                         'wptests_tax', array(
     2830                        'wptests_tax',
     2831                        array(
    27282832                                'number'     => 2,
    27292833                                'offset'     => 1,
     
    27462850
    27472851                $found = get_terms(
    2748                         'wptests_tax', array(
     2852                        'wptests_tax',
     2853                        array(
    27492854                                'number'     => 100,
    27502855                                'offset'     => 3,
Note: See TracChangeset for help on using the changeset viewer.