Change addCategoryLinks() to use array_fill_keys
authorwithoutaname <drevitchi@gmail.com>
Wed, 23 Jul 2014 02:41:50 +0000 (19:41 -0700)
committerWithoutaname <drevitchi@gmail.com>
Wed, 30 Jul 2014 20:36:02 +0000 (20:36 +0000)
Previously it used an ugly array_combine hack.

Change-Id: I6bc4fb5cfffda468c61037588ebb4399b5121db5

includes/OutputPage.php

index a64d049..0393425 100644 (file)
@@ -1266,11 +1266,8 @@ class OutputPage extends ContextSource {
                # Add the results to the link cache
                $lb->addResultToCache( LinkCache::singleton(), $res );
 
-               # Set all the values to 'normal'. This can be done with array_fill_keys in PHP 5.2.0+
-               $categories = array_combine(
-                       array_keys( $categories ),
-                       array_fill( 0, count( $categories ), 'normal' )
-               );
+               # Set all the values to 'normal'.
+               $categories = array_fill_keys( array_keys( $categories ), 'normal' );
 
                # Mark hidden categories
                foreach ( $res as $row ) {