Merge "exception: Create generic BadRequestError based on ErrorPageError"
[lhc/web/wiklou.git] / maintenance / convertExtensionToRegistration.php
index 8993146..f9dd58c 100644 (file)
@@ -216,7 +216,7 @@ class ConvertExtensionToRegistration extends Maintenance {
        }
 
        public function handleHooks( $realName, $value ) {
-               foreach ( $value as $hookName => $handlers ) {
+               foreach ( $value as $hookName => &$handlers ) {
                        foreach ( $handlers as $func ) {
                                if ( $func instanceof Closure ) {
                                        $this->error( "Error: Closures cannot be converted to JSON. " .
@@ -230,6 +230,9 @@ class ConvertExtensionToRegistration extends Maintenance {
                                        );
                                }
                        }
+                       if ( count( $handlers ) === 1 ) {
+                               $handlers = $handlers[0];
+                       }
                }
                $this->json[$realName] = $value;
        }