Merge "Use wfIsHHVM() instead of a HipHop-specific environment variable"
[lhc/web/wiklou.git] / includes / FormOptions.php
index 5e5e8d4..53ddac9 100644 (file)
@@ -52,6 +52,9 @@ class FormOptions implements ArrayAccess {
         * This is useful for the namespace selector.
         */
        const INTNULL = 3;
+       /** Array type, maps guessType() to WebRequest::getArray()
+        * @since 1.29 */
+       const ARR = 5;
        /* @} */
 
        /**
@@ -120,6 +123,8 @@ class FormOptions implements ArrayAccess {
                        return self::FLOAT;
                } elseif ( is_string( $data ) ) {
                        return self::STRING;
+               } elseif ( is_array( $data ) ) {
+                       return self::ARR;
                } else {
                        throw new MWException( 'Unsupported datatype' );
                }
@@ -241,6 +246,9 @@ class FormOptions implements ArrayAccess {
 
        /**
         * @see validateBounds()
+        * @param string $name
+        * @param int $min
+        * @param int $max
         */
        public function validateIntBounds( $name, $min, $max ) {
                $this->validateBounds( $name, $min, $max );
@@ -328,7 +336,7 @@ class FormOptions implements ArrayAccess {
         * available for accessing with getValue() or consumeValue() etc.
         *
         * @param WebRequest $r The request to fetch values from
-        * @param array $optionKeys Which options to fetch the values for (default:
+        * @param array|null $optionKeys Which options to fetch the values for (default:
         *     all of them). Note that passing an empty array will also result in
         *     values for all keys being fetched.
         * @throws MWException If the type of any option is invalid
@@ -358,6 +366,9 @@ class FormOptions implements ArrayAccess {
                                case self::INTNULL:
                                        $value = $r->getIntOrNull( $name );
                                        break;
+                               case self::ARR:
+                                       $value = $r->getArray( $name );
+                                       break;
                                default:
                                        throw new MWException( 'Unsupported datatype' );
                        }
@@ -370,7 +381,7 @@ class FormOptions implements ArrayAccess {
 
        /** @name ArrayAccess functions
         * These functions implement the ArrayAccess PHP interface.
-        * @see http://php.net/manual/en/class.arrayaccess.php
+        * @see https://secure.php.net/manual/en/class.arrayaccess.php
         */
        /* @{ */
        /**