From 391284b75ce3eda69c02172d7711dd83cf93cd3c Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Sat, 14 May 2011 11:19:59 +0000 Subject: [PATCH] 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. --- includes/api/ApiBase.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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'] ); } -- 2.20.1