From: Kunal Mehta Date: Tue, 13 Sep 2016 04:24:50 +0000 (-0700) Subject: Use late static binding in Article::newFromID() X-Git-Tag: 1.31.0-rc.0~5623^2 X-Git-Url: http://git.cyclocoop.org/%22.%20generer_url_ecrire%28%22sites_tous%22%2C%22%22%29.%20%22?a=commitdiff_plain;h=e65f93f827188b1dc4b4b0c53009a649ee4ef3cd;p=lhc%2Fweb%2Fwiklou.git Use late static binding in Article::newFromID() Address the FIXME and remove subclass implementations by using late static binding. Change-Id: I4f1793c87dfe08f768a283128d14ee2226a9e275 --- diff --git a/includes/page/Article.php b/includes/page/Article.php index 449c9ffe58..ea920f12e6 100644 --- a/includes/page/Article.php +++ b/includes/page/Article.php @@ -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 ); } /** diff --git a/includes/page/CategoryPage.php b/includes/page/CategoryPage.php index d493002684..865471c33d 100644 --- a/includes/page/CategoryPage.php +++ b/includes/page/CategoryPage.php @@ -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' ); diff --git a/includes/page/ImagePage.php b/includes/page/ImagePage.php index be5535a1f5..af778682c7 100644 --- a/includes/page/ImagePage.php +++ b/includes/page/ImagePage.php @@ -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