1
0
mirror of https://github.com/flarum/core.git synced 2025-06-13 01:57:14 +02:00

Convert closures in arrays to Compat extenders as well

Refs .
This commit is contained in:
Franz Liedke
2018-01-21 22:38:06 +01:00
parent fa14be591c
commit 4b1a299b3c

@ -284,19 +284,19 @@ class ExtensionManager
->flatMap(function (Extension $extension) {
$bootstrapper = $extension->getBootstrapperPath();
if ($this->filesystem->exists($bootstrapper)) {
$extenders = require $bootstrapper;
if (is_array($extenders)) {
return $extenders;
}
// Assume that the extension has not yet switched to the new
// bootstrap.php format, and wrap the callback in a Compat
// extender.
return [new Compat($extenders)];
return (array) require $bootstrapper;
} else {
return [];
}
})->map(function ($extender) {
// If an extension has not yet switched to the new bootstrap.php
// format, it might return a function (or more of them). We wrap
// these in a Compat extender to enjoy an unique interface.
if ($extender instanceof \Closure) {
return new Compat($extender);
} else {
return $extender;
}
});
}