how to correctly chain multiple files in '$settings['container_yamls'][]'? In the settings.php file, I have the following line, to use a local service.yml.

$settings['container_yamls'][] = __DIR__ . '/services.yml';


I need to install the Redis module, which instructs to put the following line in the settings.php file.

$settings['container_yamls'][] = 'modules/redis/example.services.yml';


I'm not sure how the settings array works. I think that just adding that statement will overwrite the existing one.

I want to add the array item as suggested in the documentation for that module.

Should I use these lines?

$settings['container_yamls'][] = __DIR__ . '/services.yml';
$settings['container_yamls'][] = 'modules/redis/example.services.yml';


Or should I use these lines?

$settings['container_yamls'] = array(
  __DIR__ . '/services.yml',
  'modules/redis/example.services.yml',
);
The settings.php file already contains the following line.

$settings['container_yamls'][] = __DIR__ . '/services.yml';


It is much easier to add the following one at the bottom of the settings.php file.

$settings['container_yamls'][] = 'modules/redis/example.services.yml';


Since it is added on the bottom of the file, it is easier to find and remove it, in the case you decide not to use that module anymore. In this case, you just remove a single line, and Drupal doesn't use that module's services anymore.

Also, if you install another module that requires to add a similar line, you just need to add a $settings['container_yamls'][] which can be easily removed without touching the other lines.

Those are the only considerations I could make about which code snippet I would use. Otherwise, for PHP 5.5 (and Drupal), the following code snippets are perfectly equivalent.

$settings['container_yamls'][] = __DIR__ . '/services.yml';
$settings['container_yamls'][] = 'modules/redis/example.services.yml';




$settings['container_yamls'] = array(
  __DIR__ . '/services.yml',
  'modules/redis/example.services.yml',
);




$settings['container_yamls'] = [
  __DIR__ . '/services.yml',
  'modules/redis/example.services.yml',
];