Use real type hints for class properties holding injected services

Provided services are already type-hinted on the construtor
and it is safe to use the same type on the class property

Change-Id: I15b5346353100e2e55d68b0a52fe3398778d60a5
This commit is contained in:
Umherirrender 2024-08-16 22:47:19 +02:00
parent a78b263690
commit 87dd7827ee
5 changed files with 12 additions and 23 deletions

View file

@ -1,8 +1,6 @@
<?xml version="1.0"?>
<ruleset>
<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki">
<exclude name="MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationPrivate" />
</rule>
<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki" />
<file>.</file>
<arg name="extensions" value="php" />
<arg name="encoding" value="UTF-8" />

View file

@ -15,7 +15,7 @@ class DeferredChecksJob extends Job {
public const TYPE_LOGIN_FAILED = 'failed';
public const TYPE_LOGIN_SUCCESS = 'success';
private $userFactory;
private UserFactory $userFactory;
/**
* @param Title $title

View file

@ -21,8 +21,7 @@ class Hooks implements
LocalUserCreatedHook,
RecentChange_saveHook
{
/** @var UserFactory */
private $userFactory;
private UserFactory $userFactory;
public function __construct( UserFactory $userFactory ) {
$this->userFactory = $userFactory;

View file

@ -74,26 +74,18 @@ class LoginNotify implements LoggerAwareInterface {
/** We don't have data to confirm or deny this is a known system */
public const USER_NO_INFO = 'no info';
/** @var BagOStuff */
private $cache;
/** @var ServiceOptions */
private $config;
/** @var LoggerInterface Usually instance of LoginNotify log */
private $log;
private BagOStuff $cache;
private ServiceOptions $config;
private LoggerInterface $log;
/** @var string Salt for cookie hash. DON'T USE DIRECTLY, use getSalt() */
private $salt;
/** @var string */
private $secret;
/** @var IBufferingStatsdDataFactory */
private $stats;
/** @var LBFactory */
private $lbFactory;
/** @var JobQueueGroup */
private $jobQueueGroup;
/** @var CentralIdLookup */
private $centralIdLookup;
/** @var AuthManager */
private $authManager;
private IBufferingStatsdDataFactory $stats;
private LBFactory $lbFactory;
private JobQueueGroup $jobQueueGroup;
private CentralIdLookup $centralIdLookup;
private AuthManager $authManager;
/** @var int|null */
private $fakeTime;

View file

@ -5,7 +5,7 @@ namespace LoginNotify;
use MediaWiki\Title\Title;
class PurgeSeenJob extends \Job {
private $loginNotify;
private LoginNotify $loginNotify;
public function __construct( Title $title, array $params, LoginNotify $loginNotify ) {
parent::__construct( 'LoginNotifyPurgeSeen', $title, $params );