Thiemo Kreuz (WMDE) has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/399424 )

Change subject: Add type hints to all class properties of DPLArticle
......................................................................

Add type hints to all class properties of DPLArticle

Somebody decided to initialize all fields with empty strings, even if
they must contain integers, or even Title objects. I decided to not
touch this for now, except for the title, which is exclusively set via
the constructor (and should be private, but again, I did not wanted to
touch this for now).

However, I did not added this string type to the documentation, mostly
because I could not find any code that actually uses these empty strings.

Change-Id: Ie2d2b448c2fd843d8018e3f3fa53f98f664c4a3c
---
M DPLArticle.php
1 file changed, 124 insertions(+), 24 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DynamicPageList 
refs/changes/24/399424/1

diff --git a/DPLArticle.php b/DPLArticle.php
index f35fa8f..05a3e57 100644
--- a/DPLArticle.php
+++ b/DPLArticle.php
@@ -2,31 +2,131 @@
 
 // Simple Article/Page class with properties used in the DPL
 class DPLArticle {
-       public $mTitle = '';            // title
-       public $mNamespace = -1;        // namespace (number)
-       public $mID = 0;                        // page_id
-       public $mSelTitle = '';    // selected title of initial page
-       public $mSelNamespace = -1;// selected namespace (number) of initial 
page
-       public $mImageSelTitle = ''; // selected title of image
-       public $mLink = '';             // html link to page
-       public $mExternalLink = '';// external link on the page
-       public $mStartChar = '';        // page title first char
-       public $mParentHLink = ''; // heading (link to the associated page) 
that page belongs to in the list (default '' means no heading)
-       public $mCategoryLinks = array(); // category links in the page
-       public $mCategoryTexts = array(); // category names (without link) in 
the page
-       public $mCounter = '';  // Number of times this page has been viewed
-       public $mSize = '';             // Article length in bytes of wiki text
-       public $mDate = '';             // timestamp depending on the user's 
request (can be first/last edit, page_touched, ...)
-       public $myDate = '';            // the same, based on user format 
definition
-       public $mRevision = '';    // the revision number if specified
-       public $mUserLink = '';         // link to editor (first/last, 
depending on user's request) 's page or contributions if not registered
-       public $mUser = '';             // name of editor (first/last, 
depending on user's request) or contributions if not registered
-       public $mComment = '';  // revision comment / edit summary
-       public $mContribution = ''; // number of bytes changed
-       public $mContrib = '';      // short string indicating the size of a 
contribution
-       public $mContributor = '';  // user who made the changes
 
-       function __construct( $title, $namespace ) {
+       /**
+        * @var Title
+        */
+       public $mTitle;
+
+       /**
+        * @var int Namespace number
+        */
+       public $mNamespace = -1;
+
+       /**
+        * @var int Page ID
+        */
+       public $mID = 0;
+
+       /**
+        * @var string Selected title of initial page
+        */
+       public $mSelTitle = '';
+
+       /**
+        * @var int Selected namespace number of initial page
+        */
+       public $mSelNamespace = -1;
+
+       /**
+        * @var string Selected title of image
+        */
+       public $mImageSelTitle = '';
+
+       /**
+        * @var string Wikitext link to page
+        */
+       public $mLink = '';
+
+       /**
+        * @var string External link on the page
+        */
+       public $mExternalLink = '';
+
+       /**
+        * @var string Page title first char
+        */
+       public $mStartChar = '';
+
+       /**
+        * @var string Wikitext heading (link to the associated page) that page 
belongs to in the list.
+        *  Default '' means no heading.
+        */
+       public $mParentHLink = '';
+
+       /**
+        * @var string[] Wikitext links to category in the page
+        */
+       public $mCategoryLinks = array();
+
+       /**
+        * @var string[] Plain text category names (without link) in the page
+        */
+       public $mCategoryTexts = array();
+
+       /**
+        * @var int Number of times this page has been viewed
+        */
+       public $mCounter = '';
+
+       /**
+        * @var int Article length in bytes of wiki text
+        */
+       public $mSize = '';
+
+       /**
+        * @var int|string Timestamp depending on the user's request (can be 
first/last edit,
+        *  page_touched, …)
+        */
+       public $mDate = '';
+
+       /**
+        * @var string The same, based on user format definition
+        */
+       public $myDate = '';
+
+       /**
+        * @var int The revision number if specified
+        */
+       public $mRevision = '';
+
+       /**
+        * @var string Wikitext link to editor's (first/last, depending on 
user's request) page or
+        *  contributions if not registered
+        */
+       public $mUserLink = '';
+
+       /**
+        * @var string Name of editor (first/last, depending on user's request) 
or contributions if not
+        *  registered
+        */
+       public $mUser = '';
+
+       /**
+        * @var string Revision comment / edit summary
+        */
+       public $mComment = '';
+
+       /**
+        * @var int Number of bytes changed
+        */
+       public $mContribution = '';
+
+       /**
+        * @var string Short plain text string indicating the size of a 
contribution
+        */
+       public $mContrib = '';
+
+       /**
+        * @var string Name of the user who made the changes
+        */
+       public $mContributor = '';
+
+       /**
+        * @param Title $title
+        * @param int $namespace
+        */
+       function __construct( Title $title, $namespace ) {
                $this->mTitle     = $title;
                $this->mNamespace = $namespace;
        }

-- 
To view, visit https://gerrit.wikimedia.org/r/399424
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie2d2b448c2fd843d8018e3f3fa53f98f664c4a3c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DynamicPageList
Gerrit-Branch: master
Gerrit-Owner: Thiemo Kreuz (WMDE) <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to