Don't depend on Message implementation details

You're not really supposed to know how Message represents the
parameters internally.

Change-Id: I5767dcc96af77b21655609cb9ce43bcaf9e07e19
This commit is contained in:
Bartosz Dziewoński 2024-06-13 00:57:45 +02:00 committed by jenkins-bot
parent b4a7d5c8ca
commit ce1fa91c54

View file

@ -51,7 +51,16 @@ class MessageLibrary extends LibraryBase {
} }
$msg->useDatabase( $data['useDB'] ); $msg->useDatabase( $data['useDB'] );
if ( $setParams ) { if ( $setParams ) {
$msg->params( array_values( $data['params'] ) ); foreach ( $data['params'] as $param ) {
// Only rawParam and numParam are supposed by the Lua message API
if ( is_array( $param ) && isset( $param['raw'] ) ) {
$msg->rawParams( $param );
} elseif ( is_array( $param ) && isset( $param['num'] ) ) {
$msg->numParams( $param );
} else {
$msg->params( $param );
}
}
} }
return $msg; return $msg;
} }