Unsupported operand types error when creating new Webform handler Following the example here: https://www.drupal.org/docs/8/modules/webform/webform-cookbook/how-to-programmatically-add-a-handler-to-a-new-webform

I've created my handler manager sucessfully, however, when I go to create the handler, I get the error 


  Error: Unsupported operand types in Drupal\webform\Plugin\WebformHandlerBase->setConfiguration() (line 363 of /var/www/sitename/web/modules/contrib/webform/src/Plugin/WebformHandlerBase.php


Here's a sample of the code I'm using to get this error

$webform_machine_name = 'form_id';
$webform = \Drupal\webform\Entity\Webform::load($webform_machine_name);

$handler_manager = \Drupal::service('plugin.manager.webform.handler');

// Create webform handler.
$handler_configuration = [
  'id' =&gt; 'my_form_handler',
  'label' =&gt; 'My form handler',
  'handler_id' =&gt; 'my_form_handler',
  'status' =&gt; 1,
  'weight' =&gt; 0,
  'settings' =&gt; [],
];

$handler = $handler_manager-&gt;createInstance('my_form_handler', $handler_configuration );
When I look at line 263 in \Drupal\webform\Plugin\WebformHandlerBase there is the below code...

$this-&gt;configuration = $configuration['settings'] + $this-&gt;defaultConfiguration();


Your Unsupported operand types error message indicates that one of those variables/properties is not an array.

My best guess is that \Drupal\webform\Plugin\WebformHandlerBase::defaultConfiguration is not returning an array() because your $configuration['settings'] is set to an empty array.