aboutsummaryrefslogtreecommitdiffstats
path: root/includes
diff options
context:
space:
mode:
authorBartosz Dziewoński <matma.rex@gmail.com>2022-06-17 17:59:21 +0200
committerBartosz Dziewoński <matma.rex@gmail.com>2022-06-17 21:47:59 +0200
commit8f7cd07af602b088f5d53f981f6ff910342b774c (patch)
tree268f899f10b00d3cb6388cb33c6e0f57c41a7192 /includes
parent5bdebfc7717531fbd4fae54f4def33cb2efd73b7 (diff)
downloadmediawikicore-8f7cd07af602b088f5d53f981f6ff910342b774c.tar.gz
mediawikicore-8f7cd07af602b088f5d53f981f6ff910342b774c.zip
HTMLFormField: Fix Phan suppression about mClassWithButton
Change-Id: Ie20fa54de1fcc69913b3881d2efe9192be5b90cc
Diffstat (limited to 'includes')
-rw-r--r--includes/htmlform/HTMLFormField.php9
-rw-r--r--includes/htmlform/fields/HTMLFormFieldWithButton.php2
-rw-r--r--includes/htmlform/fields/HTMLSelectNamespaceWithButton.php5
-rw-r--r--includes/htmlform/fields/HTMLTextFieldWithButton.php5
4 files changed, 14 insertions, 7 deletions
diff --git a/includes/htmlform/HTMLFormField.php b/includes/htmlform/HTMLFormField.php
index d8c627484288..e90812c7d880 100644
--- a/includes/htmlform/HTMLFormField.php
+++ b/includes/htmlform/HTMLFormField.php
@@ -685,7 +685,7 @@ abstract class HTMLFormField {
*
* @param string $value The value to set the input to.
*
- * @return OOUI\FieldLayout|OOUI\ActionFieldLayout
+ * @return OOUI\FieldLayout
*/
public function getOOUI( $value ) {
$inputField = $this->getInputOOUI( $value );
@@ -784,14 +784,9 @@ abstract class HTMLFormField {
* Get a FieldLayout (or subclass thereof) to wrap this field in when using OOUI output.
* @param OOUI\Widget $inputField
* @param array $config
- * @return OOUI\FieldLayout|OOUI\ActionFieldLayout
- * @suppress PhanUndeclaredProperty Only some subclasses declare mClassWithButton
+ * @return OOUI\FieldLayout
*/
protected function getFieldLayoutOOUI( $inputField, $config ) {
- if ( isset( $this->mClassWithButton ) ) {
- $buttonWidget = $this->mClassWithButton->getInputOOUI( '' );
- return new HTMLFormActionFieldLayout( $inputField, $buttonWidget, $config );
- }
return new HTMLFormFieldLayout( $inputField, $config );
}
diff --git a/includes/htmlform/fields/HTMLFormFieldWithButton.php b/includes/htmlform/fields/HTMLFormFieldWithButton.php
index 8e95a7655641..043e1ee8e9e1 100644
--- a/includes/htmlform/fields/HTMLFormFieldWithButton.php
+++ b/includes/htmlform/fields/HTMLFormFieldWithButton.php
@@ -2,6 +2,8 @@
/**
* Enables HTMLFormField elements to be build with a button.
*
+ * TODO This class should be a trait
+ *
* @stable to extend
*/
class HTMLFormFieldWithButton extends HTMLFormField {
diff --git a/includes/htmlform/fields/HTMLSelectNamespaceWithButton.php b/includes/htmlform/fields/HTMLSelectNamespaceWithButton.php
index 636b54a24e7f..efbc9b7d22b5 100644
--- a/includes/htmlform/fields/HTMLSelectNamespaceWithButton.php
+++ b/includes/htmlform/fields/HTMLSelectNamespaceWithButton.php
@@ -20,4 +20,9 @@ class HTMLSelectNamespaceWithButton extends HTMLSelectNamespace {
public function getInputHTML( $value ) {
return $this->mClassWithButton->getElement( parent::getInputHTML( $value ) );
}
+
+ protected function getFieldLayoutOOUI( $inputField, $config ) {
+ $buttonWidget = $this->mClassWithButton->getInputOOUI( '' );
+ return new HTMLFormActionFieldLayout( $inputField, $buttonWidget, $config );
+ }
}
diff --git a/includes/htmlform/fields/HTMLTextFieldWithButton.php b/includes/htmlform/fields/HTMLTextFieldWithButton.php
index 6105acb989b3..24fbc9e4ee87 100644
--- a/includes/htmlform/fields/HTMLTextFieldWithButton.php
+++ b/includes/htmlform/fields/HTMLTextFieldWithButton.php
@@ -20,4 +20,9 @@ class HTMLTextFieldWithButton extends HTMLTextField {
public function getInputHTML( $value ) {
return $this->mClassWithButton->getElement( parent::getInputHTML( $value ) );
}
+
+ protected function getFieldLayoutOOUI( $inputField, $config ) {
+ $buttonWidget = $this->mClassWithButton->getInputOOUI( '' );
+ return new HTMLFormActionFieldLayout( $inputField, $buttonWidget, $config );
+ }
}