mediawiki-skins-Vector/includes/ServiceWiring.php
Umherirrender ea4fd5d182 Create a FeatureManagerFactory
Some feature requirements needs access to the request user or title.
Currently the context is given in the ServiceWiring callback,
access to RequestContext::getMain() should be avoided during service
wiring (T218555).
Create a factory to hold the code from the service wiring and call the
factory with the request context from the skin to get a feature manager.

Bug: T359665
Change-Id: I57515ec02ed454620f729a109d0ace43b447b6ce
2024-03-08 20:28:31 +01:00

42 lines
1.3 KiB
PHP

<?php
/**
* Service Wirings for Vector skin
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/gpl.html
*
* @file
* @since 1.35
*/
use MediaWiki\MediaWikiServices;
use MediaWiki\Skins\Vector\FeatureManagement\FeatureManagerFactory;
// PHP unit does not understand code coverage for this file
// as the @covers annotation cannot cover a specific file
// This is partly tested in ServiceWiringTest.php
// @codeCoverageIgnoreStart
return [
'Vector.FeatureManagerFactory' => static function ( MediaWikiServices $services ): FeatureManagerFactory {
return new FeatureManagerFactory(
$services->getUserOptionsLookup()
);
}
];
// @codeCoverageIgnoreEnd