Use PHP 7 '??' operator instead of '?:' with 'isset()' where convenient
[lhc/web/wiklou.git] / includes / htmlform / HTMLFormField.php
index 9c301e6..cd4d4b7 100644 (file)
@@ -17,6 +17,9 @@ abstract class HTMLFormField {
        protected $mVFormClass = '';
        protected $mHelpClass = false;
        protected $mDefault;
+       /**
+        * @var array|bool|null
+        */
        protected $mOptions = false;
        protected $mOptionsLabelsNotFromMessage = false;
        protected $mHideIf = null;
@@ -543,8 +546,7 @@ abstract class HTMLFormField {
                        'mw-htmlform-nolabel' => ( $label === '' )
                ];
 
-               $horizontalLabel = isset( $this->mParams['horizontal-label'] )
-                       ? $this->mParams['horizontal-label'] : false;
+               $horizontalLabel = $this->mParams['horizontal-label'] ?? false;
 
                if ( $horizontalLabel ) {
                        $field = ' ' . $inputHtml . "\n$errors";
@@ -673,7 +675,7 @@ abstract class HTMLFormField {
        }
 
        /**
-        * Whether the field should be automatically infused. Note that all OOjs UI HTMLForm fields are
+        * Whether the field should be automatically infused. Note that all OOUI HTMLForm fields are
         * infusable (you can call OO.ui.infuse() on them), but not all are infused by default, since
         * there is no benefit in doing it e.g. for buttons and it's a small performance hit on page load.
         *
@@ -686,7 +688,7 @@ abstract class HTMLFormField {
 
        /**
         * Get the list of extra ResourceLoader modules which must be loaded client-side before it's
-        * possible to infuse this field's OOjs UI widget.
+        * possible to infuse this field's OOUI widget.
         *
         * @return string[]
         */
@@ -947,8 +949,7 @@ abstract class HTMLFormField {
 
                $displayFormat = $this->mParent->getDisplayFormat();
                $html = '';
-               $horizontalLabel = isset( $this->mParams['horizontal-label'] )
-                       ? $this->mParams['horizontal-label'] : false;
+               $horizontalLabel = $this->mParams['horizontal-label'] ?? false;
 
                if ( $displayFormat === 'table' ) {
                        $html =