mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/ConfirmEdit
synced 2024-11-23 15:56:50 +00:00
Replace deprecated MWException
Also avoid throwing Exception directly and use RuntimeException instead, not documenting it with @throws as it's unchecked, as per https://www.mediawiki.org/wiki/Manual:Coding_conventions/PHP#Exception_handling. Bug: T328220 Change-Id: I19df0e7e66d1e421d038109b9d2db9c0b63c709c
This commit is contained in:
parent
61d8028d69
commit
364b71f3ec
|
@ -2,8 +2,8 @@
|
|||
|
||||
namespace MediaWiki\Extension\ConfirmEdit\Store;
|
||||
|
||||
use Exception;
|
||||
use MWException;
|
||||
use BadMethodCallException;
|
||||
use ConfigException;
|
||||
|
||||
abstract class CaptchaStore {
|
||||
/**
|
||||
|
@ -41,7 +41,6 @@ abstract class CaptchaStore {
|
|||
/**
|
||||
* Get somewhere to store captcha data that will persist between requests
|
||||
*
|
||||
* @throws Exception
|
||||
* @return CaptchaStore
|
||||
*/
|
||||
final public static function get() {
|
||||
|
@ -50,7 +49,7 @@ abstract class CaptchaStore {
|
|||
if ( in_array( self::class, class_parents( $wgCaptchaStorageClass ) ) ) {
|
||||
self::$instance = new $wgCaptchaStorageClass;
|
||||
} else {
|
||||
throw new Exception( "Invalid CaptchaStore class $wgCaptchaStorageClass" );
|
||||
throw new ConfigException( "Invalid CaptchaStore class $wgCaptchaStorageClass" );
|
||||
}
|
||||
}
|
||||
return self::$instance;
|
||||
|
@ -58,7 +57,7 @@ abstract class CaptchaStore {
|
|||
|
||||
final public static function unsetInstanceForTests() {
|
||||
if ( !defined( 'MW_PHPUNIT_TEST' ) ) {
|
||||
throw new MWException( 'Cannot unset ' . __CLASS__ . ' instance in operation.' );
|
||||
throw new BadMethodCallException( 'Cannot unset ' . __CLASS__ . ' instance in operation.' );
|
||||
}
|
||||
self::$instance = null;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue