Avoid unstubbing $wgUser before the end of Setup.php in User::getBlockedStatus()
[lhc/web/wiklou.git] / includes / Title.php
index 882b7dd..55c7179 100644 (file)
@@ -30,7 +30,7 @@
  * @note Consider using a TitleValue object instead. TitleValue is more lightweight
  *       and does not rely on global state or the database.
  */
-class Title {
+class Title implements LinkTarget {
        /** @var HashBagOStuff */
        static private $titleCache = null;
 
@@ -236,10 +236,21 @@ class Title {
         * @return Title
         */
        public static function newFromTitleValue( TitleValue $titleValue ) {
+               return self::newFromLinkTarget( $titleValue );
+       }
+
+       /**
+        * Create a new Title from a LinkTarget
+        *
+        * @param LinkTarget $linkTarget Assumed to be safe.
+        *
+        * @return Title
+        */
+       public static function newFromLinkTarget( LinkTarget $linkTarget ) {
                return self::makeTitle(
-                       $titleValue->getNamespace(),
-                       $titleValue->getText(),
-                       $titleValue->getFragment() );
+                       $linkTarget->getNamespace(),
+                       $linkTarget->getText(),
+                       $linkTarget->getFragment() );
        }
 
        /**