diff --git a/includes/page/Hook/WikiPageFactoryHook.php b/includes/page/Hook/WikiPageFactoryHook.php index 7e1b7af10f4..49757337452 100644 --- a/includes/page/Hook/WikiPageFactoryHook.php +++ b/includes/page/Hook/WikiPageFactoryHook.php @@ -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 ); diff --git a/includes/page/WikiPageFactory.php b/includes/page/WikiPageFactory.php index 3a0fc425f50..c244daef0b8 100644 --- a/includes/page/WikiPageFactory.php +++ b/includes/page/WikiPageFactory.php @@ -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 ); }