diff options
author | Ebrahim Byagowi <ebrahim@gnu.org> | 2024-05-19 20:59:11 +0330 |
---|---|---|
committer | Ebrahim Byagowi <ebrahim@gnu.org> | 2024-05-19 23:57:44 +0330 |
commit | b5727d94b52a3da55453535347773e2ecebfc1a6 (patch) | |
tree | 0483275f6a6231d73539b3b7c7969f06d2404a2a /includes/auth | |
parent | 36eef7f7d4102931120bffa254527889b130562a (diff) | |
download | mediawikicore-b5727d94b52a3da55453535347773e2ecebfc1a6.tar.gz mediawikicore-b5727d94b52a3da55453535347773e2ecebfc1a6.zip |
Import InvalidArgumentException at top of the source
It was asked in a patch review to apply fully import
InvalidArgumentException where possible. I was guessing some
of my other already merged patches have but turned out such
thing exists other places style so for the sake of consistency
I've turned rest of inline import of the specific exception at
top of the file.
There are instances of source files that aren't in any namespace but
have fully qualified import which this patch doesn't touch.
Change-Id: I4071fc698b65746d9594cf4d5f45bae82843d436
Diffstat (limited to 'includes/auth')
-rw-r--r-- | includes/auth/AuthManager.php | 3 | ||||
-rw-r--r-- | includes/auth/ConfirmLinkAuthenticationRequest.php | 4 | ||||
-rw-r--r-- | includes/auth/Throttler.php | 5 |
3 files changed, 8 insertions, 4 deletions
diff --git a/includes/auth/AuthManager.php b/includes/auth/AuthManager.php index 5b9a16f13c8f..b20eb9d32f4e 100644 --- a/includes/auth/AuthManager.php +++ b/includes/auth/AuthManager.php @@ -24,6 +24,7 @@ namespace MediaWiki\Auth; use IDBAccessObject; +use InvalidArgumentException; use Language; use MediaWiki\Block\BlockManager; use MediaWiki\Config\Config; @@ -1793,7 +1794,7 @@ class AuthManager implements LoggerAwareInterface { if ( !in_array( $source, $validSources, true ) && !$this->getAuthenticationProvider( $source ) instanceof PrimaryAuthenticationProvider ) { - throw new \InvalidArgumentException( "Unknown auto-creation source: $source" ); + throw new InvalidArgumentException( "Unknown auto-creation source: $source" ); } $username = $user->getName(); diff --git a/includes/auth/ConfirmLinkAuthenticationRequest.php b/includes/auth/ConfirmLinkAuthenticationRequest.php index d38157476a45..d221eb9fc7f5 100644 --- a/includes/auth/ConfirmLinkAuthenticationRequest.php +++ b/includes/auth/ConfirmLinkAuthenticationRequest.php @@ -21,6 +21,8 @@ namespace MediaWiki\Auth; +use InvalidArgumentException; + /** * @stable to extend */ @@ -38,7 +40,7 @@ class ConfirmLinkAuthenticationRequest extends AuthenticationRequest { */ public function __construct( array $linkRequests ) { if ( !$linkRequests ) { - throw new \InvalidArgumentException( '$linkRequests must not be empty' ); + throw new InvalidArgumentException( '$linkRequests must not be empty' ); } $this->linkRequests = $linkRequests; } diff --git a/includes/auth/Throttler.php b/includes/auth/Throttler.php index 541e8798d51c..4d32285ee721 100644 --- a/includes/auth/Throttler.php +++ b/includes/auth/Throttler.php @@ -22,6 +22,7 @@ namespace MediaWiki\Auth; use BagOStuff; +use InvalidArgumentException; use MediaWiki\Logger\LoggerFactory; use MediaWiki\MainConfigNames; use MediaWiki\MediaWikiServices; @@ -65,7 +66,7 @@ class Throttler implements LoggerAwareInterface { $invalidParams = array_diff_key( $params, array_fill_keys( [ 'type', 'cache', 'warningLimit' ], true ) ); if ( $invalidParams ) { - throw new \InvalidArgumentException( 'unrecognized parameters: ' + throw new InvalidArgumentException( 'unrecognized parameters: ' . implode( ', ', array_keys( $invalidParams ) ) ); } @@ -113,7 +114,7 @@ class Throttler implements LoggerAwareInterface { */ public function increase( $username = null, $ip = null, $caller = null ) { if ( $username === null && $ip === null ) { - throw new \InvalidArgumentException( 'Either username or IP must be set for throttling' ); + throw new InvalidArgumentException( 'Either username or IP must be set for throttling' ); } $userKey = $username ? md5( $username ) : null; |