wiki.techinc.nl/includes/page/RedirectLookup.php
Nikki Nikkhoui d13745aac1 Add @throws annotation to getRedirectTarget()
T301346 was caused by a SpecialPage being passed
from this function down the chain to WikiPageFactory::newFromTitle
which only accepts a ProperPageIdentity.

Document that this function will @throw even though its
param is only typed to accept PageIdentity.

Bug: T301346
Change-Id: Ie61abd74d1be6942d98efa16f8f440e25dc6db88
2022-02-10 11:25:43 -05:00

46 lines
1.4 KiB
PHP

<?php
/**
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/gpl.html
*
* @file
* @author Derick Alangi
*/
namespace MediaWiki\Page;
use MediaWiki\Linker\LinkTarget;
/**
* Interface to handle redirects for a given page like getting the
* redirect target of an editable wiki page.
*
* @unstable
*
* @since 1.38
*/
interface RedirectLookup {
/**
* Get the redirect destination from this page and return
* a LinkTarget, or null if this page is not a redirect page.
*
* @since 1.38
*
* @param PageIdentity $page
* @return LinkTarget|null
* @throws PageAssertionException if $page does not represent an editable page
*/
public function getRedirectTarget( PageIdentity $page ): ?LinkTarget;
}