Merge "benchmarks: Minor cleanup for strtr benchmark"
[lhc/web/wiklou.git] / includes / specials / SpecialBlock.php
index bc632b1..a60595a 100644 (file)
@@ -494,7 +494,7 @@ class SpecialBlock extends FormSpecialPage {
         * @todo Should be in Block.php?
         * @param string $par Subpage parameter passed to setup, or data value from
         *     the HTMLForm
-        * @param WebRequest $request Optionally try and get data from a request too
+        * @param WebRequest|null $request Optionally try and get data from a request too
         * @return array [ User|string|null, Block::TYPE_ constant|null ]
         */
        public static function getTargetAndType( $par, WebRequest $request = null ) {
@@ -854,9 +854,11 @@ class SpecialBlock extends FormSpecialPage {
         *     to the standard "**<duration>|<displayname>" format?
         * @param Language|null $lang The language to get the durations in, or null to use
         *     the wiki's content language
+        * @param bool $includeOther Whether to include the 'other' option in the list of
+        *     suggestions
         * @return array
         */
-       public static function getSuggestedDurations( $lang = null ) {
+       public static function getSuggestedDurations( Language $lang = null, $includeOther = true ) {
                $a = [];
                $msg = $lang === null
                        ? wfMessage( 'ipboptions' )->inContentLanguage()->text()
@@ -875,7 +877,7 @@ class SpecialBlock extends FormSpecialPage {
                        $a[$show] = $value;
                }
 
-               if ( $a ) {
+               if ( $a && $includeOther ) {
                        // if options exist, add other to the end instead of the begining (which
                        // is what happens by default).
                        $a[ wfMessage( 'ipbother' )->text() ] = 'other';
@@ -1005,7 +1007,7 @@ class SpecialBlock extends FormSpecialPage {
        /**
         * Process the form on POST submission.
         * @param array $data
-        * @param HTMLForm $form
+        * @param HTMLForm|null $form
         * @return bool|array True for success, false for didn't-try, array of errors on failure
         */
        public function onSubmit( array $data, HTMLForm $form = null ) {