jenkins-bot has submitted this change and it was merged.

Change subject: build: Updating mediawiki/mediawiki-codesniffer to 0.7.1
......................................................................


build: Updating mediawiki/mediawiki-codesniffer to 0.7.1

Also added "composer fix" command.

Change-Id: I3259f41b0b5c56924d51ccf8afd86846239fed77
---
M composer.json
M handlers/AuthenticationHandler.php
M handlers/OAuth1Handler.php
M specials/SpecialOAuthLogin.php
M tests/OAuthAuthDBTest.php
M tests/OAuthAuthHooksTest.php
M utils/Hooks.php
M utils/OAuthExternalUser.php
M utils/Policy.php
9 files changed, 44 insertions(+), 48 deletions(-)

Approvals:
  Tim Starling: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/composer.json b/composer.json
index a799d18..21f773e 100644
--- a/composer.json
+++ b/composer.json
@@ -24,12 +24,15 @@
        "require-dev": {
                "jakub-onderka/php-parallel-lint": "0.9.2",
                "jakub-onderka/php-console-highlighter": "0.3.2",
-               "mediawiki/mediawiki-codesniffer": "0.5.1"
+               "mediawiki/mediawiki-codesniffer": "0.7.1"
        },
        "scripts": {
                "test": [
                        "parallel-lint . --exclude vendor",
                        "phpcs -p -s"
+               ],
+               "fix": [
+                       "phpcbf"
                ]
        }
 }
diff --git a/handlers/AuthenticationHandler.php 
b/handlers/AuthenticationHandler.php
index 0c0cfff..c037a38 100644
--- a/handlers/AuthenticationHandler.php
+++ b/handlers/AuthenticationHandler.php
@@ -27,11 +27,11 @@
 
                if ( $exUser->attached() ) {
                        $status = AuthenticationHandler::doLogin( $exUser, 
$request );
-                       $s = \Status::newGood( array( 'successfulLogin', 
$status->getValue() ) );
+                       $s = \Status::newGood( [ 'successfulLogin', 
$status->getValue() ] );
                        $s->merge( $status );
                } else {
                        $status = AuthenticationHandler::doCreateAndLogin( 
$exUser, $request );
-                       $s = \Status::newGood( array( 'successfulCreation', 
$status->getValue() ) );
+                       $s = \Status::newGood( [ 'successfulCreation', 
$status->getValue() ] );
                        $s->merge( $status );
                }
 
@@ -79,7 +79,7 @@
                        $u->addWatch( $u->getUserPage(), 
\WatchedItem::IGNORE_USER_RIGHTS );
                        $u->saveSettings();
 
-                       wfRunHooks( 'AddNewAccount', array( $u, false ) );
+                       wfRunHooks( 'AddNewAccount', [ $u, false ] );
 
                        $exUser->setLocalId( $u->getId() );
                }
@@ -92,7 +92,6 @@
 
                return \Status::newGood( $u );
        }
-
 
        public static function doLogin( OAuthExternalUser $exUser, \WebRequest 
$request ) {
                global $wgSecureLogin, $wgCookieSecure;
diff --git a/handlers/OAuth1Handler.php b/handlers/OAuth1Handler.php
index 5a45762..5229967 100644
--- a/handlers/OAuth1Handler.php
+++ b/handlers/OAuth1Handler.php
@@ -7,7 +7,6 @@
 
 class OAuth1Handler {
 
-
        public function init( SessionStore $session, Client $client ) {
                // Step 1 - Get a request token
                list( $redir, $requestToken ) = $client->initiate();
@@ -18,7 +17,6 @@
        public function authorize( \WebResponse $response, $url ) {
                $response->header( "Location: $url", true );
        }
-
 
        public function finish( \WebRequest $request, SessionStore $session, 
Client $client ) {
                $verifyCode = $request->getVal( 'oauth_verifier', false );
@@ -44,13 +42,11 @@
                return $accessToken;
        }
 
-
        public function identify( Token $accessToken, Client $client ) {
                // Get Identity
                $identity = $client->identify( $accessToken );
 
                return $identity;
        }
-
 
 }
diff --git a/specials/SpecialOAuthLogin.php b/specials/SpecialOAuthLogin.php
index 59b6782..d847f5f 100644
--- a/specials/SpecialOAuthLogin.php
+++ b/specials/SpecialOAuthLogin.php
@@ -11,7 +11,6 @@
                parent::__construct( 'OAuthLogin' );
        }
 
-
        public function execute( $subpage ) {
                global $wgUser, $wgOAuthAuthenticationCallbackUrl;
                $request = $this->getRequest();
diff --git a/tests/OAuthAuthDBTest.php b/tests/OAuthAuthDBTest.php
index 75b2065..7afb2fd 100644
--- a/tests/OAuthAuthDBTest.php
+++ b/tests/OAuthAuthDBTest.php
@@ -7,7 +7,7 @@
  */
 class OAuthAuthDBTest extends \MediaWikiTestCase {
 
-       public function __construct( $name = null, array $data = array(), 
$dataName = '' ) {
+       public function __construct( $name = null, array $data = [], $dataName 
= '' ) {
                parent::__construct( $name, $data, $dataName );
        }
 
diff --git a/tests/OAuthAuthHooksTest.php b/tests/OAuthAuthHooksTest.php
index 0d34013..97d8311 100644
--- a/tests/OAuthAuthHooksTest.php
+++ b/tests/OAuthAuthHooksTest.php
@@ -8,11 +8,11 @@
 
        public function testOnPersonalUrls() {
 
-               $this->setMwGlobals( array(
+               $this->setMwGlobals( [
                        'wgUser' => \User::newFromName( '127.0.0.1', false ),
-               ) );
+               ] );
 
-               $personal_urls = array( 'login' => array( 'href' => 'fail' ) );
+               $personal_urls = [ 'login' => [ 'href' => 'fail' ] ];
                $title = new \Title();
 
                Hooks::onPersonalUrls( $personal_urls, $title );
diff --git a/utils/Hooks.php b/utils/Hooks.php
index 9fdfb91..db6ee3e 100644
--- a/utils/Hooks.php
+++ b/utils/Hooks.php
@@ -12,7 +12,7 @@
 
                if ( $wgUser->getID() == 0 ) {
 
-                       $query = array();
+                       $query = [];
                        if ( $title->isSpecial( 'Userlogout' ) ) {
                                $query['returnto'] =  $wgRequest->getVal( 
'returnto', 'Main_Page' );
                                $query['returntoquery'] =  $wgRequest->getVal( 
'returntoquery' );
@@ -64,20 +64,20 @@
                $resetlink = \Linker::link(
                        \SpecialPage::getTitleFor( 'PasswordReset' ),
                        wfMessage( 'passwordreset' )->escaped(),
-                       array(),
-                       array( 'returnto' => \SpecialPage::getTitleFor( 
'Preferences' ) )
+                       [],
+                       [ 'returnto' => \SpecialPage::getTitleFor( 
'Preferences' ) ]
                );
 
                if ( empty( $user->mPassword ) && empty( $user->mNewpassword ) 
) {
 
                        if ( $user->isEmailConfirmed() ) {
-                               $preferences['password'] = array(
+                               $preferences['password'] = [
                                        'section' => 'personal/info',
                                        'type' => 'info',
                                        'raw' => true,
                                        'default' => $resetlink,
                                        'label-message' => 'yourpassword',
-                               );
+                               ];
                        } else {
                                unset( $preferences['password'] );
                        }
@@ -97,24 +97,24 @@
                                        )->escaped();
                                        $emailCss = 'mw-email-authenticated';
                                }
-                               $preferences['emailaddress'] = array(
+                               $preferences['emailaddress'] = [
                                        'type' => 'info',
                                        'raw' => 1,
                                        'default' => $emailMsg,
                                        'section' => 'personal/email',
                                        'label-message' => 'youremail',
                                        'cssclass' => $emailCss,
-                               );
+                               ];
                        }
 
                } else {
-                       $preferences['resetpassword'] = array(
+                       $preferences['resetpassword'] = [
                                'section' => 'personal/info',
                                'type' => 'info',
                                'raw' => true,
                                'default' => $resetlink,
                                'label-message' => null,
-                       );
+                       ];
                }
 
        }
@@ -162,14 +162,14 @@
                global $wgOAuthAuthenticationAllowLocalUsers, $wgRequest;
 
                if ( $wgOAuthAuthenticationAllowLocalUsers === false ) {
-                       $query = array();
+                       $query = [];
                        $query['returnto'] = $wgRequest->getVal( 'returnto' );
                        $query['returntoquery'] = $wgRequest->getVal( 
'returntoquery' );
                        $loginTitle = \SpecialPage::getTitleFor( 'OAuthLogin', 
'init' );
                        $loginlink = \Linker::Link(
                                $loginTitle,
                                wfMessage( 'login' )->escaped(),
-                               array(),
+                               [],
                                $query
                        );
                        $msg = wfMessage( 'oauthauth-localuser-not-allowed' 
)->rawParams( $loginlink );
diff --git a/utils/OAuthExternalUser.php b/utils/OAuthExternalUser.php
index 4411ca3..8e92213 100644
--- a/utils/OAuthExternalUser.php
+++ b/utils/OAuthExternalUser.php
@@ -44,9 +44,9 @@
        public static function newFromRemoteId( $rid, $username, \DatabaseBase 
$db ) {
                $row = $db->selectRow(
                        'oauthauth_user',
-                       array( 'oaau_rid', 'oaau_uid', 'oaau_username', 
'oaau_access_token',
-                               'oaau_access_secret', 'oaau_identify_timestamp' 
),
-                       array( 'oaau_rid' => $rid ),
+                       [ 'oaau_rid', 'oaau_uid', 'oaau_username', 
'oaau_access_token',
+                               'oaau_access_secret', 'oaau_identify_timestamp' 
],
+                       [ 'oaau_rid' => $rid ],
                        __METHOD__
                );
 
@@ -62,9 +62,9 @@
        public static function newFromUser( \User $user, \DatabaseBase $db ) {
                $row = $db->selectRow(
                        'oauthauth_user',
-                       array( 'oaau_rid', 'oaau_uid', 'oaau_username', 
'oaau_access_token',
-                               'oaau_access_secret', 'oaau_identify_timestamp' 
),
-                       array( 'oaau_username' => $user->getName() ),
+                       [ 'oaau_rid', 'oaau_uid', 'oaau_username', 
'oaau_access_token',
+                               'oaau_access_secret', 'oaau_identify_timestamp' 
],
+                       [ 'oaau_username' => $user->getName() ],
                        __METHOD__
                );
 
@@ -78,23 +78,23 @@
        }
 
        public function addToDatabase( \DatabaseBase $db ) {
-               $row = array(
+               $row = [
                        'oaau_rid' => $this->remoteId,
                        'oaau_uid' => $this->userId,
                        'oaau_username' => $this->username,
-               );
+               ];
 
                if ( $this->accessToken ) {
-                       $row += array(
+                       $row += [
                                'oaau_access_token' => $this->accessToken->key,
                                'oaau_access_secret' => 
$this->accessToken->secret,
-                       );
+                       ];
                }
 
                if ( $this->identifyTS ) {
-                       $row += array(
+                       $row += [
                                'oaau_identify_timestamp' => 
$db->timestampOrNull( (string)$this->identifyTS ),
-                       );
+                       ];
                }
 
                $db->insert(
@@ -108,28 +108,28 @@
                if ( !$this->userId > 0 ) {
                        throw new Exception( 'Error updating External User that 
isn\'t in the DB' );
                }
-               $row = array(
+               $row = [
                        'oaau_rid' => $this->remoteId,
                        'oaau_username' => $this->username,
-               );
+               ];
 
                if ( $this->accessToken ) {
-                       $row += array(
+                       $row += [
                                'oaau_access_token' => $this->accessToken->key,
                                'oaau_access_secret' => 
$this->accessToken->secret,
-                       );
+                       ];
                }
 
                if ( $this->identifyTS ) {
-                       $row += array(
+                       $row += [
                                'oaau_identify_timestamp' => 
$db->timestampOrNull( (string)$this->identifyTS ),
-                       );
+                       ];
                }
 
                $db->update(
                        'oauthauth_user',
                        /* SET */ $row,
-                       /* WHERE */ array( 'oaau_uid' => $this->userId ),
+                       /* WHERE */ [ 'oaau_uid' => $this->userId ],
                        __METHOD__
                );
 
@@ -141,11 +141,11 @@
                }
                $db->update(
                        'oauthauth_user',
-                       array(
+                       [
                                'oaau_access_token' => '',
                                'oaau_access_secret' => '',
-                       ),
-                       array( 'oaau_uid' => $this->userId ),
+                       ],
+                       [ 'oaau_uid' => $this->userId ],
                        __METHOD__
                );
        }
diff --git a/utils/Policy.php b/utils/Policy.php
index 8eb7539..8cea07d 100644
--- a/utils/Policy.php
+++ b/utils/Policy.php
@@ -25,7 +25,6 @@
                        && self::checkGroupWhitelist( $identity->groups, 
$wgOAuthAuthenticationGroupWhitelist );
        }
 
-
        private static function checkUserWhitelist( $username, $whitelist ) {
                return !$whitelist || in_array( $username, $whitelist );
        }

-- 
To view, visit https://gerrit.wikimedia.org/r/287853
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I3259f41b0b5c56924d51ccf8afd86846239fed77
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/OAuthAuthentication
Gerrit-Branch: master
Gerrit-Owner: Legoktm <legoktm.wikipe...@gmail.com>
Gerrit-Reviewer: Reedy <re...@wikimedia.org>
Gerrit-Reviewer: Tim Starling <tstarl...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to