From 82491feae9c0eccb9131be99caef24158398aae0 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Fri, 4 Nov 2011 23:33:53 +0000 Subject: [PATCH] * Added some Title type hinting * Used 'self' in some class construction instances --- includes/filerepo/FileRepo.php | 2 +- includes/filerepo/ForeignAPIFile.php | 14 +++++++------- includes/filerepo/LocalFile.php | 2 +- includes/filerepo/LocalRepo.php | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/includes/filerepo/FileRepo.php b/includes/filerepo/FileRepo.php index 2d7a50fb07..4efd42e9be 100644 --- a/includes/filerepo/FileRepo.php +++ b/includes/filerepo/FileRepo.php @@ -249,7 +249,7 @@ abstract class FileRepo { * Get the name of an image from its title object * @param $title Title */ - function getNameFromTitle( $title ) { + function getNameFromTitle( Title $title ) { if ( $this->initialCapital != MWNamespace::isCapitalized( NS_FILE ) ) { global $wgContLang; $name = $title->getUserCaseDBKey(); diff --git a/includes/filerepo/ForeignAPIFile.php b/includes/filerepo/ForeignAPIFile.php index ba699beec0..2e48517f85 100644 --- a/includes/filerepo/ForeignAPIFile.php +++ b/includes/filerepo/ForeignAPIFile.php @@ -33,13 +33,13 @@ class ForeignAPIFile extends File { * @param $repo ForeignApiRepo * @return ForeignAPIFile|null */ - static function newFromTitle( $title, $repo ) { + static function newFromTitle( Title $title, $repo ) { $data = $repo->fetchImageQuery( array( - 'titles' => 'File:' . $title->getDBKey(), - 'iiprop' => self::getProps(), - 'prop' => 'imageinfo', + 'titles' => 'File:' . $title->getDBKey(), + 'iiprop' => self::getProps(), + 'prop' => 'imageinfo', 'iimetadataversion' => MediaHandler::getMetadataVersion() - ) ); + ) ); $info = $repo->getImageInfo( $data ); @@ -49,12 +49,12 @@ class ForeignAPIFile extends File { : -1; if( $lastRedirect >= 0 ) { $newtitle = Title::newFromText( $data['query']['redirects'][$lastRedirect]['to']); - $img = new ForeignAPIFile( $newtitle, $repo, $info, true ); + $img = new self( $newtitle, $repo, $info, true ); if( $img ) { $img->redirectedFrom( $title->getDBkey() ); } } else { - $img = new ForeignAPIFile( $title, $repo, $info, true ); + $img = new self( $title, $repo, $info, true ); } return $img; } else { diff --git a/includes/filerepo/LocalFile.php b/includes/filerepo/LocalFile.php index c3f04522f9..b14966a10f 100644 --- a/includes/filerepo/LocalFile.php +++ b/includes/filerepo/LocalFile.php @@ -144,7 +144,7 @@ class LocalFile extends File { * Do not call this except from inside a repo class. */ function __construct( $title, $repo ) { - if ( !is_object( $title ) ) { + if ( !is_object( $title ) ) { // LocalFile requires a title object throw new MWException( __CLASS__ . ' constructor given bogus title.' ); } diff --git a/includes/filerepo/LocalRepo.php b/includes/filerepo/LocalRepo.php index e29bca0fc7..373fda1b5d 100644 --- a/includes/filerepo/LocalRepo.php +++ b/includes/filerepo/LocalRepo.php @@ -258,7 +258,7 @@ class LocalRepo extends FSRepo { * * @param $title Title of page */ - function invalidateImageRedirect( $title ) { + function invalidateImageRedirect( Title $title ) { global $wgMemc; $memcKey = $this->getSharedCacheKey( 'image_redirect', md5( $title->getDBkey() ) ); if ( $memcKey ) { -- 2.20.1