Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/275387

Change subject: Fix @param and @return types on all PPFrame::getArgument methods
......................................................................

Fix @param and @return types on all PPFrame::getArgument methods

This is about template parameters. They can be indexed by position (int) or
name (string). The returned value is always a string, or false (bool) on
failure.

Change-Id: I565210ad485505281246ef2bb3086a675b905976
---
M includes/parser/Preprocessor.php
M includes/parser/Preprocessor_DOM.php
M includes/parser/Preprocessor_Hash.php
3 files changed, 30 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/87/275387/1

diff --git a/includes/parser/Preprocessor.php b/includes/parser/Preprocessor.php
index 368d79e..cc98abd 100644
--- a/includes/parser/Preprocessor.php
+++ b/includes/parser/Preprocessor.php
@@ -260,8 +260,8 @@
 
        /**
         * Get an argument to this frame by name
-        * @param string $name
-        * @return bool
+        * @param int|string $name
+        * @return string|bool
         */
        public function getArgument( $name );
 
diff --git a/includes/parser/Preprocessor_DOM.php 
b/includes/parser/Preprocessor_DOM.php
index 79a66e0..4c94b2a 100644
--- a/includes/parser/Preprocessor_DOM.php
+++ b/includes/parser/Preprocessor_DOM.php
@@ -1462,6 +1462,10 @@
                return true;
        }
 
+       /**
+        * @param int|string $name
+        * @return bool Always false in this implementation.
+        */
        public function getArgument( $name ) {
                return false;
        }
@@ -1646,6 +1650,10 @@
                return $arguments;
        }
 
+       /**
+        * @param int $index
+        * @return string|bool
+        */
        public function getNumberedArgument( $index ) {
                if ( !isset( $this->numberedArgs[$index] ) ) {
                        return false;
@@ -1660,6 +1668,10 @@
                return $this->numberedExpansionCache[$index];
        }
 
+       /**
+        * @param string $name
+        * @return string|bool
+        */
        public function getNamedArgument( $name ) {
                if ( !isset( $this->namedArgs[$name] ) ) {
                        return false;
@@ -1672,6 +1684,10 @@
                return $this->namedExpansionCache[$name];
        }
 
+       /**
+        * @param int|string $name
+        * @return string|bool
+        */
        public function getArgument( $name ) {
                $text = $this->getNumberedArgument( $name );
                if ( $text === false ) {
@@ -1738,6 +1754,10 @@
                return !count( $this->args );
        }
 
+       /**
+        * @param int|string $index
+        * @return string|bool
+        */
        public function getArgument( $index ) {
                if ( !isset( $this->args[$index] ) ) {
                        return false;
diff --git a/includes/parser/Preprocessor_Hash.php 
b/includes/parser/Preprocessor_Hash.php
index 24baae4..f030cca 100644
--- a/includes/parser/Preprocessor_Hash.php
+++ b/includes/parser/Preprocessor_Hash.php
@@ -1355,8 +1355,8 @@
        }
 
        /**
-        * @param string $name
-        * @return bool
+        * @param int|string $name
+        * @return bool Always false in this implementation.
         */
        public function getArgument( $name ) {
                return false;
@@ -1549,7 +1549,7 @@
 
        /**
         * @param int $index
-        * @return array|bool
+        * @return string|bool
         */
        public function getNumberedArgument( $index ) {
                if ( !isset( $this->numberedArgs[$index] ) ) {
@@ -1567,7 +1567,7 @@
 
        /**
         * @param string $name
-        * @return bool
+        * @return string|bool
         */
        public function getNamedArgument( $name ) {
                if ( !isset( $this->namedArgs[$name] ) ) {
@@ -1582,8 +1582,8 @@
        }
 
        /**
-        * @param string $name
-        * @return array|bool
+        * @param int|string $name
+        * @return string|bool
         */
        public function getArgument( $name ) {
                $text = $this->getNumberedArgument( $name );
@@ -1652,8 +1652,8 @@
        }
 
        /**
-        * @param int $index
-        * @return bool
+        * @param int|string $index
+        * @return string|bool
         */
        public function getArgument( $index ) {
                if ( !isset( $this->args[$index] ) ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I565210ad485505281246ef2bb3086a675b905976
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) <[email protected]>

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

Reply via email to