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"?> <?xml version="1.0"?>
<ruleset> <ruleset>
<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki"> <rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki" />
<exclude name="MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationPrivate" />
</rule>
<file>.</file> <file>.</file>
<arg name="extensions" value="php" /> <arg name="extensions" value="php" />
<arg name="encoding" value="UTF-8" /> <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_FAILED = 'failed';
public const TYPE_LOGIN_SUCCESS = 'success'; public const TYPE_LOGIN_SUCCESS = 'success';
private $userFactory; private UserFactory $userFactory;
/** /**
* @param Title $title * @param Title $title

View file

@ -21,8 +21,7 @@ class Hooks implements
LocalUserCreatedHook, LocalUserCreatedHook,
RecentChange_saveHook RecentChange_saveHook
{ {
/** @var UserFactory */ private UserFactory $userFactory;
private $userFactory;
public function __construct( UserFactory $userFactory ) { public function __construct( UserFactory $userFactory ) {
$this->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 */ /** We don't have data to confirm or deny this is a known system */
public const USER_NO_INFO = 'no info'; public const USER_NO_INFO = 'no info';
/** @var BagOStuff */ private BagOStuff $cache;
private $cache; private ServiceOptions $config;
/** @var ServiceOptions */ private LoggerInterface $log;
private $config;
/** @var LoggerInterface Usually instance of LoginNotify log */
private $log;
/** @var string Salt for cookie hash. DON'T USE DIRECTLY, use getSalt() */ /** @var string Salt for cookie hash. DON'T USE DIRECTLY, use getSalt() */
private $salt; private $salt;
/** @var string */ /** @var string */
private $secret; private $secret;
/** @var IBufferingStatsdDataFactory */ private IBufferingStatsdDataFactory $stats;
private $stats; private LBFactory $lbFactory;
/** @var LBFactory */ private JobQueueGroup $jobQueueGroup;
private $lbFactory; private CentralIdLookup $centralIdLookup;
/** @var JobQueueGroup */ private AuthManager $authManager;
private $jobQueueGroup;
/** @var CentralIdLookup */
private $centralIdLookup;
/** @var AuthManager */
private $authManager;
/** @var int|null */ /** @var int|null */
private $fakeTime; private $fakeTime;

View file

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