more explicit variable types

This commit is contained in:
Shish 2016-06-19 23:05:57 +01:00
parent f8b7909426
commit 6febdec7b5
26 changed files with 61 additions and 57 deletions

View file

@ -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.

View file

@ -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

View file

@ -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);
}

View file

@ -1,7 +1,7 @@
<?php
class BulkAddTheme extends Themelet {
var $messages = array();
private $messages = array();
/*
* Show a standard page for results to be put into

View file

@ -1,7 +1,7 @@
<?php
class BulkAddCSVTheme extends Themelet {
var $messages = array();
private $messages = array();
/*
* Show a standard page for results to be put into

View file

@ -53,9 +53,9 @@ class CommentDeletionEvent extends Event {
class CommentPostingException extends SCoreException {}
class Comment {
var $owner, $owner_id, $owner_name, $owner_email, $owner_class;
var $comment, $comment_id;
var $image_id, $poster_ip, $posted;
public $owner, $owner_id, $owner_name, $owner_email, $owner_class;
public $comment, $comment_id;
public $image_id, $poster_ip, $posted;
public function __construct($row) {
$this->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;

View file

@ -1,11 +1,11 @@
<?php
class CommentListTheme extends Themelet {
var $comments_shown = 0;
var $show_anon_id = false;
var $anon_id = 1;
var $anon_cid = 0;
var $anon_map = array();
var $ct = null;
private $comments_shown = 0;
private $show_anon_id = false;
private $anon_id = 1;
private $anon_cid = 0;
private $anon_map = array();
private $ct = null;
private function get_anon_colour($ip) {
if(is_null($this->ct)) {

View file

@ -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();

View file

@ -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

View file

@ -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

View file

@ -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;

View file

@ -1,7 +1,7 @@
<?php
class IndexTheme extends Themelet {
var $page_number, $total_pages, $search_terms;
private $page_number, $total_pages, $search_terms;
/**
* @param int $page_number

View file

@ -14,7 +14,7 @@
// RemoveIPBanEvent {{{
class RemoveIPBanEvent extends Event {
var $id;
public $id;
public function __construct($id) {
$this->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);

View file

@ -8,7 +8,7 @@
*/
class LogNet extends Extension {
var $count = 0;
private $count = 0;
public function onLog(LogEvent $event) {
global $user;

View file

@ -11,7 +11,7 @@
*/
class NumericScoreSetEvent extends Event {
var $image_id, $user, $score;
public $image_id, $user, $score;
/**
* @param int $image_id

View file

@ -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"

View file

@ -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) {

View file

@ -1,6 +1,6 @@
<?php
class Source_HistoryTheme extends Themelet {
var $messages = array();
private $messages = array();
/**
* @param Page $page

View file

@ -1,8 +1,8 @@
<?php
class TagCategoriesTheme extends Themelet {
var $heading = "";
var $list = "";
private $heading = "";
private $list = "";
public function show_tag_categories($page, $tc_dict) {
$tc_block_index = 0;

View file

@ -5,7 +5,7 @@
*/
class Tag_HistoryTheme extends Themelet {
var $messages = array();
private $messages = array();
/**
* @param Page $page

View file

@ -1,6 +1,6 @@
<?php
class TagListTest extends ShimmiePHPUnitTestCase {
var $pages = array("map", "alphabetic", "popularity", "categories");
private $pages = array("map", "alphabetic", "popularity", "categories");
public function testTagList() {
$this->get_page('tags/map');

View file

@ -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;

View file

@ -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 */

View file

@ -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;

View file

@ -1,7 +1,7 @@
<?php
class CustomPage extends Page {
var $left_enabled = true;
public $left_enabled = true;
public function disable_left() {
$this->left_enabled = false;
}

View file

@ -1,7 +1,7 @@
<?php
class CustomPage extends Page {
var $left_enabled = true;
public $left_enabled = true;
public function disable_left() {
$this->left_enabled = false;
}