Fixing more PHP Doc related issues.

This commit is contained in:
jgen 2014-04-27 19:29:36 -04:00
parent 03b3cdcbd2
commit 8a2eb4b121
8 changed files with 117 additions and 27 deletions

View File

@ -12,7 +12,7 @@ class UserClass {
public $name = null; public $name = null;
/** /**
* @var null|string * @var \UserClass|null
*/ */
public $parent = null; public $parent = null;

View File

@ -24,15 +24,26 @@
* Sent when the admin page is ready to be added to * Sent when the admin page is ready to be added to
*/ */
class AdminBuildingEvent extends Event { class AdminBuildingEvent extends Event {
var $page; /** @var \Page */
public $page;
/**
* @param Page $page
*/
public function __construct(Page $page) { public function __construct(Page $page) {
$this->page = $page; $this->page = $page;
} }
} }
class AdminActionEvent extends Event { class AdminActionEvent extends Event {
var $action; /** @var string */
var $redirect = true; public $action;
/** @var bool */
public $redirect = true;
/**
* @param string $action
*/
public function __construct(/*string*/ $action) { public function __construct(/*string*/ $action) {
$this->action = $action; $this->action = $action;
} }

View File

@ -12,6 +12,12 @@ class AdminPageTheme extends Themelet {
$page->add_block(new NavBlock()); $page->add_block(new NavBlock());
} }
/**
* @param string $name
* @param string $action
* @param bool $protected
* @return string
*/
protected function button(/*string*/ $name, /*string*/ $action, /*boolean*/ $protected=false) { protected function button(/*string*/ $name, /*string*/ $action, /*boolean*/ $protected=false) {
$c_protected = $protected ? " protected" : ""; $c_protected = $protected ? " protected" : "";
$html = make_form(make_link("admin/$action"), "POST", false, null, null, "admin$c_protected"); $html = make_form(make_link("admin/$action"), "POST", false, null, null, "admin$c_protected");

View File

@ -159,23 +159,39 @@
* Signal that a search term needs parsing * Signal that a search term needs parsing
*/ */
class SearchTermParseEvent extends Event { class SearchTermParseEvent extends Event {
var $term = null; /** @var null|string */
var $context = null; public $term = null;
var $querylets = array(); /** @var null|array */
public $context = null;
/** @var \Querylet[] */
public $querylets = array();
/**
* @param string|null $term
* @param array|null $context
*/
public function __construct($term, $context) { public function __construct($term, $context) {
$this->term = $term; $this->term = $term;
$this->context = $context; $this->context = $context;
} }
/**
* @return bool
*/
public function is_querylet_set() { public function is_querylet_set() {
return (count($this->querylets) > 0); return (count($this->querylets) > 0);
} }
/**
* @return \Querylet[]
*/
public function get_querylets() { public function get_querylets() {
return $this->querylets; return $this->querylets;
} }
/**
* @param \Querylet $q
*/
public function add_querylet($q) { public function add_querylet($q) {
$this->querylets[] = $q; $this->querylets[] = $q;
} }
@ -185,13 +201,23 @@ class SearchTermParseException extends SCoreException {
} }
class PostListBuildingEvent extends Event { class PostListBuildingEvent extends Event {
var $search_terms = null; /** @var null|array */
var $parts = array(); public $search_terms = null;
/** @var array */
public $parts = array();
/**
* @param array|null $search
*/
public function __construct($search) { public function __construct($search) {
$this->search_terms = $search; $this->search_terms = $search;
} }
/**
* @param string $html
* @param int $position
*/
public function add_control(/*string*/ $html, /*int*/ $position=50) { public function add_control(/*string*/ $html, /*int*/ $position=50) {
while(isset($this->parts[$position])) $position++; while(isset($this->parts[$position])) $position++;
$this->parts[$position] = $html; $this->parts[$position] = $html;

View File

@ -154,10 +154,15 @@ class ResizeImage extends Extension {
// Private functions // Private functions
/* ----------------------------- */ /* ----------------------------- */
/* /**
This function could be made much smaller by using the ImageReplaceEvent * This function could be made much smaller by using the ImageReplaceEvent
ie: Pretend that we are replacing the image with a resized copy. * ie: Pretend that we are replacing the image with a resized copy.
*/ *
* @param Image $image_obj
* @param int $width
* @param int $height
* @throws ImageResizeException
*/
private function resize_image(Image $image_obj, /*int*/ $width, /*int*/ $height) { private function resize_image(Image $image_obj, /*int*/ $width, /*int*/ $height) {
global $config, $user, $page, $database; global $config, $user, $page, $database;

View File

@ -19,7 +19,7 @@
* For Shimmie2 specific extensions, there is a ShimmieWebTestCase class which * For Shimmie2 specific extensions, there is a ShimmieWebTestCase class which
* includes functions to upload and delete images. * includes functions to upload and delete images.
* *
* For a quick guide on the spcifics of how to write tests, see \ref wut * For a quick guide on the specifics of how to write tests, see \ref wut
* *
* *
* \page wut Writing Unit Tests * \page wut Writing Unit Tests

View File

@ -54,7 +54,11 @@ class Upload extends Extension {
/** @var bool */ /** @var bool */
public $is_full; public $is_full;
// early, so it can stop the DataUploadEvent before any data handlers see it /**
* Early, so it can stop the DataUploadEvent before any data handlers see it.
*
* @return int
*/
public function get_priority() {return 40;} public function get_priority() {return 40;}
public function onInitExt(InitExtEvent $event) { public function onInitExt(InitExtEvent $event) {
@ -118,7 +122,7 @@ class Upload extends Extension {
} }
} }
public function onPageRequest($event) { public function onPageRequest(PageRequestEvent $event) {
global $config, $page, $user; global $config, $page, $user;
if($event->page_matches("upload/replace")) { if($event->page_matches("upload/replace")) {
@ -224,6 +228,10 @@ class Upload extends Extension {
} }
} }
/**
* @param string|int $id
* @return array
*/
private function tags_for_upload_slot($id) { private function tags_for_upload_slot($id) {
if(isset($_POST["tags$id"])) { if(isset($_POST["tags$id"])) {
# merge then explode, not explode then merge - else # merge then explode, not explode then merge - else
@ -246,8 +254,8 @@ class Upload extends Extension {
* *
* TODO: Make these messages user/admin editable * TODO: Make these messages user/admin editable
* *
* @param $error_code integer PHP error code * @param int $error_code PHP error code
* @return String * @return string
*/ */
private function upload_error_message($error_code) { private function upload_error_message($error_code) {
switch ($error_code) { switch ($error_code) {

View File

@ -15,27 +15,46 @@
* which only appears when an image actually exists. * which only appears when an image actually exists.
*/ */
class DisplayingImageEvent extends Event { class DisplayingImageEvent extends Event {
var $image, $page, $context; /** @var \Image */
public $image;
public $page, $context;
/**
* @param Image $image
*/
public function __construct(Image $image) { public function __construct(Image $image) {
$this->image = $image; $this->image = $image;
} }
/**
* @return Image
*/
public function get_image() { public function get_image() {
return $this->image; return $this->image;
} }
} }
class ImageInfoBoxBuildingEvent extends Event { class ImageInfoBoxBuildingEvent extends Event {
var $parts = array(); /** @var array */
var $image; public $parts = array();
var $user; /** @var \Image */
public $image;
/** @var \User */
public $user;
/**
* @param Image $image
* @param User $user
*/
public function __construct(Image $image, User $user) { public function __construct(Image $image, User $user) {
$this->image = $image; $this->image = $image;
$this->user = $user; $this->user = $user;
} }
/**
* @param string $html
* @param int $position
*/
public function add_part($html, $position=50) { public function add_part($html, $position=50) {
while(isset($this->parts[$position])) $position++; while(isset($this->parts[$position])) $position++;
$this->parts[$position] = $html; $this->parts[$position] = $html;
@ -43,23 +62,38 @@ class ImageInfoBoxBuildingEvent extends Event {
} }
class ImageInfoSetEvent extends Event { class ImageInfoSetEvent extends Event {
var $image; /** @var \Image */
public $image;
/**
* @param Image $image
*/
public function __construct(Image $image) { public function __construct(Image $image) {
$this->image = $image; $this->image = $image;
} }
} }
class ImageAdminBlockBuildingEvent extends Event { class ImageAdminBlockBuildingEvent extends Event {
/** @var array */
var $parts = array(); var $parts = array();
var $image = null; /** @var \Image|null */
var $user = null; public $image = null;
/** @var null|\User */
public $user = null;
/**
* @param Image $image
* @param User $user
*/
public function __construct(Image $image, User $user) { public function __construct(Image $image, User $user) {
$this->image = $image; $this->image = $image;
$this->user = $user; $this->user = $user;
} }
/**
* @param string $html
* @param int $position
*/
public function add_part(/*string*/ $html, /*int*/ $position=50) { public function add_part(/*string*/ $html, /*int*/ $position=50) {
while(isset($this->parts[$position])) $position++; while(isset($this->parts[$position])) $position++;
$this->parts[$position] = $html; $this->parts[$position] = $html;