Reedy has uploaded a new change for review.
https://gerrit.wikimedia.org/r/254406
Change subject: Add php doc returns
......................................................................
Add php doc returns
1 throws too
Change-Id: Ic9851083c4733955ebc5e29c776a3f30568bb139
---
M php/Element.php
M php/Tag.php
M php/Widget.php
M php/layouts/FieldLayout.php
M php/mixins/AccessKeyedElement.php
M php/mixins/FlaggedElement.php
M php/mixins/GroupElement.php
M php/mixins/IconElement.php
M php/mixins/IndicatorElement.php
M php/mixins/LabelElement.php
M php/mixins/TabIndexedElement.php
M php/mixins/TitledElement.php
M php/widgets/ButtonInputWidget.php
M php/widgets/ButtonWidget.php
M php/widgets/CheckboxInputWidget.php
M php/widgets/ComboBoxInputWidget.php
M php/widgets/DropdownInputWidget.php
M php/widgets/InputWidget.php
M php/widgets/RadioInputWidget.php
M php/widgets/RadioSelectInputWidget.php
M php/widgets/TextInputWidget.php
21 files changed, 40 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/06/254406/1
diff --git a/php/Element.php b/php/Element.php
index a7bd683..4581f77 100644
--- a/php/Element.php
+++ b/php/Element.php
@@ -182,6 +182,7 @@
*
* @param mixed $data Element data
* @chainable
+ * @return $this
*/
public function setData( $data ) {
$this->data = $data;
diff --git a/php/Tag.php b/php/Tag.php
index e5fa9df..5948fbc 100644
--- a/php/Tag.php
+++ b/php/Tag.php
@@ -74,6 +74,7 @@
*
* @param array $classes List of classes to add
* @chainable
+ * @return $this
*/
public function addClasses( array $classes ) {
$this->classes = array_merge( $this->classes, $classes );
@@ -85,6 +86,7 @@
*
* @param array $classes List of classes to remove
* @chainable
+ * @return $this
*/
public function removeClasses( array $classes ) {
$this->classes = array_diff( $this->classes, $classes );
@@ -97,6 +99,7 @@
* @param array $classes List of classes to add
* @param boolean $toggle Add classes
* @chainable
+ * @return $this
*/
public function toggleClasses( array $classes, $toggle = null ) {
if ( $toggle === null ) {
@@ -127,6 +130,7 @@
*
* @param array $attributes List of attribute key/value pairs to add
* @chainable
+ * @return $this
*/
public function setAttributes( array $attributes ) {
foreach ( $attributes as $key => $value ) {
@@ -140,6 +144,7 @@
*
* @param string $value Value to set
* @chainable
+ * @return $this
*/
public function setValue( $value ) {
if ( strtolower( $this->tag ) === 'textarea' ) {
@@ -156,6 +161,7 @@
*
* @param array $keys List of attribute keys to remove
* @chainable
+ * @return $this
*/
public function removeAttributes( array $keys ) {
foreach ( $keys as $key ) {
@@ -172,6 +178,7 @@
* @param string|Tag|HtmlSnippet $content Content to append. Strings
will be HTML-escaped
* for output, use a HtmlSnippet instance to prevent that.
* @chainable
+ * @return $this
*/
public function appendContent( /* $content... */ ) {
$contents = func_get_args();
@@ -187,6 +194,7 @@
* @param string|Tag|HtmlSnippet $content Content to prepend. Strings
will be HTML-escaped
* for output, use a HtmlSnippet instance to prevent that.
* @chainable
+ * @return $this
*/
public function prependContent( /* $content... */ ) {
$contents = func_get_args();
@@ -218,6 +226,7 @@
*
* @param GroupElement|null $group Group element, null if none
* @chainable
+ * @return $this
*/
public function setElementGroup( $group ) {
$this->elementGroup = $group;
@@ -229,6 +238,7 @@
*
* @param boolean $infusable True to allow tag/element/widget to be
referenced client-side.
* @chainable
+ * @return $this
*/
public function setInfusable( $infusable ) {
$this->infusable = $infusable;
@@ -279,8 +289,8 @@
/**
* Render element into HTML.
- *
* @return string HTML serialization
+ * @throws Exception
*/
public function toString() {
$attributes = '';
diff --git a/php/Widget.php b/php/Widget.php
index 7828a82..bd14a9c 100644
--- a/php/Widget.php
+++ b/php/Widget.php
@@ -62,6 +62,7 @@
*
* @param boolean $disabled Disable widget
* @chainable
+ * @return $this
*/
public function setDisabled( $disabled ) {
$this->disabled = !!$disabled;
diff --git a/php/layouts/FieldLayout.php b/php/layouts/FieldLayout.php
index bfa25af..2ffd040 100644
--- a/php/layouts/FieldLayout.php
+++ b/php/layouts/FieldLayout.php
@@ -165,6 +165,7 @@
*
* @param string $value Alignment mode, either 'left', 'right', 'top'
or 'inline'
* @chainable
+ * @return $this
*/
protected function setAlignment( $value ) {
if ( $value !== $this->align ) {
diff --git a/php/mixins/AccessKeyedElement.php
b/php/mixins/AccessKeyedElement.php
index eb4b79e..c70ee96 100644
--- a/php/mixins/AccessKeyedElement.php
+++ b/php/mixins/AccessKeyedElement.php
@@ -42,6 +42,7 @@
*
* @param string $accessKey Tag's access key, use empty string to remove
* @chainable
+ * @return $this
*/
public function setAccessKey( $accessKey ) {
$accessKey = is_string( $accessKey ) && strlen( $accessKey ) ?
$accessKey : null;
diff --git a/php/mixins/FlaggedElement.php b/php/mixins/FlaggedElement.php
index bd5dc80..2a2258d 100644
--- a/php/mixins/FlaggedElement.php
+++ b/php/mixins/FlaggedElement.php
@@ -79,6 +79,7 @@
* @param string|array $flags One or more flags to add, or an array
keyed by flag name
* containing boolean set/remove instructions.
* @chainable
+ * @return $this
*/
public function setFlags( $flags ) {
$add = array();
diff --git a/php/mixins/GroupElement.php b/php/mixins/GroupElement.php
index 93d3c7a..6a53869 100644
--- a/php/mixins/GroupElement.php
+++ b/php/mixins/GroupElement.php
@@ -53,6 +53,7 @@
* @param Element[] $items Items
* @param number $index Index to insert items at
* @chainable
+ * @return $this
*/
public function addItems( array $items, $index = null ) {
foreach ( $items as $item ) {
@@ -87,6 +88,7 @@
*
* @param Element[] $items Items to remove
* @chainable
+ * @return $this
*/
public function removeItems( $items ) {
foreach ( $items as $item ) {
diff --git a/php/mixins/IconElement.php b/php/mixins/IconElement.php
index b6d2737..f124ed9 100644
--- a/php/mixins/IconElement.php
+++ b/php/mixins/IconElement.php
@@ -43,6 +43,7 @@
*
* @param string|null $icon Symbolic icon name
* @chainable
+ * @return $this
*/
public function setIcon( $icon = null ) {
if ( $this->icon !== null ) {
diff --git a/php/mixins/IndicatorElement.php b/php/mixins/IndicatorElement.php
index 56238b6..d3c744a 100644
--- a/php/mixins/IndicatorElement.php
+++ b/php/mixins/IndicatorElement.php
@@ -45,6 +45,7 @@
*
* @param string|null $indicator Symbolic name of indicator to use or
null for no indicator
* @chainable
+ * @return $this
*/
public function setIndicator( $indicator = null ) {
if ( $this->indicator !== null ) {
diff --git a/php/mixins/LabelElement.php b/php/mixins/LabelElement.php
index d5cf7be..136378c 100644
--- a/php/mixins/LabelElement.php
+++ b/php/mixins/LabelElement.php
@@ -41,6 +41,8 @@
*
* @param string|HtmlSnippet|null $label Label text
* @chainable
+ * @return $this
+ * @return $this
*/
public function setLabel( $label ) {
$this->label = $label;
diff --git a/php/mixins/TabIndexedElement.php b/php/mixins/TabIndexedElement.php
index 223b537..967d611 100644
--- a/php/mixins/TabIndexedElement.php
+++ b/php/mixins/TabIndexedElement.php
@@ -37,6 +37,8 @@
*
* @param number|null $tabIndex Tab index value or null for no tab index
* @chainable
+ * @return $this
+ * @return $this
*/
public function setTabIndex( $tabIndex ) {
$tabIndex = is_numeric( $tabIndex ) ? $tabIndex : null;
diff --git a/php/mixins/TitledElement.php b/php/mixins/TitledElement.php
index 5f1317c..735a605 100644
--- a/php/mixins/TitledElement.php
+++ b/php/mixins/TitledElement.php
@@ -42,6 +42,7 @@
*
* @param string|null $title Title text or null for no title
* @chainable
+ * @return $this
*/
public function setTitle( $title ) {
if ( $this->title !== $title ) {
diff --git a/php/widgets/ButtonInputWidget.php
b/php/widgets/ButtonInputWidget.php
index 00c1791..e7875f2 100644
--- a/php/widgets/ButtonInputWidget.php
+++ b/php/widgets/ButtonInputWidget.php
@@ -84,6 +84,7 @@
*
* @param string|null $label Label text
* @chainable
+ * @return $this
*/
public function setLabel( $label ) {
$this->labelElementMixin->setLabel( $label );
@@ -104,6 +105,7 @@
*
* @param string $value New value
* @chainable
+ * @return $this
*/
public function setValue( $value ) {
if ( !$this->useInputTag ) {
diff --git a/php/widgets/ButtonWidget.php b/php/widgets/ButtonWidget.php
index 976ac6c..fd38dfb 100644
--- a/php/widgets/ButtonWidget.php
+++ b/php/widgets/ButtonWidget.php
@@ -95,6 +95,7 @@
* Set hyperlink location.
*
* @param string|null $href Hyperlink location, null to remove
+ * @return $this
*/
public function setHref( $href ) {
$this->href = is_string( $href ) ? $href : null;
@@ -123,6 +124,7 @@
* Set hyperlink target.
*
* @param string|null $target Hyperlink target, null to remove
+ * @return $this
*/
public function setTarget( $target ) {
$this->target = is_string( $target ) ? $target : null;
@@ -140,6 +142,7 @@
* Set search engine traversal hint.
*
* @param boolean $noFollow True if search engines should avoid
traversing this hyperlink
+ * @return $this
*/
public function setNoFollow( $noFollow ) {
$this->noFollow = is_bool( $noFollow ) ? $noFollow : true;
diff --git a/php/widgets/CheckboxInputWidget.php
b/php/widgets/CheckboxInputWidget.php
index 5d180d5..d8e75ea 100644
--- a/php/widgets/CheckboxInputWidget.php
+++ b/php/widgets/CheckboxInputWidget.php
@@ -43,6 +43,7 @@
*
* @param boolean $state Whether the checkbox is selected
* @chainable
+ * @return $this
*/
public function setSelected( $state ) {
$this->selected = (bool)$state;
diff --git a/php/widgets/ComboBoxInputWidget.php
b/php/widgets/ComboBoxInputWidget.php
index e8e4208..9a79fe3 100644
--- a/php/widgets/ComboBoxInputWidget.php
+++ b/php/widgets/ComboBoxInputWidget.php
@@ -48,6 +48,7 @@
* @param array[] $options Array of menu options in the format
* `array( 'data' => …, 'label' => … )`
* @chainable
+ * @return $this
*/
public function setOptions( $options ) {
$this->options = array();
diff --git a/php/widgets/DropdownInputWidget.php
b/php/widgets/DropdownInputWidget.php
index f8ea48a..0dfe5de 100644
--- a/php/widgets/DropdownInputWidget.php
+++ b/php/widgets/DropdownInputWidget.php
@@ -55,6 +55,7 @@
* @param array[] $options Array of menu options in the format
* `array( 'data' => …, 'label' => … )`
* @chainable
+ * @return $this
*/
public function setOptions( $options ) {
$value = $this->getValue();
diff --git a/php/widgets/InputWidget.php b/php/widgets/InputWidget.php
index 7e3d368..b8e87de 100644
--- a/php/widgets/InputWidget.php
+++ b/php/widgets/InputWidget.php
@@ -94,6 +94,7 @@
* @deprecated since v0.13.1, use #setDir directly
* @param boolean $isRTL Directionality is right-to-left
* @chainable
+ * @return $this
*/
public function setRTL( $isRTL ) {
$this->setDir( $isRTL ? 'rtl' : 'ltr' );
@@ -105,6 +106,7 @@
*
* @param string $dir Text directionality: 'ltr', 'rtl' or 'auto'
* @chainable
+ * @return $this
*/
public function setDir( $dir ) {
$this->input->setAttributes( array( 'dir' => $dir ) );
@@ -116,6 +118,7 @@
*
* @param string $value New value
* @chainable
+ * @return $this
*/
public function setValue( $value ) {
$this->value = $this->cleanUpValue( $value );
diff --git a/php/widgets/RadioInputWidget.php b/php/widgets/RadioInputWidget.php
index 69fd0a8..abca780 100644
--- a/php/widgets/RadioInputWidget.php
+++ b/php/widgets/RadioInputWidget.php
@@ -33,6 +33,8 @@
* Set selection state of this radio button.
*
* @param boolean $state Whether the button is selected
+ * @return $this
+ * @return $this
*/
public function setSelected( $state ) {
// RadioInputWidget doesn't track its state.
diff --git a/php/widgets/RadioSelectInputWidget.php
b/php/widgets/RadioSelectInputWidget.php
index 912c691..7ac0a93 100644
--- a/php/widgets/RadioSelectInputWidget.php
+++ b/php/widgets/RadioSelectInputWidget.php
@@ -60,6 +60,7 @@
* @param array[] $options Array of menu options in the format
* `array( 'data' => …, 'label' => … )`
* @chainable
+ * @return $this
*/
public function setOptions( $options ) {
$value = $this->getValue();
diff --git a/php/widgets/TextInputWidget.php b/php/widgets/TextInputWidget.php
index 210729f..2f2a672 100644
--- a/php/widgets/TextInputWidget.php
+++ b/php/widgets/TextInputWidget.php
@@ -121,6 +121,7 @@
*
* @param boolean $state Make input read-only
* @chainable
+ * @return $this
*/
public function setReadOnly( $state ) {
$this->readOnly = (bool)$state;
--
To view, visit https://gerrit.wikimedia.org/r/254406
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic9851083c4733955ebc5e29c776a3f30568bb139
Gerrit-PatchSet: 1
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: Reedy <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits