From 72745a5f28f7bd5162bfc298bbbc72af31ca56c6 Mon Sep 17 00:00:00 2001 From: Fomafix Date: Mon, 23 Oct 2023 20:14:57 +0000 Subject: [PATCH] Use type hint UserOptionsLookup for private variable declaration Also use alphabetical order of the __constuct parameters. Change-Id: I448103eabdb88372709eb529118f0f5d17baee8a --- extension.json | 4 ++-- includes/Hooks.php | 13 +++++-------- tests/phpunit/HooksTest.php | 4 ++-- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/extension.json b/extension.json index 529f986f7..28ecbab85 100644 --- a/extension.json +++ b/extension.json @@ -425,8 +425,8 @@ "main": { "class": "MediaWiki\\Extension\\MultimediaViewer\\Hooks", "services": [ - "UserOptionsLookup", - "SpecialPageFactory" + "SpecialPageFactory", + "UserOptionsLookup" ] } }, diff --git a/includes/Hooks.php b/includes/Hooks.php index a20f4f44c..8bcb74039 100644 --- a/includes/Hooks.php +++ b/includes/Hooks.php @@ -63,22 +63,19 @@ class Hooks implements protected static $helpLink = 'https://mediawiki.org/wiki/Special:MyLanguage/Help:Extension:Media_Viewer'; - /** - * @var UserOptionsLookup - */ - private $userOptionsLookup; private SpecialPageFactory $specialPageFactory; + private UserOptionsLookup $userOptionsLookup; /** - * @param UserOptionsLookup $userOptionsLookup * @param SpecialPageFactory $specialPageFactory + * @param UserOptionsLookup $userOptionsLookup */ public function __construct( - UserOptionsLookup $userOptionsLookup, - SpecialPageFactory $specialPageFactory + SpecialPageFactory $specialPageFactory, + UserOptionsLookup $userOptionsLookup ) { - $this->userOptionsLookup = $userOptionsLookup; $this->specialPageFactory = $specialPageFactory; + $this->userOptionsLookup = $userOptionsLookup; } /** diff --git a/tests/phpunit/HooksTest.php b/tests/phpunit/HooksTest.php index 4abc53fd2..022b67e3e 100644 --- a/tests/phpunit/HooksTest.php +++ b/tests/phpunit/HooksTest.php @@ -15,8 +15,8 @@ class HooksTest extends MediaWikiIntegrationTestCase { public function newHooksInstance() { return new Hooks( - $this->getServiceContainer()->getUserOptionsLookup(), - $this->getServiceContainer()->getSpecialPageFactory() + $this->getServiceContainer()->getSpecialPageFactory(), + $this->getServiceContainer()->getUserOptionsLookup() ); }