diff options
author | Daimona Eaytoy <daimona.wiki@gmail.com> | 2024-01-28 22:41:46 +0100 |
---|---|---|
committer | Daimona Eaytoy <daimona.wiki@gmail.com> | 2024-01-28 22:41:46 +0100 |
commit | 4637824f688eb2cddacfa6318a3dc1d1ece3bef7 (patch) | |
tree | d358e7ed404870c89a625ca51f023ff0c44ce7cd /includes | |
parent | 8d637a128072246858cc6d6ca5c8225c062194e4 (diff) | |
download | mediawikicore-4637824f688eb2cddacfa6318a3dc1d1ece3bef7.tar.gz mediawikicore-4637824f688eb2cddacfa6318a3dc1d1ece3bef7.zip |
Replace unchecked MWException with SPL exceptions
Bug: T328220
Change-Id: I4e0454ce3ad3741756e2010a76e548d6c9a6bcb5
Diffstat (limited to 'includes')
-rw-r--r-- | includes/Revision/RevisionStore.php | 3 | ||||
-rw-r--r-- | includes/content/WikitextContent.php | 6 | ||||
-rw-r--r-- | includes/editpage/EditPage.php | 2 | ||||
-rw-r--r-- | includes/language/LanguageConverter.php | 2 | ||||
-rw-r--r-- | includes/user/TempUser/ScrambleMapping.php | 3 |
5 files changed, 7 insertions, 9 deletions
diff --git a/includes/Revision/RevisionStore.php b/includes/Revision/RevisionStore.php index 6b88207d44db..68817f057552 100644 --- a/includes/Revision/RevisionStore.php +++ b/includes/Revision/RevisionStore.php @@ -2369,7 +2369,6 @@ class RevisionStore * RevisionStore is bound to. * * @param IReadableDatabase $db - * @throws MWException */ private function checkDatabaseDomain( IReadableDatabase $db ) { $dbDomain = $db->getDomainID(); @@ -2378,7 +2377,7 @@ class RevisionStore return; } - throw new MWException( "DB connection domain '$dbDomain' does not match '$storeDomain'" ); + throw new RuntimeException( "DB connection domain '$dbDomain' does not match '$storeDomain'" ); } /** diff --git a/includes/content/WikitextContent.php b/includes/content/WikitextContent.php index 458033ba9cec..41400c1ab9b8 100644 --- a/includes/content/WikitextContent.php +++ b/includes/content/WikitextContent.php @@ -74,10 +74,8 @@ class WikitextContent extends TextContent { /** * @param string|int|null|false $sectionId - * @param Content $with + * @param Content $with New section content, must have the same content model as $this. * @param string $sectionTitle - * - * @throws MWException * @return Content * * @see Content::replaceSection() @@ -88,7 +86,7 @@ class WikitextContent extends TextContent { $sectionModelId = $with->getModel(); if ( $sectionModelId != $myModelId ) { - throw new MWException( "Incompatible content model for section: " . + throw new InvalidArgumentException( "Incompatible content model for section: " . "document uses $myModelId but " . "section uses $sectionModelId." ); } diff --git a/includes/editpage/EditPage.php b/includes/editpage/EditPage.php index 1321994c9203..5aa6d58cf913 100644 --- a/includes/editpage/EditPage.php +++ b/includes/editpage/EditPage.php @@ -568,7 +568,7 @@ class EditPage implements IEditObject { * * @param string $modelId The ID of the content model to test. Use CONTENT_MODEL_XXX constants. * @return bool - * @throws MWException If $modelId has no known handler + * @throws MWUnknownContentModelException If $modelId has no known handler */ private function isSupportedContentModel( string $modelId ): bool { return $this->enableApiEditOverride === true || diff --git a/includes/language/LanguageConverter.php b/includes/language/LanguageConverter.php index 9392ea0ec98a..9ec8d174c736 100644 --- a/includes/language/LanguageConverter.php +++ b/includes/language/LanguageConverter.php @@ -633,7 +633,7 @@ abstract class LanguageConverter implements ILanguageConverter { $m = array_shift( $matches ); $this->loadTables(); if ( !isset( $this->mTables[$variant] ) ) { - throw new MWException( "Broken variant table: " + throw new RuntimeException( "Broken variant table: " . implode( ',', array_keys( $this->mTables ) ) ); } $ret = $this->mTables[$variant]->replace( $m[0] ); diff --git a/includes/user/TempUser/ScrambleMapping.php b/includes/user/TempUser/ScrambleMapping.php index 57a46e04ab27..fa2d29084834 100644 --- a/includes/user/TempUser/ScrambleMapping.php +++ b/includes/user/TempUser/ScrambleMapping.php @@ -3,6 +3,7 @@ namespace MediaWiki\User\TempUser; use LogicException; +use OutOfBoundsException; use RuntimeException; /** @@ -80,7 +81,7 @@ class ScrambleMapping implements SerialMapping { } $offset = $this->offset; if ( $index - $offset < 0 ) { - throw new \MWException( __METHOD__ . ": The configured offset $offset is too large." ); + throw new OutOfBoundsException( __METHOD__ . ": The configured offset $offset is too large." ); } foreach ( self::GENERATORS as [ $g, $p ] ) { if ( $index - $offset < $p ) { |