Use late static binding in Article::newFromID()

Address the FIXME and remove subclass implementations by using late
static binding.

Change-Id: I4f1793c87dfe08f768a283128d14ee2226a9e275
This commit is contained in:
Kunal Mehta 2016-09-12 21:24:50 -07:00
parent 148f7bf0d1
commit e65f93f827
3 changed files with 1 additions and 27 deletions

View file

@ -99,9 +99,7 @@ class Article implements Page {
*/
public static function newFromID( $id ) {
$t = Title::newFromID( $id );
# @todo FIXME: Doesn't inherit right
return $t == null ? null : new self( $t );
# return $t == null ? null : new static( $t ); // PHP 5.3
return $t == null ? null : new static( $t );
}
/**

View file

@ -43,18 +43,6 @@ class CategoryPage extends Article {
return new WikiCategoryPage( $title );
}
/**
* Constructor from a page id
* @param int $id Article ID to load
* @return CategoryPage|null
*/
public static function newFromID( $id ) {
$t = Title::newFromID( $id );
# @todo FIXME: Doesn't inherit right
return $t == null ? null : new self( $t );
# return $t == null ? null : new static( $t ); // PHP 5.3
}
function view() {
$request = $this->getContext()->getRequest();
$diff = $request->getVal( 'diff' );

View file

@ -52,18 +52,6 @@ class ImagePage extends Article {
return new WikiFilePage( $title );
}
/**
* Constructor from a page id
* @param int $id Article ID to load
* @return ImagePage|null
*/
public static function newFromID( $id ) {
$t = Title::newFromID( $id );
# @todo FIXME: Doesn't inherit right
return $t == null ? null : new self( $t );
# return $t == null ? null : new static( $t ); // PHP 5.3
}
/**
* @param File $file
* @return void