Use late static binding in Article::newFromID()
authorKunal Mehta <legoktm@member.fsf.org>
Tue, 13 Sep 2016 04:24:50 +0000 (21:24 -0700)
committerKunal Mehta <legoktm@member.fsf.org>
Tue, 13 Sep 2016 04:46:12 +0000 (21:46 -0700)
Address the FIXME and remove subclass implementations by using late
static binding.

Change-Id: I4f1793c87dfe08f768a283128d14ee2226a9e275

includes/page/Article.php
includes/page/CategoryPage.php
includes/page/ImagePage.php

index 449c9ff..ea920f1 100644 (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 );
        }
 
        /**
index d493002..865471c 100644 (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' );
index be5535a..af77868 100644 (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