MovePageFactory: make $constructorOptions a constant

Change-Id: Ia24add9d2805f61aae65bb1a56e13221f57d4547
This commit is contained in:
Max Semenik 2019-10-05 01:26:52 -07:00
parent c19655ae7c
commit 0809a10b90
4 changed files with 6 additions and 10 deletions

View file

@ -99,7 +99,7 @@ class MovePage {
$this->oldTitle = $oldTitle;
$this->newTitle = $newTitle;
$this->options = $options ??
new ServiceOptions( MovePageFactory::$constructorOptions,
new ServiceOptions( MovePageFactory::CONSTRUCTOR_OPTIONS,
MediaWikiServices::getInstance()->getMainConfig() );
$this->loadBalancer =
$loadBalancer ?? MediaWikiServices::getInstance()->getDBLoadBalancer();

View file

@ -427,7 +427,7 @@ return [
'MovePageFactory' => function ( MediaWikiServices $services ) : MovePageFactory {
return new MovePageFactory(
new ServiceOptions( MovePageFactory::$constructorOptions, $services->getMainConfig() ),
new ServiceOptions( MovePageFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig() ),
$services->getDBLoadBalancer(),
$services->getNamespaceInfo(),
$services->getWatchedItemStore(),

View file

@ -52,11 +52,7 @@ class MovePageFactory {
/** @var RepoGroup */
private $repoGroup;
/**
* @todo Make this a const when we drop HHVM support (T192166)
* @var array
*/
public static $constructorOptions = [
public const CONSTRUCTOR_OPTIONS = [
'CategoryCollation',
'ContentHandlerUseDB',
];
@ -69,7 +65,7 @@ class MovePageFactory {
PermissionManager $permMgr,
RepoGroup $repoGroup
) {
$options->assertRequiredOptions( self::$constructorOptions );
$options->assertRequiredOptions( self::CONSTRUCTOR_OPTIONS );
$this->options = $options;
$this->loadBalancer = $loadBalancer;

View file

@ -79,7 +79,7 @@ class MovePageTest extends MediaWikiTestCase {
$old,
$new,
new ServiceOptions(
MovePageFactory::$constructorOptions,
MovePageFactory::CONSTRUCTOR_OPTIONS,
$params['options'] ?? [],
[
'CategoryCollation' => 'uppercase',
@ -144,7 +144,7 @@ class MovePageTest extends MediaWikiTestCase {
$obj2 = new MovePage(
Title::newFromText( 'A' ),
Title::newFromText( 'B' ),
new ServiceOptions( MovePageFactory::$constructorOptions, $services->getMainConfig() ),
new ServiceOptions( MovePageFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig() ),
$services->getDBLoadBalancer(),
$services->getNamespaceInfo(),
$services->getWatchedItemStore(),