Skip to content

Commit 7a04407

Browse files
coddersjenkins-bot
authored andcommitted
Remove deprecated getEntityParserOutputGenerator function
All callers of the deprecated `getEntityParserOutputGenerator` function have been removed - also remove the function from the EntityParserOutputGeneratorFactory. Depends-On: Ie4400ccbf2eac62b88b55a15749262ed5dbd8d33 Depends-On: Ib471dc6d78c1bc51638eb5ac0c2dabde834fd646 Depends-On: I8ccb870db6cf63e7641f241709c08b6aa2203358 Bug: T407737 Change-Id: Ic6183746d321ec3ee7ccbdf829dab9926a6a6964
1 parent 9a6b814 commit 7a04407

File tree

2 files changed

+10
-29
lines changed

2 files changed

+10
-29
lines changed

repo/includes/ParserOutput/EntityParserOutputGeneratorFactory.php

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -135,34 +135,9 @@ private function getValidUserLanguage( Language $language ): Language {
135135
return $language;
136136
}
137137

138-
/**
139-
* Introduce this function to make it possible to transition the interface
140-
* for `getEntityParserOutputGenerator` from taking a Language to taking a ParserOptions
141-
* object.
142-
*
143-
* We introduce this new function, update callers to call the new function with the
144-
* new interface, then in future commits we will remove the old function.
145-
*
146-
* @param ParserOptions $options
147-
* @return EntityParserOutputGenerator
148-
*/
149138
public function getEntityParserOutputGeneratorForParserOptions( ParserOptions $options ): EntityParserOutputGenerator {
150139
$userLanguage = $this->getValidUserLanguage( $options->getUserLangObj() );
151-
$wbMobile = $options->getOption( 'wbMobile' );
152-
153-
return $this->getEntityParserOutputGenerator( $userLanguage, $wbMobile );
154-
}
155140

156-
/**
157-
* @deprecated Remove this function in favour of the function version that takes
158-
* a ParserOptions object. When all callers of this function have migrated, the function
159-
* can be removed.
160-
*
161-
* @param Language $userLanguage
162-
* @param bool|string $wbMobile
163-
* @return EntityParserOutputGenerator
164-
*/
165-
public function getEntityParserOutputGenerator( Language $userLanguage, $wbMobile = false ): EntityParserOutputGenerator {
166141
$pog = new FullEntityParserOutputGenerator(
167142
$this->entityViewFactory,
168143
$this->entityMetaTagsCreatorFactory,
@@ -171,7 +146,7 @@ public function getEntityParserOutputGenerator( Language $userLanguage, $wbMobil
171146
$this->entityDataFormatProvider,
172147
$this->getDataUpdaters(),
173148
$userLanguage,
174-
$wbMobile,
149+
$options->getOption( 'wbMobile' ),
175150
$this->isMobileView
176151
);
177152

repo/tests/phpunit/includes/ParserOutput/FullEntityParserOutputGeneratorIntegrationTest.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Wikibase\Repo\Tests\ParserOutput;
44

55
use DataValues\QuantityValue;
6+
use MediaWiki\Parser\ParserOptions;
67
use MediaWiki\Parser\ParserOutputLinkTypes;
78
use MediaWikiIntegrationTestCase;
89
use Wikibase\DataModel\Entity\EntityIdValue;
@@ -103,8 +104,10 @@ public function testSetsViewChunksForEntityTermsView() {
103104
}
104105

105106
private function newParserOutputGenerator() {
107+
$parserOptions = ParserOptions::newFromAnon();
108+
$parserOptions->setUserLang( $this->getServiceContainer()->getLanguageFactory()->getLanguage( 'en' ) );
106109
return WikibaseRepo::getEntityParserOutputGeneratorFactory()
107-
->getEntityParserOutputGenerator( $this->getServiceContainer()->getLanguageFactory()->getLanguage( 'en' ) );
110+
->getEntityParserOutputGeneratorForParserOptions( $parserOptions );
108111
}
109112

110113
private function saveItem( $id ) {
@@ -147,9 +150,12 @@ public function testGetParserOutputIncludesLabelsOfRedirectEntityUsedAsStatement
147150
$store->saveRedirect( new EntityRedirect( $redirectSourceId, $redirectTargetId ), 'mistake', $user );
148151
$revision = $store->saveEntity( $item, 'test item', $user );
149152

150-
$language = $mwServices->getLanguageFactory()->getLanguage( 'en' );
151153
$entityParserOutputGeneratorFactory = WikibaseRepo::getEntityParserOutputGeneratorFactory( $mwServices );
152-
$entityParserOutputGenerator = $entityParserOutputGeneratorFactory->getEntityParserOutputGenerator( $language );
154+
$parserOptions = ParserOptions::newFromAnon();
155+
$parserOptions->setUserLang( $mwServices->getLanguageFactory()->getLanguage( 'en' ) );
156+
$entityParserOutputGenerator = $entityParserOutputGeneratorFactory->getEntityParserOutputGeneratorForParserOptions(
157+
$parserOptions
158+
);
153159

154160
$parserOutput = $entityParserOutputGenerator->getParserOutput( $revision );
155161

0 commit comments

Comments
 (0)