LogPager/LogEventsList: Correct docs about $pattern parameter
authorBartosz Dziewoński <matma.rex@gmail.com>
Mon, 7 May 2018 18:48:01 +0000 (20:48 +0200)
committerUmherirrender <umherirrender_de.wp@web.de>
Thu, 10 May 2018 19:46:59 +0000 (19:46 +0000)
$pattern is a boolean, it is documented as "Do a prefix search rather
than an exact title match". However, its type was incorrectly
documented to be a string, and the default value was '' instead of
false (which was harmless, as it is correctly treated as a boolean
value everywhere).

Change-Id: Id093d12891a231d5934f9908e619065afff7380e

includes/logging/LogEventsList.php
includes/logging/LogPager.php

index 93a81cf..9e4a630 100644 (file)
@@ -97,7 +97,7 @@ class LogEventsList extends ContextSource {
         * @param array|string $types
         * @param string $user
         * @param string $page
-        * @param string $pattern
+        * @param bool $pattern
         * @param int|string $year Use 0 to start with no year preselected.
         * @param int|string $month A month in the 1..12 range. Use 0 to start with no month
         *  preselected.
@@ -105,7 +105,7 @@ class LogEventsList extends ContextSource {
         * @param string $tagFilter Tag to select by default
         * @param string $action
         */
-       public function showOptions( $types = [], $user = '', $page = '', $pattern = '', $year = 0,
+       public function showOptions( $types = [], $user = '', $page = '', $pattern = false, $year = 0,
                $month = 0, $filter = null, $tagFilter = '', $action = null
        ) {
                global $wgScript, $wgMiserMode;
@@ -289,7 +289,7 @@ class LogEventsList extends ContextSource {
        }
 
        /**
-        * @param string $pattern
+        * @param bool $pattern
         * @return string Checkbox
         */
        private function getTitlePattern( $pattern ) {
index c047e96..84653b1 100644 (file)
@@ -36,8 +36,8 @@ class LogPager extends ReverseChronologicalPager {
        /** @var string|Title Events limited to those about Title when set */
        private $title = '';
 
-       /** @var string */
-       private $pattern = '';
+       /** @var bool */
+       private $pattern = false;
 
        /** @var string */
        private $typeCGI = '';
@@ -59,7 +59,7 @@ class LogPager extends ReverseChronologicalPager {
         * @param string|array $types Log types to show
         * @param string $performer The user who made the log entries
         * @param string|Title $title The page title the log entries are for
-        * @param string $pattern Do a prefix search rather than an exact title match
+        * @param bool $pattern Do a prefix search rather than an exact title match
         * @param array $conds Extra conditions for the query
         * @param int|bool $year The year to start from. Default: false
         * @param int|bool $month The month to start from. Default: false
@@ -68,7 +68,7 @@ class LogPager extends ReverseChronologicalPager {
         * @param int $logId Log entry ID, to limit to a single log entry.
         */
        public function __construct( $list, $types = [], $performer = '', $title = '',
-               $pattern = '', $conds = [], $year = false, $month = false, $tagFilter = '',
+               $pattern = false, $conds = [], $year = false, $month = false, $tagFilter = '',
                $action = '', $logId = false
        ) {
                parent::__construct( $list->getContext() );
@@ -194,7 +194,7 @@ class LogPager extends ReverseChronologicalPager {
         * (For the block and rights logs, this is a user page.)
         *
         * @param string|Title $page Title name
-        * @param string $pattern
+        * @param bool $pattern
         * @return void
         */
        private function limitTitle( $page, $pattern ) {
@@ -398,6 +398,9 @@ class LogPager extends ReverseChronologicalPager {
                return $this->title;
        }
 
+       /**
+        * @return bool
+        */
        public function getPattern() {
                return $this->pattern;
        }