diff --git a/includes/ServiceWiring.php b/includes/ServiceWiring.php index 6551bf221..0476abf17 100644 --- a/includes/ServiceWiring.php +++ b/includes/ServiceWiring.php @@ -84,11 +84,10 @@ return [ $user = $context->getUser(); $userPageHelper = $services->getService( 'Minerva.SkinUserPageHelper' ); $languagesHelper = $services->getService( 'Minerva.LanguagesHelper' ); - $namespaceInfo = $services->getNamespaceInfo(); $relevantUserPageHelper = $title->inNamespace( NS_USER_TALK ) ? new SkinUserPageHelper( - $namespaceInfo->getSubjectPage( $context->getSkin()->getRelevantTitle() ) + $context->getSkin()->getRelevantTitle()->getSubjectPage() ) : $userPageHelper; diff --git a/includes/Skins/SkinUserPageHelper.php b/includes/Skins/SkinUserPageHelper.php index 724f0e7cb..8121b6ce1 100644 --- a/includes/Skins/SkinUserPageHelper.php +++ b/includes/Skins/SkinUserPageHelper.php @@ -20,7 +20,6 @@ namespace MediaWiki\Minerva\Skins; -use MediaWiki\Linker\LinkTarget; use Title; use User; @@ -40,9 +39,9 @@ class SkinUserPageHelper { private $pageUser; /** - * @param Title|LinkTarget|null $title + * @param Title|null $title */ - public function __construct( $title = null ) { + public function __construct( Title $title = null ) { $this->title = $title; } diff --git a/tests/phpunit/skins/SkinUserPageHelperTest.php b/tests/phpunit/skins/SkinUserPageHelperTest.php index 44e7aedd7..f37bdd368 100644 --- a/tests/phpunit/skins/SkinUserPageHelperTest.php +++ b/tests/phpunit/skins/SkinUserPageHelperTest.php @@ -2,7 +2,6 @@ namespace Tests\MediaWiki\Minerva; -use MediaWiki\Linker\LinkTarget; use MediaWiki\Minerva\Skins\SkinUserPageHelper; use MediaWikiTestCase; use Title; @@ -25,20 +24,6 @@ class SkinUserPageHelperTest extends MediaWikiTestCase { $this->assertFalse( $helper->isUserPage() ); } - /** - * @covers ::isUserPage - * @covers ::getPageUser - */ - public function testLinkTargetAsConsumer() { - $linkTarget = $this->createMock( LinkTarget::class ); - $linkTarget->method( 'getText' ) - ->willReturn( 'User:LinkTarget' ); - - $helper = new SkinUserPageHelper( $linkTarget ); - $this->assertNull( $helper->getPageUser() ); - $this->assertFalse( $helper->isUserPage() ); - } - /** * @covers ::isUserPage * @covers ::fetchData