Many more function case mismatches
[lhc/web/wiklou.git] / includes / parser / CoreParserFunctions.php
index d25d11a..a55ddf3 100644 (file)
@@ -38,7 +38,7 @@ class CoreParserFunctions {
                #  function callback,
                #  optional Parser::SFH_NO_HASH to omit the hash from calls (e.g. {{int:...}}
                #    instead of {{#int:...}})
-               $noHashFunctions = array(
+               $noHashFunctions = [
                        'ns', 'nse', 'urlencode', 'lcfirst', 'ucfirst', 'lc', 'uc',
                        'localurl', 'localurle', 'fullurl', 'fullurle', 'canonicalurl',
                        'canonicalurle', 'formatnum', 'grammar', 'gender', 'plural', 'bidi',
@@ -55,33 +55,33 @@ class CoreParserFunctions {
                        'subjectpagenamee', 'pageid', 'revisionid', 'revisionday',
                        'revisionday2', 'revisionmonth', 'revisionmonth1', 'revisionyear',
                        'revisiontimestamp', 'revisionuser', 'cascadingsources',
-               );
+               ];
                foreach ( $noHashFunctions as $func ) {
-                       $parser->setFunctionHook( $func, array( __CLASS__, $func ), Parser::SFH_NO_HASH );
+                       $parser->setFunctionHook( $func, [ __CLASS__, $func ], Parser::SFH_NO_HASH );
                }
 
                $parser->setFunctionHook(
                        'namespace',
-                       array( __CLASS__, 'mwnamespace' ),
+                       [ __CLASS__, 'mwnamespace' ],
                        Parser::SFH_NO_HASH
                );
-               $parser->setFunctionHook( 'int', array( __CLASS__, 'intFunction' ), Parser::SFH_NO_HASH );
-               $parser->setFunctionHook( 'special', array( __CLASS__, 'special' ) );
-               $parser->setFunctionHook( 'speciale', array( __CLASS__, 'speciale' ) );
-               $parser->setFunctionHook( 'tag', array( __CLASS__, 'tagObj' ), Parser::SFH_OBJECT_ARGS );
-               $parser->setFunctionHook( 'formatdate', array( __CLASS__, 'formatDate' ) );
+               $parser->setFunctionHook( 'int', [ __CLASS__, 'intFunction' ], Parser::SFH_NO_HASH );
+               $parser->setFunctionHook( 'special', [ __CLASS__, 'special' ] );
+               $parser->setFunctionHook( 'speciale', [ __CLASS__, 'speciale' ] );
+               $parser->setFunctionHook( 'tag', [ __CLASS__, 'tagObj' ], Parser::SFH_OBJECT_ARGS );
+               $parser->setFunctionHook( 'formatdate', [ __CLASS__, 'formatDate' ] );
 
                if ( $wgAllowDisplayTitle ) {
                        $parser->setFunctionHook(
                                'displaytitle',
-                               array( __CLASS__, 'displaytitle' ),
+                               [ __CLASS__, 'displaytitle' ],
                                Parser::SFH_NO_HASH
                        );
                }
                if ( $wgAllowSlowParserFunctions ) {
                        $parser->setFunctionHook(
                                'pagesinnamespace',
-                               array( __CLASS__, 'pagesinnamespace' ),
+                               [ __CLASS__, 'pagesinnamespace' ],
                                Parser::SFH_NO_HASH
                        );
                }
@@ -102,9 +102,9 @@ class CoreParserFunctions {
                                // and can result in a tag, therefore escape the angles
                                return $message->escaped();
                        }
-                       return array( $message->plain(), 'noparse' => false );
+                       return [ $message->plain(), 'noparse' => false ];
                } else {
-                       return array( 'found' => false );
+                       return [ 'found' => false ];
                }
        }
 
@@ -129,7 +129,7 @@ class CoreParserFunctions {
                        $pref = $defaultPref;
                }
 
-               $date = $df->reformat( $pref, $date, array( 'match-whole' ) );
+               $date = $df->reformat( $pref, $date, [ 'match-whole' ] );
                return $date;
        }
 
@@ -143,7 +143,7 @@ class CoreParserFunctions {
                if ( $index !== false ) {
                        return $wgContLang->getFormattedNsText( $index );
                } else {
-                       return array( 'found' => false );
+                       return [ 'found' => false ];
                }
        }
 
@@ -170,7 +170,7 @@ class CoreParserFunctions {
        public static function urlencode( $parser, $s = '', $arg = null ) {
                static $magicWords = null;
                if ( is_null( $magicWords ) ) {
-                       $magicWords = new MagicWordArray( array( 'url_path', 'url_query', 'url_wiki' ) );
+                       $magicWords = new MagicWordArray( [ 'url_path', 'url_query', 'url_wiki' ] );
                }
                switch ( $magicWords->matchStartToEnd( $arg ) ) {
 
@@ -212,7 +212,7 @@ class CoreParserFunctions {
         */
        public static function lc( $parser, $s = '' ) {
                global $wgContLang;
-               return $parser->markerSkipCallback( $s, array( $wgContLang, 'lc' ) );
+               return $parser->markerSkipCallback( $s, [ $wgContLang, 'lc' ] );
        }
 
        /**
@@ -222,7 +222,7 @@ class CoreParserFunctions {
         */
        public static function uc( $parser, $s = '' ) {
                global $wgContLang;
-               return $parser->markerSkipCallback( $s, array( $wgContLang, 'uc' ) );
+               return $parser->markerSkipCallback( $s, [ $wgContLang, 'uc' ] );
        }
 
        public static function localurl( $parser, $s = '', $arg = null ) {
@@ -285,7 +285,7 @@ class CoreParserFunctions {
                        }
                        return $text;
                } else {
-                       return array( 'found' => false );
+                       return [ 'found' => false ];
                }
        }
 
@@ -297,11 +297,11 @@ class CoreParserFunctions {
         */
        public static function formatnum( $parser, $num = '', $arg = null ) {
                if ( self::matchAgainstMagicword( 'rawsuffix', $arg ) ) {
-                       $func = array( $parser->getFunctionLang(), 'parseFormattedNumber' );
+                       $func = [ $parser->getFunctionLang(), 'parseFormattedNumber' ];
                } elseif ( self::matchAgainstMagicword( 'nocommafysuffix', $arg ) ) {
-                       $func = array( $parser->getFunctionLang(), 'formatNumNoSeparators' );
+                       $func = [ $parser->getFunctionLang(), 'formatNumNoSeparators' ];
                } else {
-                       $func = array( $parser->getFunctionLang(), 'formatNum' );
+                       $func = [ $parser->getFunctionLang(), 'formatNum' ];
                }
                return $parser->markerSkipCallback( $num, $func );
        }
@@ -390,7 +390,7 @@ class CoreParserFunctions {
 
                static $magicWords = null;
                if ( is_null( $magicWords ) ) {
-                       $magicWords = new MagicWordArray( array( 'displaytitle_noerror', 'displaytitle_noreplace' ) );
+                       $magicWords = new MagicWordArray( [ 'displaytitle_noerror', 'displaytitle_noreplace' ] );
                }
                $arg = $magicWords->matchStartToEnd( $uarg );
 
@@ -402,8 +402,8 @@ class CoreParserFunctions {
 
                // list of disallowed tags for DISPLAYTITLE
                // these will be escaped even though they are allowed in normal wiki text
-               $bad = array( 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'div', 'blockquote', 'ol', 'ul', 'li', 'hr',
-                       'table', 'tr', 'th', 'td', 'dl', 'dd', 'caption', 'p', 'ruby', 'rb', 'rt', 'rtc', 'rp', 'br' );
+               $bad = [ 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'div', 'blockquote', 'ol', 'ul', 'li', 'hr',
+                       'table', 'tr', 'th', 'td', 'dl', 'dd', 'caption', 'p', 'ruby', 'rb', 'rt', 'rtc', 'rp', 'br' ];
 
                // disallow some styles that could be used to bypass $wgRestrictDisplayTitle
                if ( $wgRestrictDisplayTitle ) {
@@ -432,8 +432,8 @@ class CoreParserFunctions {
                $text = Sanitizer::normalizeCharReferences( Sanitizer::removeHTMLtags(
                        $text,
                        $htmlTagsCallback,
-                       array(),
-                       array(),
+                       [],
+                       [],
                        $bad
                ) );
                $title = Title::newFromText( Sanitizer::stripAllTags( $text ) );
@@ -634,7 +634,7 @@ class CoreParserFunctions {
                if ( is_null( $t ) ) {
                        return '';
                }
-               return wfEscapeWikiText( wfUrlEncode( str_replace( ' ', '_', $t->getRootText() ) ) );
+               return wfEscapeWikiText( wfUrlencode( str_replace( ' ', '_', $t->getRootText() ) ) );
        }
        public static function basepagename( $parser, $title = null ) {
                $t = Title::newFromText( $title );
@@ -648,7 +648,7 @@ class CoreParserFunctions {
                if ( is_null( $t ) ) {
                        return '';
                }
-               return wfEscapeWikiText( wfUrlEncode( str_replace( ' ', '_', $t->getBaseText() ) ) );
+               return wfEscapeWikiText( wfUrlencode( str_replace( ' ', '_', $t->getBaseText() ) ) );
        }
        public static function talkpagename( $parser, $title = null ) {
                $t = Title::newFromText( $title );
@@ -693,14 +693,14 @@ class CoreParserFunctions {
                global $wgContLang;
                static $magicWords = null;
                if ( is_null( $magicWords ) ) {
-                       $magicWords = new MagicWordArray( array(
+                       $magicWords = new MagicWordArray( [
                                'pagesincategory_all',
                                'pagesincategory_pages',
                                'pagesincategory_subcats',
                                'pagesincategory_files'
-                       ) );
+                       ] );
                }
-               static $cache = array();
+               static $cache = [];
 
                // split the given option to its variable
                if ( self::matchAgainstMagicword( 'rawsuffix', $arg1 ) ) {
@@ -813,7 +813,7 @@ class CoreParserFunctions {
                        $titleObject = $parser->mTitle;
                }
                if ( $titleObject->areRestrictionsLoaded() || $parser->incrementExpensiveFunctionCount() ) {
-                       $expiry = $parser->mTitle->getRestrictionExpiry( strtolower( $type ) );
+                       $expiry = $titleObject->getRestrictionExpiry( strtolower( $type ) );
                        // getRestrictionExpiry() returns false on invalid type; trying to
                        // match protectionlevel() function that returns empty string instead
                        if ( $expiry === false ) {
@@ -920,7 +920,7 @@ class CoreParserFunctions {
        public static function defaultsort( $parser, $text, $uarg = '' ) {
                static $magicWords = null;
                if ( is_null( $magicWords ) ) {
-                       $magicWords = new MagicWordArray( array( 'defaultsort_noerror', 'defaultsort_noreplace' ) );
+                       $magicWords = new MagicWordArray( [ 'defaultsort_noerror', 'defaultsort_noreplace' ] );
                }
                $arg = $magicWords->matchStartToEnd( $uarg );
 
@@ -984,7 +984,7 @@ class CoreParserFunctions {
                                }
                        }
                        if ( $isNowiki ) {
-                               return array( $url, 'nowiki' => true );
+                               return [ $url, 'nowiki' => true ];
                        }
                        return $url;
                } else {
@@ -1011,7 +1011,7 @@ class CoreParserFunctions {
                        $inner = null;
                }
 
-               $attributes = array();
+               $attributes = [];
                foreach ( $args as $arg ) {
                        $bits = $arg->splitArg();
                        if ( strval( $bits['index'] ) === '' ) {
@@ -1037,12 +1037,12 @@ class CoreParserFunctions {
                        return "<$tagName$attrText>$inner</$tagName>";
                }
 
-               $params = array(
+               $params = [
                        'name' => $tagName,
                        'inner' => $inner,
                        'attributes' => $attributes,
                        'close' => "</$tagName>",
-               );
+               ];
                return $parser->extensionSubstitution( $params, $frame );
        }
 
@@ -1293,7 +1293,7 @@ class CoreParserFunctions {
                if ( $titleObject->areCascadeProtectionSourcesLoaded()
                        || $parser->incrementExpensiveFunctionCount()
                ) {
-                       $names = array();
+                       $names = [];
                        $sources = $titleObject->getCascadeProtectionSources();
                        foreach ( $sources[0] as $sourceTitle ) {
                                $names[] = $sourceTitle->getPrefixedText();