From: umherirrender Date: Sun, 26 May 2013 18:48:17 +0000 (+0200) Subject: ApiHelp: Avoid header for example, when there no examples X-Git-Tag: 1.31.0-rc.0~19567 X-Git-Url: http://git.cyclocoop.org/%24href?a=commitdiff_plain;h=2d9b71818f61262237fc46110c229d864e265a86;p=lhc%2Fweb%2Fwiklou.git ApiHelp: Avoid header for example, when there no examples When writing a new extension the source: public function getExamples() { return array( //TODO ); } would produce a empty "Example:" header on the help page. Avoid this, by changing the condition to check for truthy instead of false and empty string. Change-Id: I67ecacbbac66b97ed96412abf79b49aebe0ebdbf --- diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php index 7e7365fbc9..c8b05e84de 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -304,7 +304,7 @@ abstract class ApiBase extends ContextSource { } $examples = $this->getExamples(); - if ( $examples !== false && $examples !== '' ) { + if ( $examples ) { if ( !is_array( $examples ) ) { $examples = array( $examples