Namespace the other two classes in PageImages

Leave alias for PageImages as it's used elsewhere...

Change-Id: I4a3fa5f8aaafd87c78b03f04369a73f4b4f1b189
This commit is contained in:
Reedy 2020-04-19 23:41:19 +01:00
parent 8747de0649
commit b14685b8d5
8 changed files with 36 additions and 18 deletions

View file

@ -9,7 +9,7 @@
"MediaWiki": ">= 1.35.0" "MediaWiki": ">= 1.35.0"
}, },
"APIPropModules": { "APIPropModules": {
"pageimages": "ApiQueryPageImages" "pageimages": "PageImages\\ApiQueryPageImages"
}, },
"MessagesDirs": { "MessagesDirs": {
"PageImages": [ "PageImages": [
@ -18,20 +18,20 @@
] ]
}, },
"AutoloadClasses": { "AutoloadClasses": {
"ApiQueryPageImages": "includes/ApiQueryPageImages.php", "PageImages": "includes/PageImages.php",
"PageImages": "includes/PageImages.php" "PageImages\\PageImages": "includes/PageImages.php"
}, },
"AutoloadNamespaces": { "AutoloadNamespaces": {
"PageImages\\": "includes/" "PageImages\\": "includes/"
}, },
"Hooks": { "Hooks": {
"AfterParserFetchFileAndTitle": "PageImages\\Hooks\\ParserFileProcessingHookHandlers::onAfterParserFetchFileAndTitle", "AfterParserFetchFileAndTitle": "PageImages\\Hooks\\ParserFileProcessingHookHandlers::onAfterParserFetchFileAndTitle",
"ApiOpenSearchSuggest": "PageImages::onApiOpenSearchSuggest", "ApiOpenSearchSuggest": "PageImages\\PageImages::onApiOpenSearchSuggest",
"BeforePageDisplay": "PageImages::onBeforePageDisplay", "BeforePageDisplay": "PageImages\\PageImages::onBeforePageDisplay",
"InfoAction": "PageImages::onInfoAction", "InfoAction": "PageImages\\PageImages::onInfoAction",
"LinksUpdate": "PageImages\\Hooks\\LinksUpdateHookHandler::onLinksUpdate", "LinksUpdate": "PageImages\\Hooks\\LinksUpdateHookHandler::onLinksUpdate",
"ParserMakeImageParams": "PageImages\\Hooks\\ParserFileProcessingHookHandlers::onParserMakeImageParams", "ParserMakeImageParams": "PageImages\\PageImages\\Hooks\\ParserFileProcessingHookHandlers::onParserMakeImageParams",
"SpecialMobileEditWatchlist::images": "PageImages::onSpecialMobileEditWatchlistImages" "SpecialMobileEditWatchlist::images": "PageImages\\PageImages::onSpecialMobileEditWatchlistImages"
}, },
"JobClasses": { "JobClasses": {
"InitImageDataJob": "PageImages\\Job\\InitImageDataJob" "InitImageDataJob": "PageImages\\Job\\InitImageDataJob"

View file

@ -1,6 +1,12 @@
<?php <?php
namespace PageImages;
use ApiBase;
use ApiQuery;
use ApiQueryBase;
use MediaWiki\MediaWikiServices; use MediaWiki\MediaWikiServices;
use Title;
/** /**
* Expose image information for a page via a new prop=pageimages API. * Expose image information for a page via a new prop=pageimages API.

View file

@ -11,7 +11,7 @@ use IDBAccessObject;
use LinksUpdate; use LinksUpdate;
use MediaWiki\MediaWikiServices; use MediaWiki\MediaWikiServices;
use MediaWiki\Storage\SlotRecord; use MediaWiki\Storage\SlotRecord;
use PageImages; use PageImages\PageImages;
use Title; use Title;
/** /**

View file

@ -1,6 +1,16 @@
<?php <?php
namespace PageImages;
use ApiBase;
use ApiMain;
use FauxRequest;
use File;
use IContextSource;
use MediaWiki\MediaWikiServices; use MediaWiki\MediaWikiServices;
use OutputPage;
use Skin;
use Title;
/** /**
* @license WTFPL * @license WTFPL
@ -227,3 +237,5 @@ class PageImages {
} }
} }
class_alias( PageImages::class, 'PageImages' );

View file

@ -3,7 +3,7 @@
namespace PageImages\Tests; namespace PageImages\Tests;
use ApiPageSet; use ApiPageSet;
use ApiQueryPageImages; use PageImages\ApiQueryPageImages;
class ApiQueryPageImagesProxyMock extends ApiQueryPageImages { class ApiQueryPageImagesProxyMock extends ApiQueryPageImages {

View file

@ -4,8 +4,8 @@ namespace PageImages\Tests;
require_once 'ApiQueryPageImagesProxyMock.php'; require_once 'ApiQueryPageImagesProxyMock.php';
use ApiQueryPageImages; use PageImages\ApiQueryPageImages;
use PageImages; use PageImages\PageImages;
use Title; use Title;
use Wikimedia\Rdbms\FakeResultWrapper; use Wikimedia\Rdbms\FakeResultWrapper;
use Wikimedia\TestingAccessWrapper; use Wikimedia\TestingAccessWrapper;
@ -53,7 +53,7 @@ class ApiQueryPageImagesTest extends \PHPUnit\Framework\TestCase {
public function testConstructor() { public function testConstructor() {
$instance = $this->newInstance(); $instance = $this->newInstance();
$this->assertInstanceOf( 'ApiQueryPageImages', $instance ); $this->assertInstanceOf( ApiQueryPageImages::class, $instance );
} }
public function testGetCacheMode() { public function testGetCacheMode() {
@ -292,8 +292,8 @@ class ApiQueryPageImagesTest extends \PHPUnit\Framework\TestCase {
public function provideGetPropName() { public function provideGetPropName() {
return [ return [
[ 'free', \PageImages::PROP_NAME_FREE ], [ 'free', \PageImages\PageImages::PROP_NAME_FREE ],
[ 'any', [ \PageImages::PROP_NAME_FREE, \PageImages::PROP_NAME ] ] [ 'any', [ \PageImages\PageImages::PROP_NAME_FREE, \PageImages\PageImages::PROP_NAME ] ]
]; ];
} }

View file

@ -5,8 +5,8 @@ namespace PageImages\Tests\Hooks;
use LinksUpdate; use LinksUpdate;
use MediaWiki\Revision\RevisionRecord; use MediaWiki\Revision\RevisionRecord;
use MediaWikiTestCase; use MediaWikiTestCase;
use PageImages;
use PageImages\Hooks\LinksUpdateHookHandler; use PageImages\Hooks\LinksUpdateHookHandler;
use PageImages\PageImages;
use ParserOutput; use ParserOutput;
use RepoGroup; use RepoGroup;
use Title; use Title;

View file

@ -5,12 +5,12 @@ namespace PageImages\Tests;
use IContextSource; use IContextSource;
use MediaWikiTestCase; use MediaWikiTestCase;
use OutputPage; use OutputPage;
use PageImages; use PageImages\PageImages;
use SkinTemplate; use SkinTemplate;
use Title; use Title;
/** /**
* @covers PageImages * @covers \PageImages\PageImages
* *
* @group PageImages * @group PageImages
* @group Database * @group Database