Merge "filebackend: avoid use of wfWikiId() in FileBackendGroup"
[lhc/web/wiklou.git] / includes / parser / Parser.php
index 5c55124..9ec5834 100644 (file)
@@ -910,7 +910,7 @@ class Parser {
         */
        public function setTitle( $t ) {
                if ( !$t ) {
-                       $t = Title::newFromText( 'NO TITLE' );
+                       $t = Title::makeTitle( NS_SPECIAL, 'Badtitle/Parser' );
                }
 
                if ( $t->hasFragment() ) {
@@ -2312,6 +2312,11 @@ class Parser {
                $line = $a->current(); # Workaround for broken ArrayIterator::next() that returns "void"
                $s = substr( $s, 1 );
 
+               if ( is_null( $this->mTitle ) ) {
+                       throw new MWException( __METHOD__ . ": \$this->mTitle is null\n" );
+               }
+               $nottalk = !$this->mTitle->isTalkPage();
+
                $useLinkPrefixExtension = $this->getTargetLanguage()->linkPrefixExtension();
                $e2 = null;
                if ( $useLinkPrefixExtension ) {
@@ -2319,14 +2324,6 @@ class Parser {
                        # e.g. in the case of 'The Arab al[[Razi]]', 'al' will be matched
                        $charset = $this->contLang->linkPrefixCharset();
                        $e2 = "/^((?>.*[^$charset]|))(.+)$/sDu";
-               }
-
-               if ( is_null( $this->mTitle ) ) {
-                       throw new MWException( __METHOD__ . ": \$this->mTitle is null\n" );
-               }
-               $nottalk = !$this->mTitle->isTalkPage();
-
-               if ( $useLinkPrefixExtension ) {
                        $m = [];
                        if ( preg_match( $e2, $s, $m ) ) {
                                $first_prefix = $m[2];
@@ -4271,7 +4268,6 @@ class Parser {
         * @param bool $isMain
         * @return mixed|string
         * @private
-        * @suppress PhanTypeInvalidDimOffset
         */
        public function formatHeadings( $text, $origText, $isMain = true ) {
                # Inhibit editsection links if requested in the page
@@ -5578,7 +5574,6 @@ class Parser {
                Hooks::run( 'ParserMakeImageParams', [ $title, $file, &$params, $this ] );
 
                # Linker does the rest
-               // @phan-suppress-next-line PhanTypeInvalidDimOffset
                $time = $options['time'] ?? false;
                $ret = Linker::makeImageLink( $this, $title, $file, $params['frame'], $params['handler'],
                        $time, $descQuery, $this->mOptions->getThumbSize() );