* @since 1.17
*
* @param string|string[] $key Message key or array of keys.
- * @param mixed [$param,...] Parameters as strings.
+ * @param mixed $param,... Parameters as strings.
*
* @return Message
*/
*
* @since 1.18
*
- * @param string|string[] [$keys,...] Message keys, or first argument as an array of all the
+ * @param string|string[] $keys,... Message keys, or first argument as an array of all the
* message keys.
*
* @return Message
*
* @since 1.17
*
- * @param mixed [$params,...] Parameters as strings, or a single argument that is
+ * @param mixed $params,... Parameters as strings, or a single argument that is
* an array of strings.
*
* @return Message $this
*
* @since 1.17
*
- * @param mixed [$params,...] Raw parameters as strings, or a single argument that is
+ * @param mixed $params,... Raw parameters as strings, or a single argument that is
* an array of raw parameters.
*
* @return Message $this
*
* @since 1.18
*
- * @param mixed [$param,...] Numeric parameters, or a single argument that is
+ * @param mixed $param,... Numeric parameters, or a single argument that is
* an array of numeric parameters.
*
* @return Message $this
*
* @since 1.22
*
- * @param int|int[] [$param,...] Duration parameters, or a single argument that is
+ * @param int|int[] $param,... Duration parameters, or a single argument that is
* an array of duration parameters.
*
* @return Message $this
*
* @since 1.22
*
- * @param string|string[] [$param,...] Expiry parameters, or a single argument that is
+ * @param string|string[] $param,... Expiry parameters, or a single argument that is
* an array of expiry parameters.
*
* @return Message $this
*
* @since 1.22
*
- * @param int|int[] [$param,...] Time period parameters, or a single argument that is
+ * @param int|int[] $param,... Time period parameters, or a single argument that is
* an array of time period parameters.
*
* @return Message $this
*
* @since 1.22
*
- * @param int|int[] [$param,...] Size parameters, or a single argument that is
+ * @param int|int[] $param,... Size parameters, or a single argument that is
* an array of size parameters.
*
* @return Message $this
*
* @since 1.22
*
- * @param int|int[] [$param,...] Bit rate parameters, or a single argument that is
+ * @param int|int[] $param,... Bit rate parameters, or a single argument that is
* an array of bit rate parameters.
*
* @return Message $this
# Maybe transform using the full parser
if ( $this->format === 'parse' ) {
$string = $this->parseText( $string );
- $m = array();
- if ( preg_match( '/^<p>(.*)\n?<\/p>\n?$/sU', $string, $m ) ) {
- $string = $m[1];
- }
+ $string = Parser::stripOuterParagraph( $string );
} elseif ( $this->format === 'block-parse' ) {
$string = $this->parseText( $string );
} elseif ( $this->format === 'text' ) {
* @return string Wikitext parsed into HTML.
*/
protected function parseText( $string ) {
- $out = MessageCache::singleton()->parse( $string, $this->title, /*linestart*/true, $this->interface, $this->language );
+ $out = MessageCache::singleton()->parse(
+ $string,
+ $this->title,
+ /*linestart*/true,
+ $this->interface,
+ $this->language
+ );
+
return $out instanceof ParserOutput ? $out->getText() : $out;
}
* @return string Wikitext with {{-constructs replaced with their values.
*/
protected function transformText( $string ) {
- return MessageCache::singleton()->transform( $string, $this->interface, $this->language, $this->title );
+ return MessageCache::singleton()->transform(
+ $string,
+ $this->interface,
+ $this->language,
+ $this->title
+ );
}
/**
* @throws MWException If message key array is empty.
*/
protected function fetchMessage() {
- if ( !isset( $this->message ) ) {
+ if ( $this->message === null ) {
$cache = MessageCache::singleton();
if ( is_array( $this->key ) ) {
if ( !count( $this->key ) ) {
*/
public function fetchMessage() {
// Just in case the message is unset somewhere.
- if ( !isset( $this->message ) ) {
+ if ( $this->message === null ) {
$this->message = $this->key;
}
return $this->message;