Merge "DI for CommentStore in RevisionStore"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Thu, 8 Feb 2018 20:44:30 +0000 (20:44 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 8 Feb 2018 20:44:31 +0000 (20:44 +0000)
includes/auth/AuthManagerAuthPlugin.php
includes/auth/LegacyHookPreAuthenticationProvider.php
tests/phpunit/includes/auth/AuthManagerTest.php

index 9a1e445..4f84b4c 100644 (file)
@@ -20,6 +20,7 @@
 
 namespace MediaWiki\Auth;
 
+use Psr\Log\LoggerInterface;
 use User;
 
 /**
@@ -31,7 +32,7 @@ class AuthManagerAuthPlugin extends \AuthPlugin {
        /** @var string|null */
        protected $domain = null;
 
-       /** @var \\Psr\\Log\\LoggerInterface */
+       /** @var LoggerInterface */
        protected $logger = null;
 
        public function __construct() {
index 97bbde7..95fe3ab 100644 (file)
@@ -58,14 +58,14 @@ class LegacyHookPreAuthenticationProvider extends AbstractPreAuthenticationProvi
                $msg = null;
                if ( !\Hooks::run( 'LoginUserMigrated', [ $user, &$msg ] ) ) {
                        return $this->makeFailResponse(
-                               $user, null, LoginForm::USER_MIGRATED, $msg, 'LoginUserMigrated'
+                               $user, LoginForm::USER_MIGRATED, $msg, 'LoginUserMigrated'
                        );
                }
 
                $abort = LoginForm::ABORTED;
                $msg = null;
                if ( !\Hooks::run( 'AbortLogin', [ $user, $password, &$abort, &$msg ] ) ) {
-                       return $this->makeFailResponse( $user, null, $abort, $msg, 'AbortLogin' );
+                       return $this->makeFailResponse( $user, $abort, $msg, 'AbortLogin' );
                }
 
                return StatusValue::newGood();
@@ -103,7 +103,7 @@ class LegacyHookPreAuthenticationProvider extends AbstractPreAuthenticationProvi
                                // Hook point to add extra creation throttles and blocks
                                $this->logger->debug( __METHOD__ . ": a hook blocked auto-creation: $abortError\n" );
                                return $this->makeFailResponse(
-                                       $user, $user, LoginForm::ABORTED, $abortError, 'AbortAutoAccount'
+                                       $user, LoginForm::ABORTED, $abortError, 'AbortAutoAccount'
                                );
                        }
                }
@@ -114,13 +114,12 @@ class LegacyHookPreAuthenticationProvider extends AbstractPreAuthenticationProvi
        /**
         * Construct an appropriate failure response
         * @param User $user
-        * @param User|null $creator
         * @param int $constant One of the LoginForm::… constants
         * @param string|null $msg Optional message key, will be derived from $constant otherwise
         * @param string $hook Name of the hook for error logging and exception messages
         * @return StatusValue
         */
-       protected function makeFailResponse( $user, $creator, $constant, $msg, $hook ) {
+       private function makeFailResponse( User $user, $constant, $msg, $hook ) {
                switch ( $constant ) {
                        case LoginForm::SUCCESS:
                                // WTF?
index b8f7b73..e4056ee 100644 (file)
@@ -2,10 +2,13 @@
 
 namespace MediaWiki\Auth;
 
+use Config;
 use MediaWiki\Session\SessionInfo;
 use MediaWiki\Session\UserInfo;
+use Psr\Log\LoggerInterface;
 use Psr\Log\LogLevel;
 use StatusValue;
+use WebRequest;
 use Wikimedia\ScopedCallback;
 use Wikimedia\TestingAccessWrapper;
 
@@ -19,7 +22,7 @@ class AuthManagerTest extends \MediaWikiTestCase {
        protected $request;
        /** @var Config */
        protected $config;
-       /** @var \\Psr\\Log\\LoggerInterface */
+       /** @var LoggerInterface */
        protected $logger;
 
        protected $preauthMocks = [];