r75108 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r75107‎ | r75108 | r75109 >
Date:20:56, 20 October 2010
Author:tparscal
Status:ok
Tags:
Comment:
Improves on r75055, improving comment accuracy, and removing useless casting.
Modified paths:
  • /trunk/phase3/includes/resourceloader/ResourceLoaderFileModule.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/resourceloader/ResourceLoaderFileModule.php
@@ -352,16 +352,16 @@
353353 /**
354354 * Gets a list of element that match a key, optionally using a fallback key.
355355 *
356 - * @param {array} $map Map of lists to select from
 356+ * @param {array} $list List of lists to select from
357357 * @param {string} $key Key to look for in $map
358 - * @param {string} $fallback Key to look for in map if $key is not in $map
 358+ * @param {string} $fallback Key to look for in $list if $key doesn't exist
359359 * @return {array} List of elements from $map which matched $key or $fallback, or an empty list in case of no match
360360 */
361 - protected static function tryForKey( $list, $key, $fallback = null ) {
 361+ protected static function tryForKey( array $list, $key, $fallback = null ) {
362362 if ( isset( $list[$key] ) && is_array( $list[$key] ) ) {
363 - return (array) $list[$key];
364 - } else if ( is_string( $fallback ) && isset( $list[$fallback] ) ) {
365 - return (array) $list[$fallback];
 363+ return $list[$key];
 364+ } else if ( is_string( $fallback ) && isset( $list[$fallback] ) && is_array( $list[$fallback] ) ) {
 365+ return $list[$fallback];
366366 }
367367 return array();
368368 }

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r75055Fixed case where tryForKey can sometimes not return an arraytparscal22:53, 19 October 2010

Status & tagging log