mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-09-23 10:19:05 +00:00
Replace deprecated MWException
And more generally remove `@throws` comment used for unchecked exceptions, callers must not catch them. Bug: T328220 Bug: T240672 Change-Id: I4768144d02feb6d4b6bae1a1ad39af6031f9613f
This commit is contained in:
parent
c480472a43
commit
1898a3ccab
|
@ -27,7 +27,6 @@ use MediaWiki\SpecialPage\SpecialPageFactory;
|
|||
use MediaWiki\User\UserIdentity;
|
||||
use MediaWiki\User\UserOptionsLookup;
|
||||
use Message;
|
||||
use MWException;
|
||||
use SpecialPage;
|
||||
use Title;
|
||||
|
||||
|
@ -83,7 +82,6 @@ final class Definitions {
|
|||
* @param string $className Optional HTML classes
|
||||
* @param string|null $icon defaults to $name if not specified
|
||||
* @param bool $trackable Whether an entry will track clicks or not. Default is false.
|
||||
* @throws MWException
|
||||
* @return SingleMenuEntry
|
||||
*/
|
||||
private function buildMenuEntry( $name, $text, $url, $className = '', $icon = null, $trackable = false ) {
|
||||
|
@ -96,7 +94,6 @@ final class Definitions {
|
|||
* Creates a login or logout button with a profile button.
|
||||
*
|
||||
* @param Group $group
|
||||
* @throws MWException
|
||||
*/
|
||||
public function insertAuthMenuItem( Group $group ) {
|
||||
$group->insertEntry( new AuthMenuEntry(
|
||||
|
@ -118,7 +115,6 @@ final class Definitions {
|
|||
/**
|
||||
* If Nearby is supported, build and inject the Nearby link
|
||||
* @param Group $group
|
||||
* @throws MWException
|
||||
*/
|
||||
public function insertNearbyIfSupported( Group $group ) {
|
||||
// Nearby link (if supported)
|
||||
|
@ -140,7 +136,6 @@ final class Definitions {
|
|||
/**
|
||||
* Build and insert the Settings link
|
||||
* @param Group $group
|
||||
* @throws MWException
|
||||
*/
|
||||
public function insertMobileOptionsItem( Group $group ) {
|
||||
$title = $this->context->getTitle();
|
||||
|
@ -177,7 +172,6 @@ final class Definitions {
|
|||
/**
|
||||
* Build and insert the Preferences link
|
||||
* @param Group $group
|
||||
* @throws MWException
|
||||
*/
|
||||
public function insertPreferencesItem( Group $group ) {
|
||||
$entry = $this->buildMenuEntry(
|
||||
|
@ -229,7 +223,6 @@ final class Definitions {
|
|||
/**
|
||||
* Build and insert the RecentChanges link
|
||||
* @param Group $group
|
||||
* @throws MWException
|
||||
*/
|
||||
public function insertRecentChanges( Group $group ) {
|
||||
$entry = $this->buildMenuEntry(
|
||||
|
@ -246,7 +239,6 @@ final class Definitions {
|
|||
/**
|
||||
* Build and insert the SpecialPages link
|
||||
* @param Group $group
|
||||
* @throws MWException
|
||||
*/
|
||||
public function insertSpecialPages( Group $group ) {
|
||||
$entry = $this->buildMenuEntry(
|
||||
|
@ -263,7 +255,6 @@ final class Definitions {
|
|||
/**
|
||||
* Build and insert the CommunityPortal link
|
||||
* @param Group $group
|
||||
* @throws MWException
|
||||
*/
|
||||
public function insertCommunityPortal( Group $group ) {
|
||||
$msg = $this->context->msg( 'portal' );
|
||||
|
@ -329,7 +320,6 @@ final class Definitions {
|
|||
* Insert the Donate Link in the Mobile Menu.
|
||||
*
|
||||
* @param Group $group
|
||||
* @throws MWException
|
||||
*/
|
||||
public function insertDonateItem( Group $group ) {
|
||||
$labelMsg = $this->context->msg( 'sitesupport' );
|
||||
|
|
|
@ -20,10 +20,8 @@
|
|||
|
||||
namespace MediaWiki\Minerva\Menu\Main;
|
||||
|
||||
use FatalError;
|
||||
use MediaWiki\Minerva\Menu\Definitions;
|
||||
use MediaWiki\Minerva\Menu\Group;
|
||||
use MWException;
|
||||
|
||||
/**
|
||||
* A menu builder that provides additional menu entries that match
|
||||
|
@ -91,8 +89,6 @@ final class AdvancedMainMenuBuilder implements IMainMenuBuilder {
|
|||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @throws FatalError
|
||||
* @throws MWException
|
||||
*/
|
||||
public function getSiteLinks(): Group {
|
||||
return BuilderUtil::getSiteLinks( $this->definitions );
|
||||
|
@ -101,8 +97,6 @@ final class AdvancedMainMenuBuilder implements IMainMenuBuilder {
|
|||
/**
|
||||
* Prepares a list of links that have the purpose of discovery in the main navigation menu
|
||||
* @return Group
|
||||
* @throws FatalError
|
||||
* @throws MWException
|
||||
*/
|
||||
public function getInteractionToolsGroup(): Group {
|
||||
$group = new Group( 'p-interaction' );
|
||||
|
|
|
@ -20,11 +20,9 @@
|
|||
|
||||
namespace MediaWiki\Minerva\Menu\Main;
|
||||
|
||||
use FatalError;
|
||||
use MediaWiki\Minerva\Menu\Definitions;
|
||||
use MediaWiki\Minerva\Menu\Entries\SingleMenuEntry;
|
||||
use MediaWiki\Minerva\Menu\Group;
|
||||
use MWException;
|
||||
use SpecialPage;
|
||||
use Title;
|
||||
|
||||
|
@ -39,8 +37,6 @@ final class BuilderUtil {
|
|||
* @param Definitions $definitions A menu items definitions set
|
||||
* @param bool $includeDonateLink whether to include it or not.
|
||||
* @return Group
|
||||
* @throws FatalError
|
||||
* @throws MWException
|
||||
*/
|
||||
public static function getDonateGroup( Definitions $definitions, $includeDonateLink ): Group {
|
||||
$group = new Group( 'p-donation' );
|
||||
|
@ -55,8 +51,6 @@ final class BuilderUtil {
|
|||
* @param Definitions $definitions A menu items definitions set
|
||||
* @param array $navigationTools
|
||||
* @return Group
|
||||
* @throws FatalError
|
||||
* @throws MWException
|
||||
*/
|
||||
public static function getDiscoveryTools(
|
||||
Definitions $definitions,
|
||||
|
@ -124,7 +118,6 @@ final class BuilderUtil {
|
|||
* @param Definitions $definitions A menu items definitions set
|
||||
* @param bool $showMobileOptions Show MobileOptions instead of Preferences
|
||||
* @return Group
|
||||
* @throws MWException
|
||||
*/
|
||||
public static function getConfigurationTools(
|
||||
Definitions $definitions, $showMobileOptions
|
||||
|
@ -142,7 +135,6 @@ final class BuilderUtil {
|
|||
* Returns an array of sitelinks to add into the main menu footer.
|
||||
* @param Definitions $definitions A menu items definitions set
|
||||
* @return Group Collection of site links
|
||||
* @throws MWException
|
||||
*/
|
||||
public static function getSiteLinks( Definitions $definitions ): Group {
|
||||
$group = new Group( 'p-minerva-sitelinks' );
|
||||
|
|
|
@ -24,7 +24,6 @@ use MediaWiki\Minerva\Menu\Definitions;
|
|||
use MediaWiki\Minerva\Menu\Entries\SingleMenuEntry;
|
||||
use MediaWiki\Minerva\Menu\Group;
|
||||
use MediaWiki\User\UserIdentity;
|
||||
use MWException;
|
||||
|
||||
/**
|
||||
* Used to build default (available for everyone by default) main menu
|
||||
|
@ -90,7 +89,6 @@ final class DefaultMainMenuBuilder implements IMainMenuBuilder {
|
|||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @throws MWException
|
||||
*/
|
||||
public function getSiteLinks(): Group {
|
||||
return BuilderUtil::getSiteLinks( $this->definitions );
|
||||
|
|
|
@ -21,7 +21,6 @@ namespace MediaWiki\Minerva\Menu\PageActions;
|
|||
|
||||
use MediaWiki\Minerva\MinervaUI;
|
||||
use MessageLocalizer;
|
||||
use MWException;
|
||||
|
||||
/**
|
||||
* Director responsible for building Page Actions menu.
|
||||
|
@ -66,7 +65,6 @@ final class PageActionsDirector {
|
|||
* @param array $toolbox An array of common toolbox items from the sidebar menu
|
||||
* @param array $actions An array of actions usually bucketed under the more menu
|
||||
* @return array
|
||||
* @throws MWException
|
||||
*/
|
||||
public function buildMenu( array $toolbox, array $actions ): array {
|
||||
$toolbar = $this->toolbarBuilder->getGroup();
|
||||
|
|
|
@ -35,7 +35,6 @@ use MediaWiki\Minerva\Skins\SkinUserPageHelper;
|
|||
use MediaWiki\User\UserIdentity;
|
||||
use MediaWiki\Watchlist\WatchlistManager;
|
||||
use MessageLocalizer;
|
||||
use MWException;
|
||||
use SpecialMobileHistory;
|
||||
use SpecialPage;
|
||||
use Title;
|
||||
|
@ -131,7 +130,6 @@ class ToolbarBuilder {
|
|||
|
||||
/**
|
||||
* @return Group
|
||||
* @throws MWException
|
||||
*/
|
||||
public function getGroup(): Group {
|
||||
$group = new Group( 'p-views' );
|
||||
|
@ -201,8 +199,6 @@ class ToolbarBuilder {
|
|||
* editor with the lead section loaded.
|
||||
*
|
||||
* @return IMenuEntry An edit page actions menu entry
|
||||
* @throws MWException
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function createEditPageAction(): IMenuEntry {
|
||||
$title = $this->title;
|
||||
|
@ -236,7 +232,6 @@ class ToolbarBuilder {
|
|||
* will direct the user's UA to Special:Login.
|
||||
*
|
||||
* @return IMenuEntry An watch/unwatch page actions menu entry
|
||||
* @throws MWException
|
||||
*/
|
||||
protected function createWatchPageAction(): IMenuEntry {
|
||||
$isWatched = $this->user->isRegistered() &&
|
||||
|
@ -286,7 +281,6 @@ class ToolbarBuilder {
|
|||
*
|
||||
* @return IMenuEntry A menu entry object that represents a map of HTML attributes
|
||||
* and a 'text' property to be used with the pageActionMenu.mustache template.
|
||||
* @throws MWException
|
||||
*/
|
||||
protected function getHistoryPageAction(): IMenuEntry {
|
||||
$entry = new SingleMenuEntry(
|
||||
|
@ -305,7 +299,6 @@ class ToolbarBuilder {
|
|||
* FIXME: temporary duplicated code, same as SkinMinerva::getHistoryUrl()
|
||||
* @param Title $title The Title object of the page being viewed
|
||||
* @return string
|
||||
* @throws MWException
|
||||
*/
|
||||
protected function getHistoryUrl( Title $title ) {
|
||||
return ExtensionRegistry::getInstance()->isLoaded( 'MobileFrontend' ) &&
|
||||
|
@ -318,7 +311,6 @@ class ToolbarBuilder {
|
|||
* Prepares a url to the Special:UserLogin with query parameters
|
||||
* @param array $query
|
||||
* @return string
|
||||
* @throws MWException
|
||||
*/
|
||||
private function getLoginUrl( $query ) {
|
||||
return SpecialPage::getTitleFor( 'Userlogin' )->getLocalURL( $query );
|
||||
|
|
|
@ -25,7 +25,6 @@ use MediaWiki\Minerva\Menu\Entries\LanguageSelectorEntry;
|
|||
use MediaWiki\Minerva\Menu\Group;
|
||||
use MediaWiki\Minerva\Permissions\IMinervaPagePermissions;
|
||||
use MessageLocalizer;
|
||||
use MWException;
|
||||
use Title;
|
||||
|
||||
class UserNamespaceOverflowBuilder extends DefaultOverflowBuilder {
|
||||
|
@ -60,7 +59,6 @@ class UserNamespaceOverflowBuilder extends DefaultOverflowBuilder {
|
|||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @throws MWException
|
||||
*/
|
||||
public function getGroup( array $toolbox, array $actions ): Group {
|
||||
$group = parent::getGroup( $toolbox, $actions );
|
||||
|
|
|
@ -32,7 +32,6 @@ use MediaWiki\Minerva\Menu\User\UserMenuDirector;
|
|||
use MediaWiki\Minerva\MinervaUI;
|
||||
use MediaWiki\Minerva\Permissions\IMinervaPagePermissions;
|
||||
use MediaWiki\Minerva\SkinOptions;
|
||||
use MWException;
|
||||
use MWTimestamp;
|
||||
use RuntimeException;
|
||||
use SkinMustache;
|
||||
|
@ -121,7 +120,6 @@ class SkinMinerva extends SkinMustache {
|
|||
*
|
||||
* @param array $nav result of SkinTemplate::buildContentNavigationUrls
|
||||
* @return array|null
|
||||
* @throws MWException
|
||||
*/
|
||||
private function getPageActions( array $nav ) {
|
||||
if ( $this->isFallbackEditor() || !$this->hasPageActions() ) {
|
||||
|
|
Loading…
Reference in a new issue