Use PHP 7 '??' operator instead of '?:' with 'isset()' where convenient
[lhc/web/wiklou.git] / includes / preferences / DefaultPreferencesFactory.php
index 62973d9..0a9e9c8 100644 (file)
@@ -185,9 +185,7 @@ class DefaultPreferencesFactory implements PreferencesFactory {
                                $info['disabled'] = 'disabled';
                        }
                        $field = HTMLForm::loadInputFromParameters( $name, $info, $dummyForm ); // For validation
-                       $globalDefault = isset( $defaultOptions[$name] )
-                               ? $defaultOptions[$name]
-                               : null;
+                       $globalDefault = $defaultOptions[$name] ?? null;
 
                        // If it validates, set it as the default
                        if ( isset( $info['default'] ) ) {
@@ -221,7 +219,7 @@ class DefaultPreferencesFactory implements PreferencesFactory {
                if ( ( isset( $info['type'] ) && $info['type'] == 'multiselect' ) ||
                                ( isset( $info['class'] ) && $info['class'] == \HTMLMultiSelectField::class ) ) {
                        $options = HTMLFormField::flattenOptions( $info['options'] );
-                       $prefix = isset( $info['prefix'] ) ? $info['prefix'] : $name;
+                       $prefix = $info['prefix'] ?? $name;
                        $val = [];
 
                        foreach ( $options as $value ) {
@@ -236,7 +234,7 @@ class DefaultPreferencesFactory implements PreferencesFactory {
                                ( isset( $info['class'] ) && $info['class'] == \HTMLCheckMatrix::class ) ) {
                        $columns = HTMLFormField::flattenOptions( $info['columns'] );
                        $rows = HTMLFormField::flattenOptions( $info['rows'] );
-                       $prefix = isset( $info['prefix'] ) ? $info['prefix'] : $name;
+                       $prefix = $info['prefix'] ?? $name;
                        $val = [];
 
                        foreach ( $columns as $column ) {