Rely on language-level types for the constructor

… as well as the properties that are initialized via the constructor.

Also update some PHPDoc comments.

Change-Id: I2f1dc5345b4a9d00e01d701ad04d42b28aa2f96a
This commit is contained in:
thiemowmde 2024-02-08 12:09:56 +01:00
parent 2277abbb00
commit 692b0bc370

View file

@ -46,30 +46,13 @@ class ParserFileProcessingHookHandlers implements
{
private const CANDIDATE_REGEX = '/<!--MW-PAGEIMAGES-CANDIDATE-([0-9]+)-->/';
/** @var RepoGroup */
private $repoGroup;
/** @var WANObjectCache */
private $mainWANObjectCache;
/** @var HttpRequestFactory */
private $httpRequestFactory;
/** @var IConnectionProvider */
private $connectionProvider;
/** @var TitleFactory */
private $titleFactory;
private RepoGroup $repoGroup;
private WANObjectCache $mainWANObjectCache;
private HttpRequestFactory $httpRequestFactory;
private IConnectionProvider $connectionProvider;
private TitleFactory $titleFactory;
private LinksMigration $linksMigration;
/**
* @param RepoGroup $repoGroup
* @param WANObjectCache $mainWANObjectCache
* @param HttpRequestFactory $httpRequestFactory
* @param IConnectionProvider $connectionProvider
* @param TitleFactory $titleFactory
* @param LinksMigration $linksMigration
*/
public function __construct(
RepoGroup $repoGroup,
WANObjectCache $mainWANObjectCache,
@ -193,7 +176,7 @@ class ParserFileProcessingHookHandlers implements
* Find the best images out of an array of candidates
*
* @param PageImageCandidate[] $images
* @return array The best image, and the best free image
* @return array{string|false,string|false} The best image, and the best free image
*/
private function findBestImages( array $images ) {
if ( !count( $images ) ) {
@ -400,9 +383,9 @@ class ParserFileProcessingHookHandlers implements
}
/**
* Returns width/height ratio of an image as displayed or 0 is not available
* Returns width/height ratio of an image as displayed or 0 if not available
*
* @param PageImageCandidate $image Array representing the image to get the aspect ratio from
* @param PageImageCandidate $image
*
* @return float|int
*/