jenkins-bot has submitted this change and it was merged. Change subject: Clean up code style and docblocks ......................................................................
Clean up code style and docblocks * array() -> [] * spacing fixes * dirname( __FILE__ ) -> __DIR__ * Add phpcs style checks using latest mediawiki-codesniffer to keep things clean. Co-Authored-By: Bryan Davis <[email protected]> Change-Id: I95735f928d3e5d6ac9d2a10d92b40ed01cf2737c --- M OATHAuth.alias.php M OATHAuth.hooks.legacy.php M OATHAuth.hooks.php M OATHAuthKey.php M OATHAuthUtils.php M OATHUser.php M OATHUserRepository.php M auth/TOTPAuthenticationRequest.php M auth/TOTPSecondaryAuthenticationProvider.php M composer.json M maintenance/update_scratch_token_format.php M modules/jquery.qrcode.js A phpcs.xml M special/ProxySpecialPage.php M special/SpecialOATHDisable.php M special/SpecialOATHEnable.php M special/SpecialOATHLogin.php 17 files changed, 144 insertions(+), 121 deletions(-) Approvals: BryanDavis: Looks good to me, approved Reedy: Looks good to me, but someone else must approve jenkins-bot: Verified diff --git a/OATHAuth.alias.php b/OATHAuth.alias.php index e454fd8..4de0434 100644 --- a/OATHAuth.alias.php +++ b/OATHAuth.alias.php @@ -7,39 +7,39 @@ */ // @codingStandardsIgnoreFile -$specialPageAliases = array(); +$specialPageAliases = []; /** English (English) */ -$specialPageAliases['en'] = array( - 'OATH' => array( 'OATH', 'OATHAuth' ), -); +$specialPageAliases['en'] = [ + 'OATH' => [ 'OATH', 'OATHAuth' ], +]; /** Arabic (العربية) */ -$specialPageAliases['ar'] = array( - 'OATH' => array( 'أواث', 'أواث_أوث' ), -); +$specialPageAliases['ar'] = [ + 'OATH' => [ 'أواث', 'أواث_أوث' ], +]; /** Egyptian Arabic (مصرى) */ -$specialPageAliases['arz'] = array( - 'OATH' => array( 'اواث', 'اواث_اوث' ), -); +$specialPageAliases['arz'] = [ + 'OATH' => [ 'اواث', 'اواث_اوث' ], +]; /** Northern Luri (لۊری شومالی) */ -$specialPageAliases['lrc'] = array( - 'OATH' => array( 'قأسأم' ), -); +$specialPageAliases['lrc'] = [ + 'OATH' => [ 'قأسأم' ], +]; /** Urdu (اردو) */ -$specialPageAliases['ur'] = array( - 'OATH' => array( 'حلف_نامہ' ), -); +$specialPageAliases['ur'] = [ + 'OATH' => [ 'حلف_نامہ' ], +]; /** Simplified Chinese (中文(简体)) */ -$specialPageAliases['zh-hans'] = array( - 'OATH' => array( 'OATH验证' ), -); +$specialPageAliases['zh-hans'] = [ + 'OATH' => [ 'OATH验证' ], +]; /** Traditional Chinese (中文(繁體)) */ -$specialPageAliases['zh-hant'] = array( - 'OATH' => array( 'OATH_認證' ), -); \ No newline at end of file +$specialPageAliases['zh-hant'] = [ + 'OATH' => [ 'OATH_認證' ], +]; \ No newline at end of file diff --git a/OATHAuth.hooks.legacy.php b/OATHAuth.hooks.legacy.php index dbe0a9f..d62b3ec 100644 --- a/OATHAuth.hooks.legacy.php +++ b/OATHAuth.hooks.legacy.php @@ -10,7 +10,7 @@ * @return bool */ static function ChangePasswordForm( &$extraFields ) { - $tokenField = array( 'wpOATHToken', 'oathauth-token', 'password', '' ); + $tokenField = [ 'wpOATHToken', 'oathauth-token', 'password', '' ]; array_push( $extraFields, $tokenField ); return true; diff --git a/OATHAuth.hooks.php b/OATHAuth.hooks.php index f2ad0e2..a9100f0 100644 --- a/OATHAuth.hooks.php +++ b/OATHAuth.hooks.php @@ -2,8 +2,6 @@ use MediaWiki\Auth\AuthenticationRequest; use MediaWiki\Auth\AuthManager; -use MediaWiki\Auth\ConfirmLinkSecondaryAuthenticationProvider; -use MediaWiki\Auth\EmailNotificationSecondaryAuthenticationProvider; /** * Hooks for Extension:OATHAuth @@ -119,18 +117,17 @@ $title = SpecialPage::getTitleFor( 'OATH' ); $msg = $oathUser->getKey() !== null ? 'oathauth-disable' : 'oathauth-enable'; - $preferences[$msg] = array( + $preferences[$msg] = [ 'type' => 'info', 'raw' => 'true', 'default' => Linker::link( $title, wfMessage( $msg )->escaped(), - array(), - array( 'returnto' => SpecialPage::getTitleFor( 'Preferences' )->getPrefixedText() ) + [], + [ 'returnto' => SpecialPage::getTitleFor( 'Preferences' )->getPrefixedText() ] ), 'label-message' => 'oathauth-prefs-label', - 'section' => 'personal/info', - ); + 'section' => 'personal/info', ]; return true; } @@ -140,12 +137,12 @@ * @return bool */ public static function onLoadExtensionSchemaUpdates( $updater ) { - $base = dirname( __FILE__ ); + $base = __DIR__; switch ( $updater->getDB()->getType() ) { case 'mysql': case 'sqlite': $updater->addExtensionTable( 'oathauth_users', "$base/sql/mysql/tables.sql" ); - $updater->addExtensionUpdate( array( array( __CLASS__, 'schemaUpdateOldUsersFromInstaller' ) ) ); + $updater->addExtensionUpdate( [ [ __CLASS__, 'schemaUpdateOldUsersFromInstaller' ] ] ); $updater->dropExtensionField( 'oathauth_users', 'secret_reset', "$base/sql/mysql/patch-remove_reset.sql" ); break; @@ -163,7 +160,7 @@ * @return bool */ public static function schemaUpdateOldUsersFromInstaller( DatabaseUpdater $updater ) { - return self::schemaUpdateOldUsers($updater->getDB()); + return self::schemaUpdateOldUsers( $updater->getDB() ); } /** @@ -180,8 +177,8 @@ $res = $db->select( 'oathauth_users', - array( 'id', 'scratch_tokens' ), - array( 'is_validated != 0' ), + [ 'id', 'scratch_tokens' ], + [ 'is_validated != 0' ], __METHOD__ ); @@ -192,15 +189,15 @@ if ( $scratchTokens ) { $db->update( 'oathauth_users', - array( 'scratch_tokens' => implode( ',', $scratchTokens ) ), - array( 'id' => $row->id ), + [ 'scratch_tokens' => implode( ',', $scratchTokens ) ], + [ 'id' => $row->id ], __METHOD__ ); } } // Remove rows from the table where user never completed the setup process - $db->delete( 'oathauth_users', array( 'is_validated' => 0 ), __METHOD__ ); + $db->delete( 'oathauth_users', [ 'is_validated' => 0 ], __METHOD__ ); return true; } diff --git a/OATHAuthKey.php b/OATHAuthKey.php index fb67283..c119da3 100644 --- a/OATHAuthKey.php +++ b/OATHAuthKey.php @@ -34,7 +34,7 @@ public static function newFromRandom() { $object = new self( Base32::encode( MWCryptRand::generate( 10, true ) ), - array() + [] ); $object->regenerateScratchTokens(); @@ -48,12 +48,12 @@ */ public function __construct( $secret, array $scratchTokens ) { // Currently harcoded values; might be used in future - $this->secret = array( + $this->secret = [ 'mode' => 'hotp', 'secret' => $secret, 'period' => 30, 'algorithm' => 'SHA1', - ); + ]; $this->scratchTokens = $scratchTokens; } @@ -65,7 +65,7 @@ } /** - * @return Array + * @return array */ public function getScratchTokens() { return $this->scratchTokens; @@ -83,12 +83,12 @@ public function verifyToken( $token, $user ) { global $wgOATHAuthWindowRadius; - if ($this->secret['mode'] !== 'hotp') { + if ( $this->secret['mode'] !== 'hotp' ) { throw new \DomainException( 'OATHAuth extension does not support non-HOTP tokens' ); } // Prevent replay attacks - $memc = ObjectCache::newAnything( array() ); + $memc = ObjectCache::newAnything( [] ); $uid = CentralIdLookup::factory()->centralIdFromLocalUser( $user->getUser() ); $memcKey = wfMemcKey( 'oauthauth', 'usedtokens', $uid ); $lastWindow = (int)$memc->get( $memcKey ); @@ -96,7 +96,8 @@ $retval = false; $results = HOTP::generateByTimeWindow( Base32::decode( $this->secret['secret'] ), - $this->secret['period'], -$wgOATHAuthWindowRadius, $wgOATHAuthWindowRadius ); + $this->secret['period'], -$wgOATHAuthWindowRadius, $wgOATHAuthWindowRadius + ); // Check to see if the user's given token is in the list of tokens generated // for the time window. foreach ( $results as $window => $result ) { @@ -130,15 +131,18 @@ } if ( $retval ) { - $memc->set( $memcKey, $lastWindow, - $this->secret['period'] * (1 + 2 * $wgOATHAuthWindowRadius) ); + $memc->set( + $memcKey, + $lastWindow, + $this->secret['period'] * ( 1 + 2 * $wgOATHAuthWindowRadius ) + ); } return $retval; } public function regenerateScratchTokens() { - $scratchTokens = array(); + $scratchTokens = []; for ( $i = 0; $i < 5; $i++ ) { array_push( $scratchTokens, Base32::encode( MWCryptRand::generate( 10, true ) ) ); } diff --git a/OATHAuthUtils.php b/OATHAuthUtils.php index 9d8b401..00fe248 100644 --- a/OATHAuthUtils.php +++ b/OATHAuthUtils.php @@ -11,8 +11,8 @@ * Encrypt an aray of variables to put into the user's session. We use this * when storing the user's password in their session. We can use json as the * serialization format because $plaintextVars is an array of strings. - * @param array of user input strings - * @param int user_id, passed to key derivation functions so each user uses + * @param array $plaintextVars array of user input strings + * @param int $userId, passed to key derivation functions so each user uses * distinct encryption and hmac keys * @return string encrypted data packet */ @@ -24,7 +24,8 @@ /** * Decrypt an encrypted packet, generated with encryptSessionData - * @param string Encrypted data packet + * @param string $ciphertext Encrypted data packet + * @param string|int $userId * @return array of strings */ public static function decryptSessionData( $ciphertext, $userId ) { @@ -51,16 +52,16 @@ */ private static function getUserKeys( $secret, $userid ) { $keymats = hash_pbkdf2( 'sha256', $secret, "oath-$userid", 10001, 64, true ); - return array( + return [ 'encrypt' => substr( $keymats, 0, 32 ), 'hmac' => substr( $keymats, 32, 32 ), - ); + ]; } /** * Actually encrypt the data, using a new random IV, and prepend the hmac * of the encrypted data + IV, using a separate hmac key. - * @return $hmac.$iv.$ciphertext, each component b64 encoded + * @return string $hmac.$iv.$ciphertext, each component b64 encoded */ private static function seal( $data, $encKey, $hmacKey ) { $iv = MWCryptRand::generate( 16, true ); @@ -79,7 +80,11 @@ /** * Decrypt data sealed using seal(). First checks the hmac to prevent various * attacks. - * @return plaintext + * @param $encrypted + * @param $encKey + * @param $hmacKey + * @return string plaintext + * @throws Exception */ private static function unseal( $encrypted, $encKey, $hmacKey ) { $pieces = explode( '.', $encrypted ); diff --git a/OATHUser.php b/OATHUser.php index 66b7131..9572a8b 100644 --- a/OATHUser.php +++ b/OATHUser.php @@ -21,6 +21,9 @@ $this->key = $key; } + /** + * @return User + */ public function getUser() { return $this->user; } diff --git a/OATHUserRepository.php b/OATHUserRepository.php index ed48c51..a7f6a33 100644 --- a/OATHUserRepository.php +++ b/OATHUserRepository.php @@ -8,12 +8,16 @@ $this->lb = $lb; } + /** + * @param User $user + * @return OATHUser + */ public function findByUser( User $user ) { $oathUser = new OATHUser( $user, null ); $uid = CentralIdLookup::factory()->centralIdFromLocalUser( $user ); $res = $this->getDB( DB_SLAVE ) - ->selectRow( 'oathauth_users', '*', array( 'id' => $uid ), __METHOD__ ); + ->selectRow( 'oathauth_users', '*', [ 'id' => $uid ], __METHOD__ ); if ( $res ) { $key = new OATHAuthKey( $res->secret, explode( ',', $res->scratch_tokens ) ); $oathUser->setKey( $key ); @@ -25,12 +29,12 @@ public function persist( OATHUser $user ) { $this->getDB( DB_MASTER )->replace( 'oathauth_users', - array( 'id' ), - array( + [ 'id' ], + [ 'id' => CentralIdLookup::factory()->centralIdFromLocalUser( $user->getUser() ), 'secret' => $user->getKey()->getSecret(), 'scratch_tokens' => implode( ',', $user->getKey()->getScratchTokens() ), - ), + ], __METHOD__ ); } @@ -38,7 +42,7 @@ public function remove( OATHUser $user ) { $this->getDB( DB_MASTER )->delete( 'oathauth_users', - array( 'id' => CentralIdLookup::factory()->centralIdFromLocalUser( $user->getUser() ) ), + [ 'id' => CentralIdLookup::factory()->centralIdFromLocalUser( $user->getUser() ) ], __METHOD__ ); } @@ -50,6 +54,6 @@ private function getDB( $index ) { global $wgOATHAuthDatabase; - return $this->lb->getConnectionRef( $index, array(), $wgOATHAuthDatabase ); + return $this->lb->getConnectionRef( $index, [], $wgOATHAuthDatabase ); } } diff --git a/auth/TOTPAuthenticationRequest.php b/auth/TOTPAuthenticationRequest.php index c0d94b3..f3a6723 100644 --- a/auth/TOTPAuthenticationRequest.php +++ b/auth/TOTPAuthenticationRequest.php @@ -18,12 +18,10 @@ } public function getFieldInfo() { - return array( - 'OATHToken' => array( + return [ + 'OATHToken' => [ 'type' => 'string', 'label' => wfMessage( 'oathauth-auth-token-label' ), - 'help' => wfMessage( 'oathauth-auth-token-help' ), - ), - ); + 'help' => wfMessage( 'oathauth-auth-token-help' ), ], ]; } } diff --git a/auth/TOTPSecondaryAuthenticationProvider.php b/auth/TOTPSecondaryAuthenticationProvider.php index af38fbf..23a83f8 100644 --- a/auth/TOTPSecondaryAuthenticationProvider.php +++ b/auth/TOTPSecondaryAuthenticationProvider.php @@ -38,7 +38,7 @@ if ( $oathuser->getKey() === null ) { return AuthenticationResponse::newAbstain(); } else { - return AuthenticationResponse::newUI( array( new TOTPAuthenticationRequest() ), + return AuthenticationResponse::newUI( [ new TOTPAuthenticationRequest() ], wfMessage( 'oathauth-auth-ui' ), 'warning' ); } } @@ -51,14 +51,14 @@ /** @var TOTPAuthenticationRequest $request */ $request = AuthenticationRequest::getRequestByClass( $reqs, TOTPAuthenticationRequest::class ); if ( !$request ) { - return AuthenticationResponse::newUI( array( new TOTPAuthenticationRequest() ), + return AuthenticationResponse::newUI( [ new TOTPAuthenticationRequest() ], wfMessage( 'oathauth-login-failed' ), 'error' ); } $throttler = new Throttler( null, [ 'type' => 'TOTP' ] ); $result = $throttler->increase( $user->getName(), null, __METHOD__ ); if ( $result ) { - return AuthenticationResponse::newUI( array( new TOTPAuthenticationRequest() ), + return AuthenticationResponse::newUI( [ new TOTPAuthenticationRequest() ], new Message( 'oathauth-throttled', [ Message::durationParam( $result['wait'] ) ] @@ -78,7 +78,7 @@ $throttler->clear( $user->getName(), null ); return AuthenticationResponse::newPass(); } else { - return AuthenticationResponse::newUI( array( new TOTPAuthenticationRequest() ), + return AuthenticationResponse::newUI( [ new TOTPAuthenticationRequest() ], wfMessage( 'oathauth-login-failed' ), 'error' ); } } diff --git a/composer.json b/composer.json index 1c63f9e..ca3195e 100644 --- a/composer.json +++ b/composer.json @@ -1,10 +1,15 @@ { "require-dev": { - "jakub-onderka/php-parallel-lint": "0.9.2" + "jakub-onderka/php-parallel-lint": "0.9.2", + "mediawiki/mediawiki-codesniffer": "0.7.2" }, "scripts": { + "lint": "parallel-lint --exclude vendor .", + "phpcs": "phpcs -p -s", + "fix": "phpcbf", "test": [ - "parallel-lint . --exclude vendor" + "composer lint", + "composer phpcs" ] } } diff --git a/maintenance/update_scratch_token_format.php b/maintenance/update_scratch_token_format.php index 5457f5e..82f79f9 100644 --- a/maintenance/update_scratch_token_format.php +++ b/maintenance/update_scratch_token_format.php @@ -24,13 +24,12 @@ * @ingroup Maintenance */ - if ( getenv( 'MW_INSTALL_PATH' ) ) { $IP = getenv( 'MW_INSTALL_PATH' ); } else { - $IP = dirname( __FILE__ ) . '/../../..'; + $IP = __DIR__ . '/../../..'; } -require_once( "$IP/maintenance/Maintenance.php" ); +require_once "$IP/maintenance/Maintenance.php"; class UpdateScratchTokenFormat extends Maintenance { @@ -44,11 +43,11 @@ public function execute() { $dbw = $this->getDB( DB_MASTER ); if ( !OATHAuthHooks::schemaUpdateOldUsers( $dbw ) ) { - $this->error( "Failed to update scratch_token rows.\n", 1); + $this->error( "Failed to update scratch_token rows.\n", 1 ); } $this->output( "Done.\n" ); } } $maintClass = "UpdateScratchTokenFormat"; -require_once( RUN_MAINTENANCE_IF_MAIN ); +require_once RUN_MAINTENANCE_IF_MAIN; diff --git a/modules/jquery.qrcode.js b/modules/jquery.qrcode.js index 6e07fcd..15a1c66 100644 --- a/modules/jquery.qrcode.js +++ b/modules/jquery.qrcode.js @@ -13,8 +13,8 @@ height : 256, typeNumber : -1, correctLevel : QRErrorCorrectLevel.H, - background : "#ffffff", - foreground : "#000000" + background : "#ffffff", + foreground : "#000000" }, options); var createCanvas = function(){ diff --git a/phpcs.xml b/phpcs.xml new file mode 100644 index 0000000..bb624c8 --- /dev/null +++ b/phpcs.xml @@ -0,0 +1,10 @@ +<?xml version="1.0"?> +<ruleset name="MediaWiki"> + <rule ref="vendor/mediawiki/mediawiki-codesniffer/MediaWiki" /> + <file>.</file> + <arg name="encoding" value="utf8"/> + <arg name="extensions" value="php,php5,inc,sample"/> + <exclude-pattern>vendor/</exclude-pattern> + <exclude-pattern>lib/</exclude-pattern> + <exclude-pattern>.git</exclude-pattern> +</ruleset> diff --git a/special/ProxySpecialPage.php b/special/ProxySpecialPage.php index 23e84de..e09e921 100644 --- a/special/ProxySpecialPage.php +++ b/special/ProxySpecialPage.php @@ -39,9 +39,8 @@ */ public function __call( $method, $args ) { $this->init(); - return call_user_func_array( array( $this->target, $method ), $args ); + return call_user_func_array( [ $this->target, $method ], $args ); } - /** * @return string diff --git a/special/SpecialOATHDisable.php b/special/SpecialOATHDisable.php index 3ae265c..b1879b9 100644 --- a/special/SpecialOATHDisable.php +++ b/special/SpecialOATHDisable.php @@ -36,7 +36,7 @@ public function alterForm( HTMLForm $form ) { $form->setMessagePrefix( 'oathauth' ); $form->setWrapperLegend( false ); - $form->getOutput()->setPagetitle( $this->msg( 'oathauth-disable' ) ); + $form->getOutput()->setPageTitle( $this->msg( 'oathauth-disable' ) ); } /** @@ -70,23 +70,23 @@ * @return array[] */ protected function getFormFields() { - return array( - 'token' => array( + return [ + 'token' => [ 'type' => 'text', 'label-message' => 'oathauth-entertoken', 'name' => 'token', - ), - 'returnto' => array( + ], + 'returnto' => [ 'type' => 'hidden', 'default' => $this->getRequest()->getVal( 'returnto' ), 'name' => 'returnto', - ), - 'returntoquery' => array( + ], + 'returntoquery' => [ 'type' => 'hidden', 'default' => $this->getRequest()->getVal( 'returntoquery' ), 'name' => 'returntoquery', - ) - ); + ] + ]; } /** @@ -96,7 +96,7 @@ */ public function onSubmit( array $formData ) { if ( !$this->OATHUser->getKey()->verifyToken( $formData['token'], $this->OATHUser ) ) { - return array( 'oathauth-failedtovalidateoauth' ); + return [ 'oathauth-failedtovalidateoauth' ]; } $this->OATHUser->setKey( null ); diff --git a/special/SpecialOATHEnable.php b/special/SpecialOATHEnable.php index 49439e7..ecc26a1 100644 --- a/special/SpecialOATHEnable.php +++ b/special/SpecialOATHEnable.php @@ -37,7 +37,7 @@ public function alterForm( HTMLForm $form ) { $form->setMessagePrefix( 'oathauth' ); $form->setWrapperLegend( false ); - $form->getOutput()->setPagetitle( $this->msg( 'oathauth-enable' ) ); + $form->getOutput()->setPageTitle( $this->msg( 'oathauth-enable' ) ); $form->getOutput()->addModules( 'ext.oath.showqrcode' ); } @@ -93,20 +93,20 @@ 'style' => 'width: 256px; height: 256px;' ] ); - return array( - 'app' => array( + return [ + 'app' => [ 'type' => 'info', 'default' => $this->msg( 'oathauth-step1-test' )->escaped(), 'raw' => true, 'section' => 'step1', - ), - 'qrcode' => array( + ], + 'qrcode' => [ 'type' => 'info', 'default' => $qrcodeElement, 'raw' => true, 'section' => 'step2', - ), - 'manual' => array( + ], + 'manual' => [ 'type' => 'info', 'label-message' => 'oathauth-step2alt', 'default' => @@ -116,33 +116,32 @@ . $key->getSecret() . '<br/>', 'raw' => true, 'section' => 'step2', - ), - 'scratchtokens' => array( + ], + 'scratchtokens' => [ 'type' => 'info', 'default' => $this->msg( 'openstackmanager-scratchtokens' ) . $this->createResourceList( $key->getScratchTokens() ), 'raw' => true, 'section' => 'step3', - ), - 'token' => array( + ], + 'token' => [ 'type' => 'text', 'default' => '', 'label-message' => 'oathauth-entertoken', 'name' => 'token', 'section' => 'step4', - ), - 'returnto' => array( + ], + 'returnto' => [ 'type' => 'hidden', 'default' => $this->getRequest()->getVal( 'returnto' ), 'name' => 'returnto', - ), - 'returntoquery' => array( + ], + 'returntoquery' => [ 'type' => 'hidden', 'default' => $this->getRequest()->getVal( 'returntoquery' ), - 'name' => 'returntoquery', - ) - ); + 'name' => 'returntoquery', ] + ]; } /** @@ -155,7 +154,7 @@ $key = $this->getRequest()->getSessionData( 'oathauth_key' ); if ( !$key->verifyToken( $formData['token'], $this->OATHUser ) ) { - return array( 'oathauth-failedtovalidateoauth' ); + return [ 'oathauth-failedtovalidateoauth' ]; } $this->getRequest()->setSessionData( 'oathauth_key', null ); @@ -177,8 +176,8 @@ private function createResourceList( $resources ) { $resourceList = ''; foreach ( $resources as $resource ) { - $resourceList .= Html::rawElement( 'li', array(), $resource ); + $resourceList .= Html::rawElement( 'li', [], $resource ); } - return Html::rawElement( 'ul', array(), $resourceList ); + return Html::rawElement( 'ul', [], $resourceList ); } } diff --git a/special/SpecialOATHLogin.php b/special/SpecialOATHLogin.php index 0749535..a50cc6c 100644 --- a/special/SpecialOATHLogin.php +++ b/special/SpecialOATHLogin.php @@ -38,7 +38,7 @@ public function alterForm( HTMLForm $form ) { $form->setMessagePrefix( 'oathauth' ); $form->setWrapperLegend( false ); - $form->getOutput()->setPagetitle( $this->msg( 'oathauth-login' ) ); + $form->getOutput()->setPageTitle( $this->msg( 'oathauth-login' ) ); } /** @@ -59,25 +59,25 @@ * @return array[] */ protected function getFormFields() { - return array( - 'token' => array( + return [ + 'token' => [ 'type' => 'text', 'default' => '', 'label-message' => 'oathauth-entertoken', 'name' => 'token', 'required' => true - ), - 'returnto' => array( + ], + 'returnto' => [ 'type' => 'hidden', 'default' => $this->getRequest()->getVal( 'returnto' ), 'name' => 'returnto', - ), - 'returntoquery' => array( + ], + 'returntoquery' => [ 'type' => 'hidden', 'default' => $this->getRequest()->getVal( 'returntoquery' ), 'name' => 'returntoquery', - ) - ); + ] + ]; } /** -- To view, visit https://gerrit.wikimedia.org/r/311202 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I95735f928d3e5d6ac9d2a10d92b40ed01cf2737c Gerrit-PatchSet: 4 Gerrit-Project: mediawiki/extensions/OATHAuth Gerrit-Branch: master Gerrit-Owner: Reedy <[email protected]> Gerrit-Reviewer: BryanDavis <[email protected]> Gerrit-Reviewer: CSteipp <[email protected]> Gerrit-Reviewer: Dpatrick <[email protected]> Gerrit-Reviewer: Gergő Tisza <[email protected]> Gerrit-Reviewer: Legoktm <[email protected]> Gerrit-Reviewer: Reedy <[email protected]> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
