wiki.techinc.nl/includes/page/PageStoreFactory.php
Bartosz Dziewoński 1321082c6e Use real type hints for services etc. in includes/page/
Mostly used find-and-replace:

Find:
/\*[\*\s]+@var (I?[A-Z](\w+)(?:Interface)?)[\s\*]+/\s*(private|protected|public) (\$[a-z]\w+;\n)((?=\s*/\*[\*\s]+@var (I?[A-Z](\w+)(?:Interface)?))\n|)
Replace with:
\3 \1 \4

More could be done, but to keep this patch reasonably sized, I only
changed the most obvious and unambiguously correct cases.

In some cases, I also removed redundant doc comments on the
constructor, and re-ordered the properties to match the constructor.

Change-Id: I7eb97640c0543ae10bf2431623a5f7efdc3349b7
2024-06-11 19:37:28 +02:00

65 lines
1.5 KiB
PHP

<?php
namespace MediaWiki\Page;
use MediaWiki\Cache\LinkCache;
use MediaWiki\Config\ServiceOptions;
use MediaWiki\DAO\WikiAwareEntity;
use MediaWiki\Title\NamespaceInfo;
use MediaWiki\Title\TitleParser;
use Wikimedia\Rdbms\ILBFactory;
use Wikimedia\Stats\StatsFactory;
/**
* @since 1.36
*/
class PageStoreFactory {
/**
* @internal For use by service wiring
*/
public const CONSTRUCTOR_OPTIONS = PageStore::CONSTRUCTOR_OPTIONS;
private ServiceOptions $options;
private ILBFactory $dbLoadBalancerFactory;
private NamespaceInfo $namespaceInfo;
private TitleParser $titleParser;
private LinkCache $linkCache;
private StatsFactory $stats;
public function __construct(
ServiceOptions $options,
ILBFactory $dbLoadBalancerFactory,
NamespaceInfo $namespaceInfo,
TitleParser $titleParser,
LinkCache $linkCache,
StatsFactory $stats
) {
$options->assertRequiredOptions( self::CONSTRUCTOR_OPTIONS );
$this->options = $options;
$this->dbLoadBalancerFactory = $dbLoadBalancerFactory;
$this->namespaceInfo = $namespaceInfo;
$this->titleParser = $titleParser;
$this->linkCache = $linkCache;
$this->stats = $stats;
}
/**
* @param string|false $wikiId
*
* @return PageStore
*/
public function getPageStore( $wikiId = WikiAwareEntity::LOCAL ): PageStore {
return new PageStore(
$this->options,
$this->dbLoadBalancerFactory->getMainLB( $wikiId ),
$this->namespaceInfo,
$this->titleParser,
$wikiId !== WikiAwareEntity::LOCAL ? null : $this->linkCache,
$this->stats,
$wikiId
);
}
}