From: Umherirrender Date: Tue, 18 Jun 2019 20:16:31 +0000 (+0200) Subject: Adjust type hints in htmlform related classes X-Git-Tag: 1.34.0-rc.0~1152^2 X-Git-Url: http://git.cyclocoop.org/ecrire?a=commitdiff_plain;h=11c9075767f315e41e637f76407109b21b16cb55;p=lhc%2Fweb%2Fwiklou.git Adjust type hints in htmlform related classes The return type of HTMLFormField::loadDataFromRequest to mixed Some sub classes returning arrays or bools, not everytime strings HTMLCheckField is working with arrays, so also allow array on getTableRow Change-Id: I076feea76d8e296f27c8a9fb4cbd9368584ba187 --- diff --git a/includes/htmlform/HTMLForm.php b/includes/htmlform/HTMLForm.php index d071478440..86f9dba34a 100644 --- a/includes/htmlform/HTMLForm.php +++ b/includes/htmlform/HTMLForm.php @@ -185,6 +185,7 @@ class HTMLForm extends ContextSource { protected $mFieldTree; protected $mShowReset = false; protected $mShowSubmit = true; + /** @var string[] */ protected $mSubmitFlags = [ 'primary', 'progressive' ]; protected $mShowCancel = false; protected $mCancelTarget; diff --git a/includes/htmlform/HTMLFormField.php b/includes/htmlform/HTMLFormField.php index ff805d84fa..590b9e7cb3 100644 --- a/includes/htmlform/HTMLFormField.php +++ b/includes/htmlform/HTMLFormField.php @@ -367,7 +367,7 @@ abstract class HTMLFormField { * or the input's default value if it has not been set. * * @param WebRequest $request - * @return string The value + * @return mixed The value */ public function loadDataFromRequest( $request ) { if ( $request->getCheck( $this->mName ) ) { @@ -653,7 +653,7 @@ abstract class HTMLFormField { /** * Get a FieldLayout (or subclass thereof) to wrap this field in when using OOUI output. - * @param string $inputField + * @param OOUI\Widget $inputField * @param array $config * @return OOUI\FieldLayout|OOUI\ActionFieldLayout */ @@ -1032,7 +1032,7 @@ abstract class HTMLFormField { * Recursively forces values in an array to strings, because issues arise * with integer 0 as a value. * - * @param array $array + * @param array|string $array * @return array|string */ public static function forceToStringRecursive( $array ) { diff --git a/includes/htmlform/fields/HTMLCheckMatrix.php b/includes/htmlform/fields/HTMLCheckMatrix.php index 8ce3c83f6e..8e51858d9a 100644 --- a/includes/htmlform/fields/HTMLCheckMatrix.php +++ b/includes/htmlform/fields/HTMLCheckMatrix.php @@ -196,7 +196,7 @@ class HTMLCheckMatrix extends HTMLFormField implements HTMLNestedFilterable { * line above the options in the case of a checkbox matrix, i.e. it's always * a "vertical-label". * - * @param string $value The value to set the input to + * @param string|array $value The value to set the input to * * @return string Complete HTML table row */ diff --git a/includes/htmlform/fields/HTMLFormFieldWithButton.php b/includes/htmlform/fields/HTMLFormFieldWithButton.php index be8f7d886c..4372cd115c 100644 --- a/includes/htmlform/fields/HTMLFormFieldWithButton.php +++ b/includes/htmlform/fields/HTMLFormFieldWithButton.php @@ -18,7 +18,7 @@ class HTMLFormFieldWithButton extends HTMLFormField { /** @var string $mButtonType Value for the button in this field */ protected $mButtonValue; - /** @var string $mButtonType Value for the button in this field */ + /** @var string[] $mButtonType Value for the button in this field */ protected $mButtonFlags = [ 'progressive' ]; public function __construct( $info ) {