diff --git a/core/lib/Drupal/Core/Extension/ModuleHandler.php b/core/lib/Drupal/Core/Extension/ModuleHandler.php index bf222226c2..ad539fd7df 100644 --- a/core/lib/Drupal/Core/Extension/ModuleHandler.php +++ b/core/lib/Drupal/Core/Extension/ModuleHandler.php @@ -442,11 +442,10 @@ private function triggerDeprecationError($description, $hook) { $modules = array_keys($this->getImplementationInfo($hook)); if (!empty($modules)) { $message = 'The deprecated hook hook_' . $hook . '() is implemented in these functions: '; - $hooks = []; - foreach ($modules as $module) { - $hooks[] = $module . '_' . $hook . '()'; - } - @trigger_error($message . implode(', ', $hooks) . '. ' . $description, E_USER_DEPRECATED); + $implementations = array_map(function ($module) use ($hook) { + return $module . '_' . $hook . '()'; + }, $modules); + @trigger_error($message . implode(', ', $implementations) . '. ' . $description, E_USER_DEPRECATED); } }