From: Antoine Musso Date: Sat, 14 May 2011 11:19:59 +0000 (+0000) Subject: ApiBase::dieUsageMsg() now also accept being given a single element as a string. X-Git-Tag: 1.31.0-rc.0~30220 X-Git-Url: http://git.cyclocoop.org/%22.%24image2.%22?a=commitdiff_plain;h=391284b75ce3eda69c02172d7711dd83cf93cd3c;p=lhc%2Fweb%2Fwiklou.git ApiBase::dieUsageMsg() now also accept being given a single element as a string. So the old: $api->dieUsageMsg( array( 'nologging' ) ); Can now be written: $api->dieUsageMsg( 'nologging' ); Saves up a few keystrokes. --- diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php index 1c3da74ebf..961d401d44 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -1110,9 +1110,14 @@ abstract class ApiBase { /** * Output the error message related to a certain array - * @param $error array Element of a getUserPermissionsErrors()-style array + * @param $error (array|string) Element of a getUserPermissionsErrors()-style array */ public function dieUsageMsg( $error ) { + # most of the time we send a 1 element, so we might as well send it as + # a string and make this an array here. + if( is_string( $error ) ) { + $error = array( $error ); + } $parsed = $this->parseMsg( $error ); $this->dieUsage( $parsed['info'], $parsed['code'] ); }