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

Change subject: Improve type hints in documentation
......................................................................

Improve type hints in documentation

Change-Id: I1f235d128e3fdf1f78a66eab1b7c942a60b5897b
---
M CollectionProposals.php
M CollectionSuggest.php
M includes/MessageBoxHelper.php
3 files changed, 23 insertions(+), 51 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Collection 
refs/changes/63/405863/1

diff --git a/CollectionProposals.php b/CollectionProposals.php
index 177a285..a539ede 100644
--- a/CollectionProposals.php
+++ b/CollectionProposals.php
@@ -21,8 +21,6 @@
  */
 
 /**
- * class: CollectionProposals
- *
  * it needs 3 Lists:
  * - one with the bookmembers
  * - one where it can save the banned articles
@@ -39,26 +37,29 @@
 class CollectionProposals {
 
        /**
-        * ==================================================
-        * class attributes
-        * ==================================================
-        *
-        * only mLinkList and mPropList can be accessed from
-        * outside the class via getLinkList() and getPropsosals()
+        * @var array
         */
        private $mColl;
+
+       /**
+        * @var array[]
+        */
        private $mPropList;
+
+       /**
+        * @var array[]
+        */
        private $mLinkList;
+
+       /**
+        * @var string[]
+        */
        private $mBanList;
 
        /**
-        * ==================================================
-        * constructor
-        * ==================================================
-        *
         * @param array $coll the collection
-        * @param array $ban the list of the banned articles
-        * @param array $props the list of the proposals
+        * @param string[] $ban the list of the banned articles
+        * @param array[] $props the list of the proposals
         */
        public function __construct( $coll, $ban, $props ) {
                $this->mPropList = [];
@@ -68,13 +69,7 @@
        }
 
        /**
-        * ==================================================
-        * public methods
-        * ==================================================
-        */
-
-       /**
-        * @return array
+        * @return array[]
         */
        public function getLinkList() {
                return $this->mLinkList;
@@ -83,7 +78,7 @@
        /**
         * @param array $collection
         */
-       public function setCollection( $collection ) {
+       public function setCollection( array $collection ) {
                $this->mColl = $collection;
        }
 
@@ -97,7 +92,7 @@
         * @param bool $doUpdate when true, $linkList will
         *        updated before calculating the proposals
         *        default is true
-        * @return array a 2-dimensional array that contains the proposals
+        * @return array[] a 2-dimensional array that contains the proposals
         *         the first dimesion is numeric, the second contains
         *         3 entries:
         *         - 'name': the name of a proposed article
@@ -126,12 +121,6 @@
        public function hasBans() {
                return count( $this->mBanList ) > 0;
        }
-
-       /**
-        * ==================================================
-        * private methods
-        * ==================================================
-        */
 
        private function updateLinkList() {
                $this->addCollectionArticles();
@@ -200,7 +189,7 @@
         *
         * @param int $num_articles
         * @param string $wikitext article text
-        * @return array with links and their weights
+        * @return float[] with links and their weights
         */
        private function getWeightedLinks( $num_articles, $wikitext ) {
                global $wgCollectionSuggestCheapWeightThreshhold;
@@ -364,7 +353,7 @@
         * if the array doesn't contain the article
         *
         * @param string $entry an articlename
-        * @param array $array to be searched, it has to 2-dimensional
+        * @param array[] $array to be searched, it has to 2-dimensional
         *               the 2nd dimension needs the key 'name'
         * @return bool|int the key as integer or false
         */
diff --git a/CollectionSuggest.php b/CollectionSuggest.php
index 858e42e..c5ece82 100644
--- a/CollectionSuggest.php
+++ b/CollectionSuggest.php
@@ -21,19 +21,12 @@
  */
 
 /**
- * Class: CollectionSuggest
- *
  * This class contains only static methods, so theres no need for a 
constructer.
  * When the page Special:Book/suggest/ is loaded the method run() is called.
  * Ajax calles refresh().
  * When clearing a book the method clear() should be called.
  */
 class CollectionSuggest {
-       /**
-        * 
===============================================================================
-        * public methods
-        * 
===============================================================================
-        */
 
        /**
         * Main entrypoint
@@ -89,7 +82,7 @@
        /**
         * @param string $lastAction
         * @param string|string[] $article
-        * @return array
+        * @return string[] HTML
         */
        public static function undo( $lastAction, $article ) {
                switch ( $lastAction ) {
@@ -120,14 +113,7 @@
        }
 
        /**
-        * 
===============================================================================
-        * private methods
-        * 
===============================================================================
-        */
-
-       /**
         * @param string $article
-        * @return mixed
         */
        private static function unban( $article ) {
                if ( !isset( $_SESSION['wsCollectionSuggestBan'] ) ) {
@@ -212,9 +198,9 @@
         * Add some articles and update the book of the Proposal-Object
         *
         * @param array $articleList with the names of the articles to be added
-        * @param CollectionProposals $prop the proposal Object
+        * @param CollectionProposals $prop
         */
-       private static function addArticlesFromName( $articleList, $prop ) {
+       private static function addArticlesFromName( $articleList, 
CollectionProposals $prop ) {
                foreach ( $articleList as $article ) {
                        SpecialCollection::addArticleFromName( NS_MAIN, 
$article );
                }
diff --git a/includes/MessageBoxHelper.php b/includes/MessageBoxHelper.php
index 6fa6f36..5e24597 100644
--- a/includes/MessageBoxHelper.php
+++ b/includes/MessageBoxHelper.php
@@ -25,9 +25,6 @@
 use TemplateParser;
 
 /**
- * Class MessageBoxHelper
- * @package MediaWiki\Extensions\Collection
- *
  * A helper class to easily handle extra styles and render html for messages 
boxes informing
  * about on-ging Book Creator maintenance and unavailability of PDF generation 
feature.
  *

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1f235d128e3fdf1f78a66eab1b7c942a60b5897b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Collection
Gerrit-Branch: master
Gerrit-Owner: Thiemo Kreuz (WMDE) <thiemo.kr...@wikimedia.de>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to