WordPress.org

Make WordPress Core

Changeset 49184


Ignore:
Timestamp:
10/17/2020 04:24:35 PM (8 days ago)
Author:
SergeyBiryukov
Message:

Code Modernization: Use explicit visibility for class property declarations.

Using var or only static to declare a class property is PHP 4 code.

This updates the codebase to use explicit visibility modifiers introduced in PHP 5.

Props jrf.
Fixes #51557. See #22234.

Location:
trunk
Files:
38 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentynineteen/classes/class-twentynineteen-svg-icons.php

    r47808 r49184  
    7171     * @var array
    7272     */
    73     static $ui_icons = array(
     73    public static $ui_icons = array(
    7474        'link'                     => /* material-design – link */ '
    7575<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
     
    179179     * @var array
    180180     */
    181     static $social_icons_map = array(
     181    public static $social_icons_map = array(
    182182        'amazon'      => array(
    183183            'amazon.com',
     
    238238     * @var array
    239239     */
    240     static $social_icons = array(
     240    public static $social_icons = array(
    241241        '500px'       => '
    242242<svg viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  • trunk/src/wp-includes/class-wp-rewrite.php

    r49131 r49184  
    4646     * @var string
    4747     */
    48     var $author_base = 'author';
     48    public $author_base = 'author';
    4949
    5050    /**
     
    5454     * @var string
    5555     */
    56     var $author_structure;
     56    public $author_structure;
    5757
    5858    /**
     
    6262     * @var string
    6363     */
    64     var $date_structure;
     64    public $date_structure;
    6565
    6666    /**
     
    7070     * @var string
    7171     */
    72     var $page_structure;
     72    public $page_structure;
    7373
    7474    /**
     
    7878     * @var string
    7979     */
    80     var $search_base = 'search';
     80    public $search_base = 'search';
    8181
    8282    /**
     
    8686     * @var string
    8787     */
    88     var $search_structure;
     88    public $search_structure;
    8989
    9090    /**
     
    9494     * @var string
    9595     */
    96     var $comments_base = 'comments';
     96    public $comments_base = 'comments';
    9797
    9898    /**
     
    110110     * @var string
    111111     */
    112     var $comments_pagination_base = 'comment-page';
     112    public $comments_pagination_base = 'comment-page';
    113113
    114114    /**
     
    118118     * @var string
    119119     */
    120     var $feed_base = 'feed';
     120    public $feed_base = 'feed';
    121121
    122122    /**
     
    126126     * @var string
    127127     */
    128     var $comment_feed_structure;
     128    public $comment_feed_structure;
    129129
    130130    /**
     
    134134     * @var string
    135135     */
    136     var $feed_structure;
     136    public $feed_structure;
    137137
    138138    /**
     
    179179     * @var string
    180180     */
    181     var $matches = '';
     181    public $matches = '';
    182182
    183183    /**
     
    187187     * @var array
    188188     */
    189     var $rules;
     189    public $rules;
    190190
    191191    /**
     
    197197     * @var array
    198198     */
    199     var $extra_rules = array();
     199    public $extra_rules = array();
    200200
    201201    /**
     
    207207     * @var array
    208208     */
    209     var $extra_rules_top = array();
     209    public $extra_rules_top = array();
    210210
    211211    /**
     
    218218     * @var array
    219219     */
    220     var $non_wp_rules = array();
     220    public $non_wp_rules = array();
    221221
    222222    /**
     
    226226     * @var array
    227227     */
    228     var $extra_permastructs = array();
     228    public $extra_permastructs = array();
    229229
    230230    /**
     
    234234     * @var array
    235235     */
    236     var $endpoints;
     236    public $endpoints;
    237237
    238238    /**
     
    278278     * @var array
    279279     */
    280     var $rewritecode = array(
     280    public $rewritecode = array(
    281281        '%year%',
    282282        '%monthnum%',
     
    299299     * @var array
    300300     */
    301     var $rewritereplace = array(
     301    public $rewritereplace = array(
    302302        '([0-9]{4})',
    303303        '([0-9]{1,2})',
     
    319319     * @var array
    320320     */
    321     var $queryreplace = array(
     321    public $queryreplace = array(
    322322        'year=',
    323323        'monthnum=',
  • trunk/src/wp-includes/pomo/entry.php

    r47122 r49184  
    1919         * @var boolean
    2020         */
    21         var $is_plural = false;
     21        public $is_plural = false;
    2222
    23         var $context             = null;
    24         var $singular            = null;
    25         var $plural              = null;
    26         var $translations        = array();
    27         var $translator_comments = '';
    28         var $extracted_comments  = '';
    29         var $references          = array();
    30         var $flags               = array();
     23        public $context             = null;
     24        public $singular            = null;
     25        public $plural              = null;
     26        public $translations        = array();
     27        public $translator_comments = '';
     28        public $extracted_comments  = '';
     29        public $references          = array();
     30        public $flags               = array();
    3131
    3232        /**
  • trunk/src/wp-includes/pomo/mo.php

    r47808 r49184  
    1414    class MO extends Gettext_Translations {
    1515
    16         var $_nplurals = 2;
     16        public $_nplurals = 2;
    1717
    1818        /**
  • trunk/src/wp-includes/pomo/po.php

    r49120 r49184  
    2222    class PO extends Gettext_Translations {
    2323
    24         var $comments_before_headers = '';
     24        public $comments_before_headers = '';
    2525
    2626        /**
  • trunk/src/wp-includes/pomo/streams.php

    r49120 r49184  
    1212    class POMO_Reader {
    1313
    14         var $endian = 'little';
    15         var $_post  = '';
     14        public $endian = 'little';
     15        public $_post  = '';
    1616
    1717        /**
     
    227227    class POMO_StringReader extends POMO_Reader {
    228228
    229         var $_str = '';
     229        public $_str = '';
    230230
    231231        /**
  • trunk/src/wp-includes/pomo/translations.php

    r49120 r49184  
    1313if ( ! class_exists( 'Translations', false ) ) :
    1414    class Translations {
    15         var $entries = array();
    16         var $headers = array();
     15        public $entries = array();
     16        public $headers = array();
    1717
    1818        /**
     
    302302     */
    303303    class NOOP_Translations {
    304         var $entries = array();
    305         var $headers = array();
     304        public $entries = array();
     305        public $headers = array();
    306306
    307307        function add_entry( $entry ) {
  • trunk/src/wp-includes/wp-db.php

    r49072 r49184  
    6262     * @var bool
    6363     */
    64     var $show_errors = false;
     64    public $show_errors = false;
    6565
    6666    /**
     
    7070     * @var bool
    7171     */
    72     var $suppress_errors = false;
     72    public $suppress_errors = false;
    7373
    7474    /**
     
    102102     * @var int
    103103     */
    104     var $rows_affected = 0;
     104    public $rows_affected = 0;
    105105
    106106    /**
     
    118118     * @var string
    119119     */
    120     var $last_query;
     120    public $last_query;
    121121
    122122    /**
     
    126126     * @var array|null
    127127     */
    128     var $last_result;
     128    public $last_result;
    129129
    130130    /**
     
    199199     * }
    200200     */
    201     var $queries;
     201    public $queries;
    202202
    203203    /**
     
    235235     * @var bool
    236236     */
    237     var $ready = false;
     237    public $ready = false;
    238238
    239239    /**
     
    260260     * @var array
    261261     */
    262     var $tables = array(
     262    public $tables = array(
    263263        'posts',
    264264        'comments',
     
    282282     * @var array
    283283     */
    284     var $old_tables = array( 'categories', 'post2cat', 'link2cat' );
     284    public $old_tables = array( 'categories', 'post2cat', 'link2cat' );
    285285
    286286    /**
     
    291291     * @var array
    292292     */
    293     var $global_tables = array( 'users', 'usermeta' );
     293    public $global_tables = array( 'users', 'usermeta' );
    294294
    295295    /**
     
    300300     * @var array
    301301     */
    302     var $ms_global_tables = array(
     302    public $ms_global_tables = array(
    303303        'blogs',
    304304        'blogmeta',
  • trunk/tests/phpunit/includes/factory/class-wp-unittest-generator-sequence.php

    r46586 r49184  
    22
    33class WP_UnitTest_Generator_Sequence {
    4     static $incr = -1;
     4    public static $incr = -1;
    55    public $next;
    66    public $template_string;
  • trunk/tests/phpunit/includes/mock-mailer.php

    r48645 r49184  
    44
    55class MockPHPMailer extends PHPMailer\PHPMailer\PHPMailer {
    6     var $mock_sent = array();
     6    public $mock_sent = array();
    77
    88    function preSend() {
  • trunk/tests/phpunit/includes/testcase-canonical.php

    r47781 r49184  
    22
    33class WP_Canonical_UnitTestCase extends WP_UnitTestCase {
    4     static $old_current_user;
    5     static $author_id;
    6     static $post_ids    = array();
    7     static $comment_ids = array();
    8     static $term_ids    = array();
    9     static $terms       = array();
    10     static $old_options = array();
     4    public static $old_current_user;
     5    public static $author_id;
     6    public static $post_ids    = array();
     7    public static $comment_ids = array();
     8    public static $term_ids    = array();
     9    public static $terms       = array();
     10    public static $old_options = array();
    1111
    1212    /**
  • trunk/tests/phpunit/includes/utils.php

    r49108 r49184  
    3939 */
    4040class MockAction {
    41     var $events;
    42     var $debug;
     41    public $events;
     42    public $debug;
    4343
    4444    /**
     
    185185// Kinda lame, but it works with a default PHP 4 installation.
    186186class TestXMLParser {
    187     var $xml;
    188     var $data = array();
     187    public $xml;
     188    public $data = array();
    189189
    190190    /**
  • trunk/tests/phpunit/tests/admin/includesScreen.php

    r48940 r49184  
    66 */
    77class Tests_Admin_includesScreen extends WP_UnitTestCase {
    8     var $core_screens = array(
     8    public $core_screens = array(
    99        'index.php'                            => array(
    1010            'base'            => 'dashboard',
  • trunk/tests/phpunit/tests/cache.php

    r48950 r49184  
    55 */
    66class Tests_Cache extends WP_UnitTestCase {
    7     var $cache = null;
     7    public $cache = null;
    88
    99    function setUp() {
  • trunk/tests/phpunit/tests/feed/atom.php

    r48937 r49184  
    1010 */
    1111class Tests_Feeds_Atom extends WP_UnitTestCase {
    12     static $user_id;
    13     static $posts;
    14     static $category;
     12    public static $user_id;
     13    public static $posts;
     14    public static $category;
    1515
    1616    /**
  • trunk/tests/phpunit/tests/feed/rss2.php

    r48937 r49184  
    1010 */
    1111class Tests_Feeds_RSS2 extends WP_UnitTestCase {
    12     static $user_id;
    13     static $posts;
    14     static $category;
    15     static $post_date;
     12    public static $user_id;
     13    public static $posts;
     14    public static $category;
     15    public static $post_date;
    1616
    1717    /**
  • trunk/tests/phpunit/tests/functions/wpListFilter.php

    r49006 r49184  
    99 */
    1010class Tests_Functions_wpListFilter extends WP_UnitTestCase {
    11     var $object_list = array();
    12     var $array_list  = array();
     11    public $object_list = array();
     12    public $array_list  = array();
    1313
    1414    function setUp() {
  • trunk/tests/phpunit/tests/http/base.php

    r49033 r49184  
    1313abstract class WP_HTTP_UnitTestCase extends WP_UnitTestCase {
    1414    // You can use your own version of data/WPHTTP-testcase-redirection-script.php here.
    15     var $redirection_script = 'http://api.wordpress.org/core/tests/1.0/redirection.php';
    16     var $file_stream_url    = 'http://s.w.org/screenshots/3.9/dashboard.png';
     15    public $redirection_script = 'http://api.wordpress.org/core/tests/1.0/redirection.php';
     16    public $file_stream_url    = 'http://s.w.org/screenshots/3.9/dashboard.png';
    1717
    1818    protected $http_request_args;
  • trunk/tests/phpunit/tests/http/curl.php

    r47198 r49184  
    88 */
    99class Tests_HTTP_curl extends WP_HTTP_UnitTestCase {
    10     var $transport = 'curl';
     10    public $transport = 'curl';
    1111
    1212    /**
  • trunk/tests/phpunit/tests/http/streams.php

    r47198 r49184  
    88 */
    99class Tests_HTTP_streams extends WP_HTTP_UnitTestCase {
    10     var $transport = 'streams';
     10    public $transport = 'streams';
    1111}
  • trunk/tests/phpunit/tests/image/header.php

    r48937 r49184  
    77 */
    88class Tests_Image_Header extends WP_UnitTestCase {
    9     var $custom_image_header;
     9    public $custom_image_header;
    1010
    1111    function setUp() {
  • trunk/tests/phpunit/tests/link/getDashboardUrl.php

    r48937 r49184  
    55 */
    66class Tests_Link_GetDashboardUrl extends WP_UnitTestCase {
    7     static $user_id = false;
     7    public static $user_id = false;
    88
    99    public static function wpSetUpBeforeClass( $factory ) {
  • trunk/tests/phpunit/tests/multisite/wpMSSitesListTable.php

    r48939 r49184  
    1313         * @var WP_MS_Sites_List_Table
    1414         */
    15         var $table = false;
     15        public $table = false;
    1616
    1717        function setUp() {
  • trunk/tests/phpunit/tests/query/commentCount.php

    r48939 r49184  
    44 */
    55class Tests_Query_CommentCount extends WP_UnitTestCase {
    6     static $post_ids = array();
     6    public static $post_ids = array();
    77    public $q;
    8     static $post_type = 'page'; // Can be anything.
     8    public static $post_type = 'page'; // Can be anything.
    99
    1010    public function setUp() {
  • trunk/tests/phpunit/tests/query/date.php

    r48937 r49184  
    1111    public $q;
    1212
    13     static $post_ids = array();
     13    public static $post_ids = array();
    1414
    1515    public static function wpSetUpBeforeClass( $factory ) {
  • trunk/tests/phpunit/tests/query/results.php

    r48937 r49184  
    1010    protected $q;
    1111
    12     static $cat_ids  = array();
    13     static $tag_ids  = array();
    14     static $post_ids = array();
    15 
    16     static $parent_one;
    17     static $parent_two;
    18     static $parent_three;
    19     static $child_one;
    20     static $child_two;
    21     static $child_three;
    22     static $child_four;
     12    public static $cat_ids  = array();
     13    public static $tag_ids  = array();
     14    public static $post_ids = array();
     15
     16    public static $parent_one;
     17    public static $parent_two;
     18    public static $parent_three;
     19    public static $child_one;
     20    public static $child_two;
     21    public static $child_three;
     22    public static $child_four;
    2323
    2424    public static function wpSetUpBeforeClass( $factory ) {
  • trunk/tests/phpunit/tests/query/stickies.php

    r48937 r49184  
    77 */
    88class Tests_Query_Stickies extends WP_UnitTestCase {
    9     static $posts = array();
     9    public static $posts = array();
    1010
    1111    public static function wpSetUpBeforeClass( $factory ) {
  • trunk/tests/phpunit/tests/theme/customHeader.php

    r48937 r49184  
    55class Tests_Theme_Custom_Header extends WP_UnitTestCase {
    66
    7     static $post;
     7    public static $post;
    88
    99    protected static $header_video_id;
  • trunk/tests/phpunit/tests/upload.php

    r48937 r49184  
    66class Tests_Upload extends WP_UnitTestCase {
    77
    8     var $siteurl;
     8    public $siteurl;
    99
    1010    function setUp() {
  • trunk/tests/phpunit/tests/user/countUserPosts.php

    r46586 r49184  
    66 */
    77class Tests_User_CountUserPosts extends WP_UnitTestCase {
    8     static $user_id;
    9     static $post_ids = array();
     8    public static $user_id;
     9    public static $post_ids = array();
    1010
    1111    public static function wpSetUpBeforeClass( $factory ) {
  • trunk/tests/phpunit/tests/user/getActiveBlogForUser.php

    r48937 r49184  
    1111     */
    1212    class Tests_Multisite_getActiveBlogForUser extends WP_UnitTestCase {
    13         static $user_id = false;
     13        public static $user_id = false;
    1414
    1515        public static function wpSetUpBeforeClass( $factory ) {
  • trunk/tests/phpunit/tests/user/listAuthors.php

    r48944 r49184  
    55 */
    66class Tests_User_ListAuthors extends WP_UnitTestCase {
    7     static $user_ids = array();
    8     static $fred_id;
    9     static $posts     = array();
    10     static $user_urls = array();
     7    public static $user_ids = array();
     8    public static $fred_id;
     9    public static $posts     = array();
     10    public static $user_urls = array();
    1111        /* Defaults
    1212        'orderby'       => 'name',
  • trunk/tests/phpunit/tests/walker.php

    r48937 r49184  
    287287class Walker_Test extends Walker {
    288288
    289     var $tree_type = 'test';
    290     var $db_fields = array(
     289    public $tree_type = 'test';
     290    public $db_fields = array(
    291291        'parent' => 'parent',
    292292        'id'     => 'id',
  • trunk/tests/phpunit/tests/xmlrpc/wp/getComments.php

    r48937 r49184  
    55 */
    66class Tests_XMLRPC_wp_getComments extends WP_XMLRPC_UnitTestCase {
    7     var $post_id;
     7    public $post_id;
    88
    99    function test_invalid_username_password() {
  • trunk/tests/phpunit/tests/xmlrpc/wp/getMediaItem.php

    r48937 r49184  
    77    protected static $post_id;
    88
    9     var $attachment_data;
    10     var $attachment_id;
     9    public $attachment_data;
     10    public $attachment_id;
    1111
    1212    public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
  • trunk/tests/phpunit/tests/xmlrpc/wp/getPost.php

    r48937 r49184  
    55 */
    66class Tests_XMLRPC_wp_getPost extends WP_XMLRPC_UnitTestCase {
    7     var $post_data;
    8     var $post_id;
    9     var $post_date_ts;
    10     var $post_custom_field;
     7    public $post_data;
     8    public $post_id;
     9    public $post_date_ts;
     10    public $post_custom_field;
    1111
    1212    function setUp() {
  • trunk/tests/phpunit/tests/xmlrpc/wp/getPostType.php

    r48937 r49184  
    55 */
    66class Tests_XMLRPC_wp_getPostType extends WP_XMLRPC_UnitTestCase {
    7     var $cpt_name;
    8     var $cpt_args;
     7    public $cpt_name;
     8    public $cpt_args;
    99
    1010    function setUp() {
  • trunk/tests/phpunit/tests/xmlrpc/wp/restoreRevision.php

    r48937 r49184  
    55 */
    66class Tests_XMLRPC_wp_restoreRevision extends WP_XMLRPC_UnitTestCase {
    7     var $post_id;
    8     var $revision_id;
     7    public $post_id;
     8    public $revision_id;
    99
    1010    function setUp() {
Note: See TracChangeset for help on using the changeset viewer.