title: Cannot use object of type Closure as array
body: <p>fatal error " Cannot use object of type Closure as array", how to fix this problem. code i am using is as below </p>
  
  <pre><code>function message_broker_example_message_broker_consumers($self_name) {
    $consumers = array();
  
    // An example consumer implemented using a closure.
    $consumers['helloWorldToEveryone'] = array(
      'queue' =&gt; 'helloWorldForAll',
      'callback' =&gt; function($message, \Closure $ack) {
        $message = json_decode($message-&gt;body);
  
        if ($message-&gt;name == 'crash') {
          throw new InvalidMessageException('Invalid name detected!');
        }
  
        if (function_exists('drush_print')) {
          drush_print('Hello world, ' . $message-&gt;name);
        }
        else {
          drupal_set_message(t('Hello world, @name.', array('@name' =&gt; $message-&gt;name)));
        }
  
        $ack();
      }, 'invalidMessageHandler' =&gt; function($message) {
        if (function_exists('drush_print')) {
          drush_print('Invalid message handler was executed.');
        }
        else {
          drupal_set_message(t('Invalid message handler was executed.'), 'warning');
        }
      });
  </code></pre>
  
  <p>the code is snippet from drupal message_broker module</p>