widgets: Remove redundant equality check in SelectWithInputWidget
authorDerick Alangi <alangiderick@gmail.com>
Mon, 11 Feb 2019 14:59:36 +0000 (15:59 +0100)
committerDerick Alangi <alangiderick@gmail.com>
Tue, 12 Feb 2019 04:53:29 +0000 (05:53 +0100)
The check `if ( $config['disabled'] == true )` is the same as the
check `if ( $config['disabled'] )`. Was this intentional or was it
supposed to be a test for equality and type (===)? If not, then I
think this patch removes the irrelevancy.

Clearly, if the $config['disabled'] is set to false, the isset()
check will return true but the second check will fail even with
this patch as it does the same thing.

Change-Id: Ibbe5b4949590f8ac954f613236056dd2e6dd18ba

includes/widget/SelectWithInputWidget.php

index 262903d..de0e4a6 100644 (file)
@@ -23,7 +23,7 @@ class SelectWithInputWidget extends \OOUI\Widget {
         *   - array $config['textinput'] Configuration for the TextInputWidget
         *   - array $config['dropdowninput'] Configuration for the DropdownInputWidget
         *   - bool $config['or'] Configuration for whether the widget is dropdown AND input
-        *                              or dropdown OR input
+        *       or dropdown OR input
         */
        public function __construct( array $config = [] ) {
                // Configuration initialization
@@ -36,7 +36,7 @@ class SelectWithInputWidget extends \OOUI\Widget {
                        $config
                );
 
-               if ( isset( $config['disabled'] ) && $config['disabled'] == true ) {
+               if ( isset( $config['disabled'] ) && $config['disabled'] ) {
                        $config['textinput']['disabled'] = true;
                        $config['dropdowninput']['disabled'] = true;
                }