From cc311fa7dd96b29b76725b2fcd9d7694dc613679 Mon Sep 17 00:00:00 2001 From: Happy-melon Date: Mon, 17 Oct 2011 15:56:25 +0000 Subject: [PATCH] Type hinting --- includes/HTMLForm.php | 13 ++++++++++++- includes/Xml.php | 22 +++++++++++----------- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/includes/HTMLForm.php b/includes/HTMLForm.php index c30a77b3b1..5a46ee6a3f 100644 --- a/includes/HTMLForm.php +++ b/includes/HTMLForm.php @@ -81,7 +81,10 @@ class HTMLForm { ); protected $mMessagePrefix; + + /** @var HTMLFormField[] */ protected $mFlatFields; + protected $mFieldTree; protected $mShowReset = false; public $mFieldData; @@ -512,6 +515,7 @@ class HTMLForm { /** * Get the whole body of the form. + * @return String */ function getBody() { return $this->displaySection( $this->mFieldTree ); @@ -686,9 +690,10 @@ class HTMLForm { /** * TODO: Document - * @param $fields array of fields (either arrays or objects) + * @param $fields array[]|HTMLFormField[] array of fields (either arrays or objects) * @param $sectionName string ID attribute of the tag for this section, ignored if empty * @param $fieldsetIDPrefix string ID prefix for the
tag of each subsection, ignored if empty + * @return String */ function displaySection( $fields, $sectionName = '', $fieldsetIDPrefix = '' ) { $tableHtml = ''; @@ -1310,6 +1315,7 @@ class HTMLCheckField extends HTMLFormField { /** * For a checkbox, the label goes on the right hand side, and is * added in getInputHTML(), rather than HTMLFormField::getRow() + * @return String */ function getLabel() { return ' '; @@ -1756,6 +1762,8 @@ class HTMLRadioField extends HTMLFormField { /** * This returns a block of all the radio options, in one cell. * @see includes/HTMLFormField#getInputHTML() + * @param $value String + * @return String */ function getInputHTML( $value ) { $html = $this->formatOptions( $this->mParams['options'], $value ); @@ -1881,6 +1889,9 @@ class HTMLSubmitField extends HTMLFormField { /** * Button cannot be invalid + * @param $value String + * @param $alldata Array + * @return Bool */ public function validate( $value, $alldata ){ return true; diff --git a/includes/Xml.php b/includes/Xml.php index c5150ad5b2..a0722f7a98 100644 --- a/includes/Xml.php +++ b/includes/Xml.php @@ -334,10 +334,10 @@ class Xml { /** * Convenience function to build an HTML radio button - * @param $name value of the name attribute - * @param $value value of the value attribute - * @param $checked Whether the checkbox is checked or not - * @param $attribs other attributes + * @param $name String value of the name attribute + * @param $value String value of the value attribute + * @param $checked Bool Whether the checkbox is checked or not + * @param $attribs Array other attributes * @return string HTML */ public static function radio( $name, $value, $checked = false, $attribs = array() ) { @@ -376,8 +376,8 @@ class Xml { * @param $label String text of the label * @param $name String value of the name attribute * @param $id String id of the input - * @param $size int value of the size attribute - * @param $value value of the value attribute + * @param $size Int|Bool value of the size attribute + * @param $value String|Bool value of the value attribute * @param $attribs array other attributes * @return string HTML */ @@ -389,11 +389,11 @@ class Xml { /** * Same as Xml::inputLabel() but return input and label in an array * - * @param $label - * @param $name - * @param $id - * @param $size - * @param $value + * @param $label String + * @param $name String + * @param $id String + * @param $size Int|Bool + * @param $value String|Bool * @param $attribs array * * @return array -- 2.20.1