From 30d94327600b420b3bc8abc97f7d93b8095ced57 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sat, 17 Oct 2020 16:26:09 +0000 Subject: [PATCH] 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. Built from https://develop.svn.wordpress.org/trunk@49184 git-svn-id: http://core.svn.wordpress.org/trunk@48946 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- .../class-twentynineteen-svg-icons.php | 6 +-- wp-includes/class-wp-rewrite.php | 42 +++++++++---------- wp-includes/pomo/entry.php | 18 ++++---- wp-includes/pomo/mo.php | 2 +- wp-includes/pomo/po.php | 2 +- wp-includes/pomo/streams.php | 6 +-- wp-includes/pomo/translations.php | 8 ++-- wp-includes/version.php | 2 +- wp-includes/wp-db.php | 22 +++++----- 9 files changed, 54 insertions(+), 54 deletions(-) diff --git a/wp-content/themes/twentynineteen/classes/class-twentynineteen-svg-icons.php b/wp-content/themes/twentynineteen/classes/class-twentynineteen-svg-icons.php index 01a35c0309..aa2ebf27bb 100644 --- a/wp-content/themes/twentynineteen/classes/class-twentynineteen-svg-icons.php +++ b/wp-content/themes/twentynineteen/classes/class-twentynineteen-svg-icons.php @@ -70,7 +70,7 @@ class TwentyNineteen_SVG_Icons { * * @var array */ - static $ui_icons = array( + public static $ui_icons = array( 'link' => /* material-design – link */ ' @@ -178,7 +178,7 @@ class TwentyNineteen_SVG_Icons { * * @var array */ - static $social_icons_map = array( + public static $social_icons_map = array( 'amazon' => array( 'amazon.com', 'amazon.cn', @@ -237,7 +237,7 @@ class TwentyNineteen_SVG_Icons { * * @var array */ - static $social_icons = array( + public static $social_icons = array( '500px' => ' diff --git a/wp-includes/class-wp-rewrite.php b/wp-includes/class-wp-rewrite.php index 729ddf3663..6b5fc05fc8 100644 --- a/wp-includes/class-wp-rewrite.php +++ b/wp-includes/class-wp-rewrite.php @@ -45,7 +45,7 @@ class WP_Rewrite { * @since 1.5.0 * @var string */ - var $author_base = 'author'; + public $author_base = 'author'; /** * Permalink structure for author archives. @@ -53,7 +53,7 @@ class WP_Rewrite { * @since 1.5.0 * @var string */ - var $author_structure; + public $author_structure; /** * Permalink structure for date archives. @@ -61,7 +61,7 @@ class WP_Rewrite { * @since 1.5.0 * @var string */ - var $date_structure; + public $date_structure; /** * Permalink structure for pages. @@ -69,7 +69,7 @@ class WP_Rewrite { * @since 1.5.0 * @var string */ - var $page_structure; + public $page_structure; /** * Base of the search permalink structure (example.com/$search_base/query). @@ -77,7 +77,7 @@ class WP_Rewrite { * @since 1.5.0 * @var string */ - var $search_base = 'search'; + public $search_base = 'search'; /** * Permalink structure for searches. @@ -85,7 +85,7 @@ class WP_Rewrite { * @since 1.5.0 * @var string */ - var $search_structure; + public $search_structure; /** * Comments permalink base. @@ -93,7 +93,7 @@ class WP_Rewrite { * @since 1.5.0 * @var string */ - var $comments_base = 'comments'; + public $comments_base = 'comments'; /** * Pagination permalink base. @@ -109,7 +109,7 @@ class WP_Rewrite { * @since 4.2.0 * @var string */ - var $comments_pagination_base = 'comment-page'; + public $comments_pagination_base = 'comment-page'; /** * Feed permalink base. @@ -117,7 +117,7 @@ class WP_Rewrite { * @since 1.5.0 * @var string */ - var $feed_base = 'feed'; + public $feed_base = 'feed'; /** * Comments feed permalink structure. @@ -125,7 +125,7 @@ class WP_Rewrite { * @since 1.5.0 * @var string */ - var $comment_feed_structure; + public $comment_feed_structure; /** * Feed request permalink structure. @@ -133,7 +133,7 @@ class WP_Rewrite { * @since 1.5.0 * @var string */ - var $feed_structure; + public $feed_structure; /** * The static portion of the post permalink structure. @@ -178,7 +178,7 @@ class WP_Rewrite { * @since 1.5.0 * @var string */ - var $matches = ''; + public $matches = ''; /** * Rewrite rules to match against the request to find the redirect or query. @@ -186,7 +186,7 @@ class WP_Rewrite { * @since 1.5.0 * @var array */ - var $rules; + public $rules; /** * Additional rules added external to the rewrite class. @@ -196,7 +196,7 @@ class WP_Rewrite { * @since 2.1.0 * @var array */ - var $extra_rules = array(); + public $extra_rules = array(); /** * Additional rules that belong at the beginning to match first. @@ -206,7 +206,7 @@ class WP_Rewrite { * @since 2.3.0 * @var array */ - var $extra_rules_top = array(); + public $extra_rules_top = array(); /** * Rules that don't redirect to WordPress' index.php. @@ -217,7 +217,7 @@ class WP_Rewrite { * @since 2.1.0 * @var array */ - var $non_wp_rules = array(); + public $non_wp_rules = array(); /** * Extra permalink structures, e.g. categories, added by add_permastruct(). @@ -225,7 +225,7 @@ class WP_Rewrite { * @since 2.1.0 * @var array */ - var $extra_permastructs = array(); + public $extra_permastructs = array(); /** * Endpoints (like /trackback/) added by add_rewrite_endpoint(). @@ -233,7 +233,7 @@ class WP_Rewrite { * @since 2.1.0 * @var array */ - var $endpoints; + public $endpoints; /** * Whether to write every mod_rewrite rule for WordPress into the .htaccess file. @@ -277,7 +277,7 @@ class WP_Rewrite { * @since 1.5.0 * @var array */ - var $rewritecode = array( + public $rewritecode = array( '%year%', '%monthnum%', '%day%', @@ -298,7 +298,7 @@ class WP_Rewrite { * @since 1.5.0 * @var array */ - var $rewritereplace = array( + public $rewritereplace = array( '([0-9]{4})', '([0-9]{1,2})', '([0-9]{1,2})', @@ -318,7 +318,7 @@ class WP_Rewrite { * @since 1.5.0 * @var array */ - var $queryreplace = array( + public $queryreplace = array( 'year=', 'monthnum=', 'day=', diff --git a/wp-includes/pomo/entry.php b/wp-includes/pomo/entry.php index a1293d4fa5..f0226dbc54 100644 --- a/wp-includes/pomo/entry.php +++ b/wp-includes/pomo/entry.php @@ -18,16 +18,16 @@ if ( ! class_exists( 'Translation_Entry', false ) ) : * * @var boolean */ - var $is_plural = false; + public $is_plural = false; - var $context = null; - var $singular = null; - var $plural = null; - var $translations = array(); - var $translator_comments = ''; - var $extracted_comments = ''; - var $references = array(); - var $flags = array(); + public $context = null; + public $singular = null; + public $plural = null; + public $translations = array(); + public $translator_comments = ''; + public $extracted_comments = ''; + public $references = array(); + public $flags = array(); /** * @param array $args associative array, support following keys: diff --git a/wp-includes/pomo/mo.php b/wp-includes/pomo/mo.php index b4f829fdef..7e3bf81014 100644 --- a/wp-includes/pomo/mo.php +++ b/wp-includes/pomo/mo.php @@ -13,7 +13,7 @@ require_once __DIR__ . '/streams.php'; if ( ! class_exists( 'MO', false ) ) : class MO extends Gettext_Translations { - var $_nplurals = 2; + public $_nplurals = 2; /** * Loaded MO file. diff --git a/wp-includes/pomo/po.php b/wp-includes/pomo/po.php index 5030afb5df..b2a605a3ec 100644 --- a/wp-includes/pomo/po.php +++ b/wp-includes/pomo/po.php @@ -21,7 +21,7 @@ ini_set( 'auto_detect_line_endings', 1 ); if ( ! class_exists( 'PO', false ) ) : class PO extends Gettext_Translations { - var $comments_before_headers = ''; + public $comments_before_headers = ''; /** * Exports headers to a PO entry diff --git a/wp-includes/pomo/streams.php b/wp-includes/pomo/streams.php index 89e13a8f4b..3978d65791 100644 --- a/wp-includes/pomo/streams.php +++ b/wp-includes/pomo/streams.php @@ -11,8 +11,8 @@ if ( ! class_exists( 'POMO_Reader', false ) ) : class POMO_Reader { - var $endian = 'little'; - var $_post = ''; + public $endian = 'little'; + public $_post = ''; /** * PHP5 constructor. @@ -226,7 +226,7 @@ if ( ! class_exists( 'POMO_StringReader', false ) ) : */ class POMO_StringReader extends POMO_Reader { - var $_str = ''; + public $_str = ''; /** * PHP5 constructor. diff --git a/wp-includes/pomo/translations.php b/wp-includes/pomo/translations.php index d99037eaed..d93c6528f4 100644 --- a/wp-includes/pomo/translations.php +++ b/wp-includes/pomo/translations.php @@ -12,8 +12,8 @@ require_once __DIR__ . '/entry.php'; if ( ! class_exists( 'Translations', false ) ) : class Translations { - var $entries = array(); - var $headers = array(); + public $entries = array(); + public $headers = array(); /** * Add entry to the PO structure @@ -301,8 +301,8 @@ if ( ! class_exists( 'NOOP_Translations', false ) ) : * Provides the same interface as Translations, but doesn't do anything */ class NOOP_Translations { - var $entries = array(); - var $headers = array(); + public $entries = array(); + public $headers = array(); function add_entry( $entry ) { return true; diff --git a/wp-includes/version.php b/wp-includes/version.php index 67c4af22f2..81000a43a0 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.6-alpha-49183'; +$wp_version = '5.6-alpha-49184'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. diff --git a/wp-includes/wp-db.php b/wp-includes/wp-db.php index 80c117c1a0..5eabf8a540 100644 --- a/wp-includes/wp-db.php +++ b/wp-includes/wp-db.php @@ -61,7 +61,7 @@ class wpdb { * @since 0.71 * @var bool */ - var $show_errors = false; + public $show_errors = false; /** * Whether to suppress errors during the DB bootstrapping. Default false. @@ -69,7 +69,7 @@ class wpdb { * @since 2.5.0 * @var bool */ - var $suppress_errors = false; + public $suppress_errors = false; /** * The error encountered during the last query. @@ -101,7 +101,7 @@ class wpdb { * @since 0.71 * @var int */ - var $rows_affected = 0; + public $rows_affected = 0; /** * The ID generated for an AUTO_INCREMENT column by the last query (usually INSERT). @@ -117,7 +117,7 @@ class wpdb { * @since 0.71 * @var string */ - var $last_query; + public $last_query; /** * Results of the last query. @@ -125,7 +125,7 @@ class wpdb { * @since 0.71 * @var array|null */ - var $last_result; + public $last_result; /** * MySQL result, which is either a resource or boolean. @@ -198,7 +198,7 @@ class wpdb { * } * } */ - var $queries; + public $queries; /** * The number of times to retry reconnecting before dying. Default 5. @@ -234,7 +234,7 @@ class wpdb { * @since 2.3.2 * @var bool */ - var $ready = false; + public $ready = false; /** * Blog ID. @@ -259,7 +259,7 @@ class wpdb { * @see wpdb::tables() * @var array */ - var $tables = array( + public $tables = array( 'posts', 'comments', 'links', @@ -281,7 +281,7 @@ class wpdb { * @see wpdb::tables() * @var array */ - var $old_tables = array( 'categories', 'post2cat', 'link2cat' ); + public $old_tables = array( 'categories', 'post2cat', 'link2cat' ); /** * List of WordPress global tables. @@ -290,7 +290,7 @@ class wpdb { * @see wpdb::tables() * @var array */ - var $global_tables = array( 'users', 'usermeta' ); + public $global_tables = array( 'users', 'usermeta' ); /** * List of Multisite global tables. @@ -299,7 +299,7 @@ class wpdb { * @see wpdb::tables() * @var array */ - var $ms_global_tables = array( + public $ms_global_tables = array( 'blogs', 'blogmeta', 'signups',