From 6febdec7b5d7210c2ff4618b2e6a632b342fe160 Mon Sep 17 00:00:00 2001 From: Shish Date: Sun, 19 Jun 2016 23:05:57 +0100 Subject: [PATCH] more explicit variable types --- core/config.class.php | 6 +++--- core/database.class.php | 8 ++++---- core/extension.class.php | 4 ---- ext/bulk_add/theme.php | 2 +- ext/bulk_add_csv/theme.php | 2 +- ext/comment/main.php | 8 ++++---- ext/comment/theme.php | 12 ++++++------ ext/ext_manager/main.php | 6 +++--- ext/image/main.php | 8 +++++--- ext/image_hash_ban/main.php | 6 +++--- ext/index/main.php | 2 +- ext/index/theme.php | 2 +- ext/ipban/main.php | 8 ++++---- ext/log_net/main.php | 2 +- ext/numeric_score/main.php | 2 +- ext/pm/main.php | 4 ++-- ext/resize/main.php | 2 +- ext/source_history/theme.php | 2 +- ext/tag_categories/theme.php | 4 ++-- ext/tag_history/theme.php | 2 +- ext/tag_list/test.php | 2 +- ext/user/main.php | 2 +- ext/view/main.php | 4 ++-- ext/wiki/main.php | 14 ++++++++++---- themes/danbooru2/custompage.class.php | 2 +- themes/futaba/custompage.class.php | 2 +- 26 files changed, 61 insertions(+), 57 deletions(-) diff --git a/core/config.class.php b/core/config.class.php index dd488b46..dc7e85ba 100644 --- a/core/config.class.php +++ b/core/config.class.php @@ -151,7 +151,7 @@ interface Config { * left to the concrete implementation */ abstract class BaseConfig implements Config { - var $values = array(); + public $values = array(); /** * @param string $name @@ -366,8 +366,8 @@ class StaticConfig extends BaseConfig { * \endcode */ class DatabaseConfig extends BaseConfig { - /** @var \Database|null */ - var $database = null; + /** @var Database */ + private $database = null; /** * Load the config table from a database. diff --git a/core/database.class.php b/core/database.class.php index 13cf612c..27037ab1 100644 --- a/core/database.class.php +++ b/core/database.class.php @@ -357,7 +357,7 @@ class MemcacheCache implements CacheEngine { } class APCCache implements CacheEngine { - var $hits=0, $misses=0; + public $hits=0, $misses=0; public function __construct($args) { // $args is not used, but is passed in when APC cache is created. @@ -755,11 +755,11 @@ class Database { class MockDatabase extends Database { /** @var int */ - var $query_id = 0; + private $query_id = 0; /** @var array */ - var $responses = array(); + private $responses = array(); /** @var \NoCache|null */ - var $cache = null; + public $cache = null; /** * @param array $responses diff --git a/core/extension.class.php b/core/extension.class.php index 06c2c5b5..2267e63a 100644 --- a/core/extension.class.php +++ b/core/extension.class.php @@ -88,15 +88,11 @@ abstract class Extension { /** this theme's Themelet object */ public $theme; - /** @private */ - var $_child; - // in PHP5.3, late static bindings can take care of this; __CLASS__ // used here will refer to the subclass // http://php.net/manual/en/language.oop5.late-static-bindings.php /** @private */ public function i_am(Extension $child) { - $this->_child = $child; if(is_null($this->theme)) $this->theme = $this->get_theme_object($child, false); } diff --git a/ext/bulk_add/theme.php b/ext/bulk_add/theme.php index 99ed1754..98cd9b7f 100644 --- a/ext/bulk_add/theme.php +++ b/ext/bulk_add/theme.php @@ -1,7 +1,7 @@ owner = null; @@ -94,7 +94,7 @@ class Comment { class CommentList extends Extension { /** @var CommentListTheme $theme */ - var $theme; + public $theme; public function onInitExt(InitExtEvent $event) { global $config, $database; diff --git a/ext/comment/theme.php b/ext/comment/theme.php index 3d1e3a1b..20e963f9 100644 --- a/ext/comment/theme.php +++ b/ext/comment/theme.php @@ -1,11 +1,11 @@ ct)) { diff --git a/ext/ext_manager/main.php b/ext/ext_manager/main.php index 313ea151..e92eea96 100644 --- a/ext/ext_manager/main.php +++ b/ext/ext_manager/main.php @@ -18,9 +18,9 @@ function __extman_extcmp(ExtensionInfo $a, ExtensionInfo $b) { } class ExtensionInfo { - var $ext_name, $name, $link, $author, $email; - var $description, $documentation, $version, $visibility; - var $enabled; + public $ext_name, $name, $link, $author, $email; + public $description, $documentation, $version, $visibility; + public $enabled; public function __construct($main) { $matches = array(); diff --git a/ext/image/main.php b/ext/image/main.php index 71c829a2..fb110106 100644 --- a/ext/image/main.php +++ b/ext/image/main.php @@ -12,8 +12,10 @@ * An image is being added to the database. */ class ImageAdditionEvent extends Event { - var $user; - /** @var \Image */ + /** @var User */ + public $user; + + /** @var Image */ public $image; /** @@ -30,7 +32,7 @@ class ImageAdditionEvent extends Event { } class ImageAdditionException extends SCoreException { - var $error; + public $error; /** * @param string $error diff --git a/ext/image_hash_ban/main.php b/ext/image_hash_ban/main.php index 07a36174..431d2cf7 100644 --- a/ext/image_hash_ban/main.php +++ b/ext/image_hash_ban/main.php @@ -11,7 +11,7 @@ // RemoveImageHashBanEvent {{{ class RemoveImageHashBanEvent extends Event { - var $hash; + public $hash; /** * @param string $hash @@ -23,8 +23,8 @@ class RemoveImageHashBanEvent extends Event { // }}} // AddImageHashBanEvent {{{ class AddImageHashBanEvent extends Event { - var $hash; - var $reason; + public $hash; + public $reason; /** * @param string $hash diff --git a/ext/index/main.php b/ext/index/main.php index 78404fe6..742cdf4a 100644 --- a/ext/index/main.php +++ b/ext/index/main.php @@ -225,7 +225,7 @@ class PostListBuildingEvent extends Event { } class Index extends Extension { - var $stpen = 0; // search term parse event number + private $stpen = 0; // search term parse event number public function onInitExt(InitExtEvent $event) { global $config; diff --git a/ext/index/theme.php b/ext/index/theme.php index dbe21094..a574555b 100644 --- a/ext/index/theme.php +++ b/ext/index/theme.php @@ -1,7 +1,7 @@ id = $id; @@ -23,9 +23,9 @@ class RemoveIPBanEvent extends Event { // }}} // AddIPBanEvent {{{ class AddIPBanEvent extends Event { - var $ip; - var $reason; - var $end; + public $ip; + public $reason; + public $end; public function __construct(/*string(ip)*/ $ip, /*string*/ $reason, /*string*/ $end) { $this->ip = trim($ip); diff --git a/ext/log_net/main.php b/ext/log_net/main.php index 8a0fdd8a..f5e07175 100644 --- a/ext/log_net/main.php +++ b/ext/log_net/main.php @@ -8,7 +8,7 @@ */ class LogNet extends Extension { - var $count = 0; + private $count = 0; public function onLog(LogEvent $event) { global $user; diff --git a/ext/numeric_score/main.php b/ext/numeric_score/main.php index 9286e7e2..2b6f49eb 100644 --- a/ext/numeric_score/main.php +++ b/ext/numeric_score/main.php @@ -11,7 +11,7 @@ */ class NumericScoreSetEvent extends Event { - var $image_id, $user, $score; + public $image_id, $user, $score; /** * @param int $image_id diff --git a/ext/pm/main.php b/ext/pm/main.php index a0bb8c7e..6de56ad7 100644 --- a/ext/pm/main.php +++ b/ext/pm/main.php @@ -11,7 +11,7 @@ */ class SendPMEvent extends Event { - var $pm; + public $pm; public function __construct(PM $pm) { $this->pm = $pm; @@ -19,7 +19,7 @@ class SendPMEvent extends Event { } class PM { - var $id, $from_id, $from_ip, $to_id, $sent_date, $subject, $message, $is_read; + public $id, $from_id, $from_ip, $to_id, $sent_date, $subject, $message, $is_read; public function __construct($from_id=0, $from_ip="0.0.0.0", $to_id=0, $subject="A Message", $message="Some Text", $read=False) { # PHP: the P stands for "really", the H stands for "awful" and the other P stands for "language" diff --git a/ext/resize/main.php b/ext/resize/main.php index b4cb19ed..70e34f27 100644 --- a/ext/resize/main.php +++ b/ext/resize/main.php @@ -16,7 +16,7 @@ * This class is just a wrapper around SCoreException. */ class ImageResizeException extends SCoreException { - var $error; + public $error; /** @param string $error */ public function __construct($error) { diff --git a/ext/source_history/theme.php b/ext/source_history/theme.php index 27ea3856..c02ee222 100644 --- a/ext/source_history/theme.php +++ b/ext/source_history/theme.php @@ -1,6 +1,6 @@ get_page('tags/map'); diff --git a/ext/user/main.php b/ext/user/main.php index c5f57d70..c2bc2f8e 100644 --- a/ext/user/main.php +++ b/ext/user/main.php @@ -81,7 +81,7 @@ class NullUserException extends SCoreException {} class UserPage extends Extension { /** @var UserPageTheme $theme */ - var $theme; + public $theme; public function onInitExt(InitExtEvent $event) { global $config; diff --git a/ext/view/main.php b/ext/view/main.php index db9e7422..2c80e4a4 100644 --- a/ext/view/main.php +++ b/ext/view/main.php @@ -74,8 +74,8 @@ class ImageInfoSetEvent extends Event { } class ImageAdminBlockBuildingEvent extends Event { - /** @var array */ - var $parts = array(); + /** @var string[] */ + public $parts = array(); /** @var \Image|null */ public $image = null; /** @var null|\User */ diff --git a/ext/wiki/main.php b/ext/wiki/main.php index 836f70aa..8eb541f0 100644 --- a/ext/wiki/main.php +++ b/ext/wiki/main.php @@ -31,14 +31,20 @@ class WikiPage { /** @var int|string */ public $id; - var $owner_id; - var $owner_ip; - var $date; + /** @var int */ + public $owner_id; + + /** @var string */ + public $owner_ip; + + /** @var string */ + public $date; /** @var string */ public $title; - var $revision; + /** @var int */ + public $revision; /** @var bool */ public $locked; diff --git a/themes/danbooru2/custompage.class.php b/themes/danbooru2/custompage.class.php index 16d676cf..d8aca86c 100644 --- a/themes/danbooru2/custompage.class.php +++ b/themes/danbooru2/custompage.class.php @@ -1,7 +1,7 @@ left_enabled = false; } diff --git a/themes/futaba/custompage.class.php b/themes/futaba/custompage.class.php index 16d676cf..d8aca86c 100644 --- a/themes/futaba/custompage.class.php +++ b/themes/futaba/custompage.class.php @@ -1,7 +1,7 @@ left_enabled = false; }