}
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. " .
);
}
}
+ if ( count( $handlers ) === 1 ) {
+ $handlers = $handlers[0];
+ }
}
$this->json[$realName] = $value;
}