Add return type hint to functions in ServiceWiring.php

This is a common pattern for service wiring functions

Change-Id: I2c6a6b95ad5f9d69f90631ede39882e41e7c85df
This commit is contained in:
Umherirrender 2024-02-01 19:17:39 +01:00
parent 51059828bf
commit f5dd9a0bbf

View file

@ -1,28 +1,30 @@
<?php <?php
use MediaWiki\Config\Config;
use MediaWiki\Logger\LoggerFactory; use MediaWiki\Logger\LoggerFactory;
use MediaWiki\MediaWikiServices; use MediaWiki\MediaWikiServices;
use Popups\PopupsContext; use Popups\PopupsContext;
use Popups\PopupsGadgetsIntegration; use Popups\PopupsGadgetsIntegration;
use Psr\Log\LoggerInterface;
/** /**
* @codeCoverageIgnore * @codeCoverageIgnore
*/ */
return [ return [
'Popups.Config' => static function ( MediaWikiServices $services ) { 'Popups.Config' => static function ( MediaWikiServices $services ): Config {
return $services->getService( 'ConfigFactory' ) return $services->getService( 'ConfigFactory' )
->makeConfig( PopupsContext::EXTENSION_NAME ); ->makeConfig( PopupsContext::EXTENSION_NAME );
}, },
'Popups.GadgetsIntegration' => static function ( MediaWikiServices $services ) { 'Popups.GadgetsIntegration' => static function ( MediaWikiServices $services ): PopupsGadgetsIntegration {
return new PopupsGadgetsIntegration( return new PopupsGadgetsIntegration(
$services->getService( 'Popups.Config' ), $services->getService( 'Popups.Config' ),
ExtensionRegistry::getInstance() ExtensionRegistry::getInstance()
); );
}, },
'Popups.Logger' => static function ( MediaWikiServices $services ) { 'Popups.Logger' => static function ( MediaWikiServices $services ): LoggerInterface {
return LoggerFactory::getInstance( PopupsContext::LOGGER_CHANNEL ); return LoggerFactory::getInstance( PopupsContext::LOGGER_CHANNEL );
}, },
'Popups.Context' => static function ( MediaWikiServices $services ) { 'Popups.Context' => static function ( MediaWikiServices $services ): PopupsContext {
return new PopupsContext( return new PopupsContext(
$services->getService( 'Popups.Config' ), $services->getService( 'Popups.Config' ),
ExtensionRegistry::getInstance(), ExtensionRegistry::getInstance(),