Make WordPress Core


Ignore:
Timestamp:
11/30/2017 11:09:33 PM (8 years ago)
Author:
pento
Message:

Code is Poetry.
WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/pluggable.php

    r41635 r42343  
    8585            'install_global_terms',
    8686        );
    87         $test_files = array(
     87        $test_files     = array(
    8888            'wp-includes/pluggable.php',
    8989        );
     
    9898        foreach ( $test_functions as $function ) {
    9999            $data[] = array(
    100                 $function
     100                $function,
    101101            );
    102102        }
     
    107107            foreach ( $functions[1] as $function ) {
    108108                $data[] = array(
    109                     $function
     109                    $function,
    110110                );
    111111            }
     
    126126
    127127            // wp-includes/pluggable.php:
    128             'wp_set_current_user'             => array( 'id', 'name' => '' ),
     128            'wp_set_current_user'             => array(
     129                'id',
     130                'name' => '',
     131            ),
    129132            'wp_get_current_user'             => array(),
    130133            'get_userdata'                    => array( 'user_id' ),
    131134            'get_user_by'                     => array( 'field', 'value' ),
    132135            'cache_users'                     => array( 'user_ids' ),
    133             'wp_mail'                         => array( 'to', 'subject', 'message', 'headers' => '', 'attachments' => array() ),
     136            'wp_mail'                         => array(
     137                'to',
     138                'subject',
     139                'message',
     140                'headers'     => '',
     141                'attachments' => array(),
     142            ),
    134143            'wp_authenticate'                 => array( 'username', 'password' ),
    135144            'wp_logout'                       => array(),
    136             'wp_validate_auth_cookie'         => array( 'cookie' => '', 'scheme' => '' ),
    137             'wp_generate_auth_cookie'         => array( 'user_id', 'expiration', 'scheme' => 'auth', 'token' => '' ),
    138             'wp_parse_auth_cookie'            => array( 'cookie' => '', 'scheme' => '' ),
    139             'wp_set_auth_cookie'              => array( 'user_id', 'remember' => false, 'secure' => '', 'token' => '' ),
     145            'wp_validate_auth_cookie'         => array(
     146                'cookie' => '',
     147                'scheme' => '',
     148            ),
     149            'wp_generate_auth_cookie'         => array(
     150                'user_id',
     151                'expiration',
     152                'scheme' => 'auth',
     153                'token'  => '',
     154            ),
     155            'wp_parse_auth_cookie'            => array(
     156                'cookie' => '',
     157                'scheme' => '',
     158            ),
     159            'wp_set_auth_cookie'              => array(
     160                'user_id',
     161                'remember' => false,
     162                'secure'   => '',
     163                'token'    => '',
     164            ),
    140165            'wp_clear_auth_cookie'            => array(),
    141166            'is_user_logged_in'               => array(),
    142167            'auth_redirect'                   => array(),
    143             'check_admin_referer'             => array( 'action' => -1, 'query_arg' => '_wpnonce' ),
    144             'check_ajax_referer'              => array( 'action' => -1, 'query_arg' => false, 'die' => true ),
    145             'wp_redirect'                     => array( 'location', 'status' => 302 ),
     168            'check_admin_referer'             => array(
     169                'action'    => -1,
     170                'query_arg' => '_wpnonce',
     171            ),
     172            'check_ajax_referer'              => array(
     173                'action'    => -1,
     174                'query_arg' => false,
     175                'die'       => true,
     176            ),
     177            'wp_redirect'                     => array(
     178                'location',
     179                'status' => 302,
     180            ),
    146181            'wp_sanitize_redirect'            => array( 'location' ),
    147182            '_wp_sanitize_utf8_in_redirect'   => array( 'matches' ),
    148             'wp_safe_redirect'                => array( 'location', 'status' => 302 ),
    149             'wp_validate_redirect'            => array( 'location', 'default' => '' ),
    150             'wp_notify_postauthor'            => array( 'comment_id', 'deprecated' => null ),
     183            'wp_safe_redirect'                => array(
     184                'location',
     185                'status' => 302,
     186            ),
     187            'wp_validate_redirect'            => array(
     188                'location',
     189                'default' => '',
     190            ),
     191            'wp_notify_postauthor'            => array(
     192                'comment_id',
     193                'deprecated' => null,
     194            ),
    151195            'wp_notify_moderator'             => array( 'comment_id' ),
    152196            'wp_password_change_notification' => array( 'user' ),
    153             'wp_new_user_notification'        => array( 'user_id', 'deprecated' => null, 'notify' => '' ),
     197            'wp_new_user_notification'        => array(
     198                'user_id',
     199                'deprecated' => null,
     200                'notify'     => '',
     201            ),
    154202            'wp_nonce_tick'                   => array(),
    155             'wp_verify_nonce'                 => array( 'nonce', 'action' => -1 ),
     203            'wp_verify_nonce'                 => array(
     204                'nonce',
     205                'action' => -1,
     206            ),
    156207            'wp_create_nonce'                 => array( 'action' => -1 ),
    157208            'wp_salt'                         => array( 'scheme' => 'auth' ),
    158             'wp_hash'                         => array( 'data', 'scheme' => 'auth' ),
     209            'wp_hash'                         => array(
     210                'data',
     211                'scheme' => 'auth',
     212            ),
    159213            'wp_hash_password'                => array( 'password' ),
    160             'wp_check_password'               => array( 'password', 'hash', 'user_id' => '' ),
    161             'wp_generate_password'            => array( 'length' => 12, 'special_chars' => true, 'extra_special_chars' => false ),
    162             'wp_rand'                         => array( 'min' => 0, 'max' => 0 ),
     214            'wp_check_password'               => array(
     215                'password',
     216                'hash',
     217                'user_id' => '',
     218            ),
     219            'wp_generate_password'            => array(
     220                'length'              => 12,
     221                'special_chars'       => true,
     222                'extra_special_chars' => false,
     223            ),
     224            'wp_rand'                         => array(
     225                'min' => 0,
     226                'max' => 0,
     227            ),
    163228            'wp_set_password'                 => array( 'password', 'user_id' ),
    164             'get_avatar'                      => array( 'id_or_email', 'size' => 96, 'default' => '', 'alt' => '', 'args' => null ),
    165             'wp_text_diff'                    => array( 'left_string', 'right_string', 'args' => null ),
     229            'get_avatar'                      => array(
     230                'id_or_email',
     231                'size'    => 96,
     232                'default' => '',
     233                'alt'     => '',
     234                'args'    => null,
     235            ),
     236            'wp_text_diff'                    => array(
     237                'left_string',
     238                'right_string',
     239                'args' => null,
     240            ),
    166241
    167242            // wp-admin/includes/schema.php:
    168             'install_network'                    => array(),
     243            'install_network'                 => array(),
    169244
    170245            // wp-admin/includes/upgrade.php:
    171             'wp_install'                         => array( 'blog_title', 'user_name', 'user_email', 'public', 'deprecated' => '', 'user_password' => '', 'language' => '' ),
    172             'wp_install_defaults'                => array( 'user_id' ),
    173             'wp_new_blog_notification'           => array( 'blog_title', 'blog_url', 'user_id', 'password' ),
    174             'wp_upgrade'                         => array(),
    175             'install_global_terms'               => array(),
     246            'wp_install'                      => array(
     247                'blog_title',
     248                'user_name',
     249                'user_email',
     250                'public',
     251                'deprecated'    => '',
     252                'user_password' => '',
     253                'language'      => '',
     254            ),
     255            'wp_install_defaults'             => array( 'user_id' ),
     256            'wp_new_blog_notification'        => array( 'blog_title', 'blog_url', 'user_id', 'password' ),
     257            'wp_upgrade'                      => array(),
     258            'install_global_terms'            => array(),
    176259        );
    177260
    178261        // Pluggable function signatures are not tested when an external object cache is in use. #31491
    179262        if ( ! wp_using_ext_object_cache() ) {
    180             $signatures = array_merge( $signatures, array(
    181 
    182                 // wp-includes/cache.php:
    183                 'wp_cache_add'                       => array( 'key', 'data', 'group' => '', 'expire' => 0 ),
    184                 'wp_cache_close'                     => array(),
    185                 'wp_cache_decr'                      => array( 'key', 'offset' => 1, 'group' => '' ),
    186                 'wp_cache_delete'                    => array( 'key', 'group' => '' ),
    187                 'wp_cache_flush'                     => array(),
    188                 'wp_cache_get'                       => array( 'key', 'group' => '', 'force' => false, 'found' => null ),
    189                 'wp_cache_incr'                      => array( 'key', 'offset' => 1, 'group' => '' ),
    190                 'wp_cache_init'                      => array(),
    191                 'wp_cache_replace'                   => array( 'key', 'data', 'group' => '', 'expire' => 0 ),
    192                 'wp_cache_set'                       => array( 'key', 'data', 'group' => '', 'expire' => 0 ),
    193                 'wp_cache_switch_to_blog'            => array( 'blog_id' ),
    194                 'wp_cache_add_global_groups'         => array( 'groups' ),
    195                 'wp_cache_add_non_persistent_groups' => array( 'groups' ),
    196                 'wp_cache_reset'                     => array(),
    197             ) );
     263            $signatures = array_merge(
     264                $signatures, array(
     265
     266                    // wp-includes/cache.php:
     267                    'wp_cache_add'                       => array(
     268                        'key',
     269                        'data',
     270                        'group'  => '',
     271                        'expire' => 0,
     272                    ),
     273                    'wp_cache_close'                     => array(),
     274                    'wp_cache_decr'                      => array(
     275                        'key',
     276                        'offset' => 1,
     277                        'group'  => '',
     278                    ),
     279                    'wp_cache_delete'                    => array(
     280                        'key',
     281                        'group' => '',
     282                    ),
     283                    'wp_cache_flush'                     => array(),
     284                    'wp_cache_get'                       => array(
     285                        'key',
     286                        'group' => '',
     287                        'force' => false,
     288                        'found' => null,
     289                    ),
     290                    'wp_cache_incr'                      => array(
     291                        'key',
     292                        'offset' => 1,
     293                        'group'  => '',
     294                    ),
     295                    'wp_cache_init'                      => array(),
     296                    'wp_cache_replace'                   => array(
     297                        'key',
     298                        'data',
     299                        'group'  => '',
     300                        'expire' => 0,
     301                    ),
     302                    'wp_cache_set'                       => array(
     303                        'key',
     304                        'data',
     305                        'group'  => '',
     306                        'expire' => 0,
     307                    ),
     308                    'wp_cache_switch_to_blog'            => array( 'blog_id' ),
     309                    'wp_cache_add_global_groups'         => array( 'groups' ),
     310                    'wp_cache_add_non_persistent_groups' => array( 'groups' ),
     311                    'wp_cache_reset'                     => array(),
     312                )
     313            );
    198314        }
    199315
Note: See TracChangeset for help on using the changeset viewer.