parser: Fix return type for methods and match phpdoc comments
[lhc/web/wiklou.git] / includes / parser / Preprocessor_Hash.php
index 6d6dd89..a845047 100644 (file)
@@ -1232,12 +1232,10 @@ class PPFrame_Hash implements PPFrame {
        /**
         * @param string $sep
         * @param int $flags
-        * @param string|PPNode $args,...
+        * @param string|PPNode ...$args
         * @return string
         */
-       public function implodeWithFlags( $sep, $flags /*, ... */ ) {
-               $args = array_slice( func_get_args(), 2 );
-
+       public function implodeWithFlags( $sep, $flags, ...$args ) {
                $first = true;
                $s = '';
                foreach ( $args as $root ) {
@@ -1263,12 +1261,10 @@ class PPFrame_Hash implements PPFrame {
         * Implode with no flags specified
         * This previously called implodeWithFlags but has now been inlined to reduce stack depth
         * @param string $sep
-        * @param string|PPNode $args,...
+        * @param string|PPNode ...$args
         * @return string
         */
-       public function implode( $sep /*, ... */ ) {
-               $args = array_slice( func_get_args(), 1 );
-
+       public function implode( $sep, ...$args ) {
                $first = true;
                $s = '';
                foreach ( $args as $root ) {
@@ -1295,11 +1291,10 @@ class PPFrame_Hash implements PPFrame {
         * with implode()
         *
         * @param string $sep
-        * @param string|PPNode $args,...
+        * @param string|PPNode ...$args
         * @return PPNode_Hash_Array
         */
-       public function virtualImplode( $sep /*, ... */ ) {
-               $args = array_slice( func_get_args(), 1 );
+       public function virtualImplode( $sep, ...$args ) {
                $out = [];
                $first = true;
 
@@ -1328,11 +1323,10 @@ class PPFrame_Hash implements PPFrame {
         * @param string $start
         * @param string $sep
         * @param string $end
-        * @param string|PPNode $args,...
+        * @param string|PPNode ...$args
         * @return PPNode_Hash_Array
         */
-       public function virtualBracketedImplode( $start, $sep, $end /*, ... */ ) {
-               $args = array_slice( func_get_args(), 3 );
+       public function virtualBracketedImplode( $start, $sep, $end, ...$args ) {
                $out = [ $start ];
                $first = true;
 
@@ -1702,10 +1696,7 @@ class PPCustomFrame_Hash extends PPFrame_Hash {
         * @return string|bool
         */
        public function getArgument( $index ) {
-               if ( !isset( $this->args[$index] ) ) {
-                       return false;
-               }
-               return $this->args[$index];
+               return $this->args[$index] ?? false;
        }
 
        public function getArguments() {
@@ -1769,7 +1760,8 @@ class PPNode_Hash_Tree implements PPNode {
         *
         * @param array $store
         * @param int $index
-        * @return PPNode_Hash_Tree|PPNode_Hash_Attr|PPNode_Hash_Text
+        * @return PPNode_Hash_Tree|PPNode_Hash_Attr|PPNode_Hash_Text|false
+        * @throws MWException
         */
        public static function factory( array $store, $index ) {
                if ( !isset( $store[$index] ) ) {
@@ -1793,6 +1785,7 @@ class PPNode_Hash_Tree implements PPNode {
 
        /**
         * Convert a node to XML, for debugging
+        * @return string
         */
        public function __toString() {
                $inner = '';