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;
/**
* @var null|string
* @var \UserClass|null
*/
public $parent = null;

View File

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

View File

@ -12,6 +12,12 @@ class AdminPageTheme extends Themelet {
$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) {
$c_protected = $protected ? " 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
*/
class SearchTermParseEvent extends Event {
var $term = null;
var $context = null;
var $querylets = array();
/** @var null|string */
public $term = null;
/** @var null|array */
public $context = null;
/** @var \Querylet[] */
public $querylets = array();
/**
* @param string|null $term
* @param array|null $context
*/
public function __construct($term, $context) {
$this->term = $term;
$this->context = $context;
}
/**
* @return bool
*/
public function is_querylet_set() {
return (count($this->querylets) > 0);
}
/**
* @return \Querylet[]
*/
public function get_querylets() {
return $this->querylets;
}
/**
* @param \Querylet $q
*/
public function add_querylet($q) {
$this->querylets[] = $q;
}
@ -185,13 +201,23 @@ class SearchTermParseException extends SCoreException {
}
class PostListBuildingEvent extends Event {
var $search_terms = null;
var $parts = array();
/** @var null|array */
public $search_terms = null;
/** @var array */
public $parts = array();
/**
* @param array|null $search
*/
public function __construct($search) {
$this->search_terms = $search;
}
/**
* @param string $html
* @param int $position
*/
public function add_control(/*string*/ $html, /*int*/ $position=50) {
while(isset($this->parts[$position])) $position++;
$this->parts[$position] = $html;

View File

@ -33,7 +33,7 @@ class ResizeImage extends Extension {
$config->set_default_bool('resize_enabled', true);
$config->set_default_bool('resize_upload', false);
$config->set_default_int('resize_default_width', 0);
$config->set_default_int('resize_default_height', 0);
$config->set_default_int('resize_default_height', 0);
}
public function onImageAdminBlockBuilding(ImageAdminBlockBuildingEvent $event) {
@ -153,11 +153,16 @@ class ResizeImage extends Extension {
// Private functions
/* ----------------------------- */
/*
This function could be made much smaller by using the ImageReplaceEvent
ie: Pretend that we are replacing the image with a resized copy.
*/
/**
* This function could be made much smaller by using the ImageReplaceEvent
* 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) {
global $config, $user, $page, $database;

View File

@ -19,7 +19,7 @@
* For Shimmie2 specific extensions, there is a ShimmieWebTestCase class which
* 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

View File

@ -54,7 +54,11 @@ class Upload extends Extension {
/** @var bool */
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 onInitExt(InitExtEvent $event) {
@ -118,7 +122,7 @@ class Upload extends Extension {
}
}
public function onPageRequest($event) {
public function onPageRequest(PageRequestEvent $event) {
global $config, $page, $user;
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) {
if(isset($_POST["tags$id"])) {
# merge then explode, not explode then merge - else
@ -246,8 +254,8 @@ class Upload extends Extension {
*
* TODO: Make these messages user/admin editable
*
* @param $error_code integer PHP error code
* @return String
* @param int $error_code PHP error code
* @return string
*/
private function upload_error_message($error_code) {
switch ($error_code) {

View File

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