WikiPageFactory: Improve phan suppressions
Use @phan-var annotation instead of multiple suppressions Change-Id: Ieb49c3c7838f8ef638c9215c0ae04d7e1048b3cd
This commit is contained in:
parent
10a33e00d3
commit
c14ba07591
2 changed files with 2 additions and 5 deletions
|
|
@ -19,7 +19,7 @@ interface WikiPageFactoryHook {
|
|||
* @since 1.35
|
||||
*
|
||||
* @param Title $title Title of the page
|
||||
* @param WikiPage &$page Variable to set the created WikiPage to
|
||||
* @param WikiPage|null &$page Variable to set the created WikiPage to
|
||||
* @return bool|void True or no return value to continue or false to abort
|
||||
*/
|
||||
public function onWikiPageFactory( $title, &$page );
|
||||
|
|
|
|||
|
|
@ -65,24 +65,21 @@ class WikiPageFactory {
|
|||
// TODO: remove the need for casting to Title. We'll have to create a new hook to
|
||||
// replace the WikiPageFactory hook.
|
||||
$title = Title::castFromPageIdentity( $pageIdentity );
|
||||
'@phan-var Title $title';
|
||||
|
||||
$page = null;
|
||||
// @phan-suppress-next-line PhanTypeMismatchArgument castFrom does not return null here
|
||||
if ( !$this->wikiPageFactoryHookRunner->onWikiPageFactory( $title, $page ) ) {
|
||||
return $page;
|
||||
}
|
||||
|
||||
switch ( $ns ) {
|
||||
case NS_FILE:
|
||||
// @phan-suppress-next-line PhanTypeMismatchArgumentNullable castFrom does not return null here
|
||||
$page = new WikiFilePage( $title );
|
||||
break;
|
||||
case NS_CATEGORY:
|
||||
// @phan-suppress-next-line PhanTypeMismatchArgumentNullable castFrom does not return null here
|
||||
$page = new WikiCategoryPage( $title );
|
||||
break;
|
||||
default:
|
||||
// @phan-suppress-next-line PhanTypeMismatchArgumentNullable castFrom does not return null here
|
||||
$page = new WikiPage( $title );
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue