aboutsummaryrefslogtreecommitdiffstats
path: root/includes/libs/Message/ListParam.php
diff options
context:
space:
mode:
authorBartosz Dziewoński <dziewonski@fastmail.fm>2024-02-29 20:20:30 +0100
committerBartosz Dziewoński <dziewonski@fastmail.fm>2024-10-19 15:00:07 +0200
commit9d56257d8c154cf3020ae7d0a1dd2f45d5211453 (patch)
tree08a4de93f2bc75633f49daee1301ad7a8f42dea3 /includes/libs/Message/ListParam.php
parent0f78b2053b0e25c2d0fcd082e02a4a923d94deb9 (diff)
downloadmediawikicore-9d56257d8c154cf3020ae7d0a1dd2f45d5211453.tar.gz
mediawikicore-9d56257d8c154cf3020ae7d0a1dd2f45d5211453.zip
Make Message and MessageValue compatible
Fix two problems that made it difficult to convert between Message and MessageValue, or to write code that could accept both of them, as exemplified by the StatusValue class: * Implement a common interface * Use the same internal format for message parameters While these changes should be compatible with most of existing code, where the authors were courteous enough to simply call methods such as Message::numParam() and not look inside the values they return, it is potentially a breaking change for anything that depended on the formatted params being arrays or accessed their keys. Example patches: https://gerrit.wikimedia.org/r/q/topic:message-param Notable changes: * Message and MessageValue now both implement MessageSpecifier (only Message implemented it before). * Message::numParam() and other static methods for encoding params now return MessageParam objects, instead of special arrays. Use these MessageParam objects internally in Message. * Narrow down the return type of MessageSpecifier::getParams() (it was just `array`, allowing any type in the array). Narrow down the types for Message::params() and MessageValue::params() to match. * Deprecate MediaWiki\Message\Converter. As a replacement add MessageValue::newFromSpecifier(), which is analogous to Message::newFromSpecifier(), but without weird legacy edge cases. * Make StatusValue::getMessages() return MessageValues. Remove code that converted between Message and MessageValue, no longer needed. * Update many type declarations and comments to use MessageSpecifier instead of MessageValue, as well as a couple of tests that depended on implementation details. Bug: T358779 Change-Id: I625a48a6ecd3fad5c2ed76b23343a0fef91e1b83
Diffstat (limited to 'includes/libs/Message/ListParam.php')
-rw-r--r--includes/libs/Message/ListParam.php2
1 files changed, 1 insertions, 1 deletions
diff --git a/includes/libs/Message/ListParam.php b/includes/libs/Message/ListParam.php
index 48823aa3808f..3b308915d828 100644
--- a/includes/libs/Message/ListParam.php
+++ b/includes/libs/Message/ListParam.php
@@ -20,7 +20,7 @@ class ListParam extends MessageParam {
* @stable to call.
*
* @param string $listType One of the ListType constants.
- * @param (MessageParam|MessageValue|string|int|float)[] $elements Values in the list.
+ * @param (MessageParam|MessageSpecifier|string|int|float)[] $elements Values in the list.
* Values that are not instances of MessageParam are wrapped using ParamType::TEXT.
*/
public function __construct( $listType, array $elements ) {