Merge "Align "What's this" vertically"
[lhc/web/wiklou.git] / includes / Message.php
index 3893c9d..0240fa7 100644 (file)
@@ -419,7 +419,7 @@ class Message implements MessageSpecifier, Serializable {
                }
 
                if ( $value instanceof Message ) { // Message, RawMessage, ApiMessage, etc
-                       $message = clone( $value );
+                       $message = clone $value;
                } elseif ( $value instanceof MessageSpecifier ) {
                        $message = new Message( $value );
                } elseif ( is_string( $value ) ) {
@@ -488,7 +488,7 @@ class Message implements MessageSpecifier, Serializable {
         *
         * @since 1.17
         *
-        * @param mixed ... Parameters as strings or arrays from
+        * @param mixed $args,... Parameters as strings or arrays from
         *  Message::numParam() and the like, or a single array of parameters.
         *
         * @return Message $this
@@ -1305,9 +1305,9 @@ class Message implements MessageSpecifier, Serializable {
         */
        protected function formatListParam( array $params, $listType, $format ) {
                if ( !isset( self::$listTypeMap[$listType] ) ) {
-                       $warning = 'Invalid list type for message "' . $this->getKey() . '": ' .
-                               htmlspecialchars( serialize( $params )
-                       );
+                       $warning = 'Invalid list type for message "' . $this->getKey() . '": '
+                               . htmlspecialchars( $listType )
+                               . ' (params are ' . htmlspecialchars( serialize( $params ) ) . ')';
                        trigger_error( $warning, E_USER_WARNING );
                        $e = new Exception;
                        wfDebugLog( 'Bug58676', $warning . "\n" . $e->getTraceAsString() );
@@ -1344,56 +1344,3 @@ class Message implements MessageSpecifier, Serializable {
                return $this->extractParam( new RawMessage( $vars, $params ), $format );
        }
 }
-
-/**
- * Variant of the Message class.
- *
- * Rather than treating the message key as a lookup
- * value (which is passed to the MessageCache and
- * translated as necessary), a RawMessage key is
- * treated as the actual message.
- *
- * All other functionality (parsing, escaping, etc.)
- * is preserved.
- *
- * @since 1.21
- */
-class RawMessage extends Message {
-
-       /**
-        * Call the parent constructor, then store the key as
-        * the message.
-        *
-        * @see Message::__construct
-        *
-        * @param string $text Message to use.
-        * @param array $params Parameters for the message.
-        *
-        * @throws InvalidArgumentException
-        */
-       public function __construct( $text, $params = [] ) {
-               if ( !is_string( $text ) ) {
-                       throw new InvalidArgumentException( '$text must be a string' );
-               }
-
-               parent::__construct( $text, $params );
-
-               // The key is the message.
-               $this->message = $text;
-       }
-
-       /**
-        * Fetch the message (in this case, the key).
-        *
-        * @return string
-        */
-       public function fetchMessage() {
-               // Just in case the message is unset somewhere.
-               if ( $this->message === null ) {
-                       $this->message = $this->key;
-               }
-
-               return $this->message;
-       }
-
-}