Add second param to Title::newFromText warning so that called from works correctly
[lhc/web/wiklou.git] / includes / Title.php
index 921538b..86e9746 100644 (file)
@@ -256,12 +256,14 @@ class Title {
         *   by a prefix.  If you want to force a specific namespace even if
         *   $text might begin with a namespace prefix, use makeTitle() or
         *   makeTitleSafe().
-        * @throws MWException
+        * @throws InvalidArgumentException
         * @return Title|null Title or null on an error.
         */
        public static function newFromText( $text, $defaultNamespace = NS_MAIN ) {
                if ( is_object( $text ) ) {
-                       throw new MWException( 'Title::newFromText given an object' );
+                       throw new InvalidArgumentException( '$text must be a string.' );
+               } elseif ( !is_string( $text ) ) {
+                       wfWarn( __METHOD__ . ': $text must be a string. This will throw an InvalidArgumentException in future.', 2 );
                }
 
                $cache = self::getTitleCache();