r114281 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r114280‎ | r114281 | r114282 >
Date:16:49, 20 March 2012
Author:maxsem
Status:ok
Tags:
Comment:
Fixed premature return from a function, comments
Modified paths:
  • /trunk/extensions/MobileFrontend/api/ApiQueryExtracts.php (modified) (history)

Diff [purge]

Index: trunk/extensions/MobileFrontend/api/ApiQueryExtracts.php
@@ -64,6 +64,7 @@
6565 /**
6666 * OpenSearchXml hook handler
6767 * @param array $results
 68+ * @return bool
6869 */
6970 public static function onOpenSearchXml( &$results ) {
7071 global $wgMFExtendOpenSearchXml;
@@ -237,6 +238,7 @@
238239 *
239240 * @param string $text
240241 * @param int $requestedSentenceCount
 242+ * @return string
241243 */
242244 private function getFirstSentences( $text, $requestedSentenceCount ) {
243245 wfProfileIn( __METHOD__ );
@@ -254,11 +256,11 @@
255257 $regexp = "/^($sentence){{$requestedSentenceCount}}/u";
256258 $matches = array();
257259 if( preg_match( $regexp, $text, $matches ) ) {
258 - return $matches[0];
 260+ $text = $matches[0];
259261 } else {
260262 // Just return the first line
261263 $lines = explode( "\n", $text );
262 - return trim( $lines[0] );
 264+ $text = trim( $lines[0] );
263265 }
264266 $text = $this->tidy( $text );
265267 wfProfileOut( __METHOD__ );
@@ -268,6 +270,7 @@
269271 /**
270272 * A simple wrapper around tidy
271273 * @param string $text
 274+ * @return string
272275 */
273276 private function tidy( $text ) {
274277 global $wgUseTidy;

Status & tagging log