From 002240b3849f80f5da97a9950501c1c5a84aaf32 Mon Sep 17 00:00:00 2001 From: github-actions Date: Sat, 9 Jan 2021 22:15:47 +0000 Subject: [PATCH] ci: lint code to MediaWiki standards Check commit and GitHub actions for more details --- includes/CitizenHooks.php | 48 +++++++++++++++++++-------------------- includes/SkinCitizen.php | 48 +++++++++++++++++++-------------------- 2 files changed, 48 insertions(+), 48 deletions(-) diff --git a/includes/CitizenHooks.php b/includes/CitizenHooks.php index 4b45ed86..15b55117 100644 --- a/includes/CitizenHooks.php +++ b/includes/CitizenHooks.php @@ -153,30 +153,30 @@ class CitizenHooks { return MediaWikiServices::getInstance()->getConfigFactory()->makeConfig( 'Citizen' )->get( $name ); } - /** - * @param User $user - * @param array $preferences - */ - public static function onGetPreferences( $user, &$preferences ) { - $options = MediaWikiServices::getInstance() - ->getUserOptionsLookup() - ->getOptions( $user ); + /** + * @param User $user + * @param array &$preferences + */ + public static function onGetPreferences( $user, &$preferences ) { + $options = MediaWikiServices::getInstance() + ->getUserOptionsLookup() + ->getOptions( $user ); - if ( $options['skin'] !== 'citizen' ) { - return; - } + if ( $options['skin'] !== 'citizen' ) { + return; + } - // A checkbox - $preferences['citizen-color-scheme'] = [ - 'type' => 'select', - 'label-message' => 'citizen-upo-style', - 'section' => 'rendering/skin', - 'options' => [ - wfMessage( 'citizen-upo-style-auto' )->escaped() => 'auto', - wfMessage( 'citizen-upo-style-light' )->escaped() => 'light', - wfMessage( 'citizen-upo-style-dark' )->escaped() => 'dark', - ], - 'default' => $options['citizen-color-scheme'] ?? 'auto' - ]; - } + // A checkbox + $preferences['citizen-color-scheme'] = [ + 'type' => 'select', + 'label-message' => 'citizen-upo-style', + 'section' => 'rendering/skin', + 'options' => [ + wfMessage( 'citizen-upo-style-auto' )->escaped() => 'auto', + wfMessage( 'citizen-upo-style-light' )->escaped() => 'light', + wfMessage( 'citizen-upo-style-dark' )->escaped() => 'dark', + ], + 'default' => $options['citizen-color-scheme'] ?? 'auto' + ]; + } } diff --git a/includes/SkinCitizen.php b/includes/SkinCitizen.php index a2fa5f0b..b0ce676c 100644 --- a/includes/SkinCitizen.php +++ b/includes/SkinCitizen.php @@ -736,32 +736,32 @@ class SkinCitizen extends SkinMustache { } } - /** - * Sets the corresponding color scheme class on the element - * If the color scheme is set to auto, the theme switcher script will be added - * - * @param OutputPage $out - * @param array $skinOptions - */ + /** + * Sets the corresponding color scheme class on the element + * If the color scheme is set to auto, the theme switcher script will be added + * + * @param OutputPage $out + * @param array &$skinOptions + */ private function setSkinColorScheme( OutputPage $out, array &$skinOptions ) { - $options = MediaWikiServices::getInstance() - ->getUserOptionsLookup() - ->getOptions( $this->getUser() ); + $options = MediaWikiServices::getInstance() + ->getUserOptionsLookup() + ->getOptions( $this->getUser() ); - $skinStyle = $this->getConfigValue( 'ColorScheme' ); + $skinStyle = $this->getConfigValue( 'ColorScheme' ); - $setDarkClass = $skinStyle === 'dark' || $options['citizen-color-scheme'] === 'dark'; - $setLightClass = $skinStyle === 'light' || $options['citizen-color-scheme'] === 'light'; + $setDarkClass = $skinStyle === 'dark' || $options['citizen-color-scheme'] === 'dark'; + $setLightClass = $skinStyle === 'light' || $options['citizen-color-scheme'] === 'light'; - if ( $setDarkClass ) { - $out->addHtmlClasses( 'skin-citizen-dark' ); - } elseif ($setLightClass) { - $out->addHtmlClasses( 'skin-citizen-light' ); - } else { - $skinOptions['scripts'] = array_merge( - $skinOptions['scripts'], - [ 'skins.citizen.scripts.theme-switcher' ] - ); - } - } + if ( $setDarkClass ) { + $out->addHtmlClasses( 'skin-citizen-dark' ); + } elseif ( $setLightClass ) { + $out->addHtmlClasses( 'skin-citizen-light' ); + } else { + $skinOptions['scripts'] = array_merge( + $skinOptions['scripts'], + [ 'skins.citizen.scripts.theme-switcher' ] + ); + } + } }