Add @var to Pager classes
authorUmherirrender <umherirrender_de.wp@web.de>
Thu, 3 Jan 2019 15:15:07 +0000 (16:15 +0100)
committerUmherirrender <umherirrender_de.wp@web.de>
Thu, 7 Mar 2019 19:25:11 +0000 (20:25 +0100)
Some are needed to make better results with phan in extensions

For example:
File CentralNoticeCampaignLogPager.php line 12:
Assigning array{0:20,1:50,2:100} to property but
\CentralNoticeCampaignLogPager->mLimitsShown is
array{0:20,1:50,2:100,3:250,4:500}
[PhanTypeMismatchProperty]

With "@var int[]" the type is correct

Change-Id: Ic68910bf17344852ad11fcc000a47891e4bf0179

includes/pager/IndexPager.php
includes/pager/RangeChronologicalPager.php
includes/pager/ReverseChronologicalPager.php
includes/pager/TablePager.php

index ce1d2d0..b56ae37 100644 (file)
@@ -81,7 +81,7 @@ abstract class IndexPager extends ContextSource implements Pager {
        public $mLimitsShown = [ 20, 50, 100, 250, 500 ];
        /** @var int The default entry limit choosen for clients */
        public $mDefaultLimit = 50;
-       /** @var string|int The starting point to enumerate entries */
+       /** @var mixed The starting point to enumerate entries */
        public $mOffset;
        /** @var int The maximum number of entries to show */
        public $mLimit;
@@ -89,20 +89,23 @@ abstract class IndexPager extends ContextSource implements Pager {
        public $mQueryDone = false;
        /** @var IDatabase */
        public $mDb;
-       /** @var stdClass|null Extra row fetched at the end to see if the end was reached */
+       /** @var stdClass|bool|null Extra row fetched at the end to see if the end was reached */
        public $mPastTheEndRow;
 
        /**
         * The index to actually be used for ordering. This is a single column,
         * for one ordering, even if multiple orderings are supported.
+        * @var string
         */
        protected $mIndexField;
        /**
         * An array of secondary columns to order by. These fields are not part of the offset.
         * This is a column list for one ordering, even if multiple orderings are supported.
+        * @var string[]
         */
        protected $mExtraSortFields;
        /** For pages that support multiple types of ordering, which one to use.
+        * @var string|null
         */
        protected $mOrderType;
        /**
@@ -115,18 +118,31 @@ abstract class IndexPager extends ContextSource implements Pager {
         *
         * Like $mIndexField, $mDefaultDirection will be a single value even if the
         * class supports multiple default directions for different order types.
+        * @var bool
         */
        public $mDefaultDirection;
+       /** @var bool */
        public $mIsBackwards;
 
-       /** True if the current result set is the first one */
+       /** @var bool True if the current result set is the first one */
        public $mIsFirst;
+       /** @var bool */
        public $mIsLast;
 
-       protected $mLastShown, $mFirstShown, $mPastTheEndIndex, $mDefaultQuery, $mNavigationBar;
+       /** @var mixed */
+       protected $mLastShown;
+       /** @var mixed */
+       protected $mFirstShown;
+       /** @var mixed */
+       protected $mPastTheEndIndex;
+       /** @var array */
+       protected $mDefaultQuery;
+       /** @var string */
+       protected $mNavigationBar;
 
        /**
         * Whether to include the offset in the query
+        * @var bool
         */
        protected $mIncludeOffset = false;
 
index bf36983..7cbcaa9 100644 (file)
@@ -26,6 +26,7 @@ use Wikimedia\Timestamp\TimestampException;
  */
 abstract class RangeChronologicalPager extends ReverseChronologicalPager {
 
+       /** @var string[] */
        protected $rangeConds = [];
 
        /**
index 51824d2..e8f3f40 100644 (file)
@@ -26,9 +26,13 @@ use Wikimedia\Timestamp\TimestampException;
  * @ingroup Pager
  */
 abstract class ReverseChronologicalPager extends IndexPager {
+       /** @var bool */
        public $mDefaultDirection = IndexPager::DIR_DESCENDING;
+       /** @var int */
        public $mYear;
+       /** @var int */
        public $mMonth;
+       /** @var int */
        public $mDay;
 
        public function getNavigationBar() {
index 8934fc2..f6445f5 100644 (file)
  * @ingroup Pager
  */
 abstract class TablePager extends IndexPager {
+       /** @var string */
        protected $mSort;
 
+       /** @var stdClass */
        protected $mCurrentRow;
 
        public function __construct( IContextSource $context = null ) {