Code results in "array_merge() does not accept unknown named parameters"
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3514482. -->
Reported by: [alexpott](https://www.drupal.org/user/157725)
Related to !21
>>>
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<p>The code</p>
<pre> if (count($relatable_resource_types) > 0) {<br> $message .= sprintf(' Possible values: %s', implode(', ', array_unique(array_merge(...$relatable_resource_types))));<br> }</pre><p>
Results in errors because array merge does not take named parameters and $relatable_resource_types has keys.</p>
<h4 id="summary-steps-reproduce">Steps to reproduce</h4>
<p>Try and use a missing relationship - you'll get an unhelpful error about array_merge</p>
<h3 id="summary-proposed-resolution">Proposed resolution</h3>
<p>Change the code to:</p>
<pre> if (count($relatable_resource_types) > 0) {<br> $message .= sprintf(' Possible values: %s', implode(', ', array_unique(array_merge(...array_values($relatable_resource_types)))));<br> }</pre><h3 id="summary-remaining-tasks">Remaining tasks</h3>
<h3 id="summary-ui-changes">User interface changes</h3>
<h3 id="summary-api-changes">API changes</h3>
<h3 id="summary-data-model-changes">Data model changes</h3>
issue