1
0
mirror of https://github.com/flarum/core.git synced 2025-06-27 05:04:51 +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) { ->flatMap(function (Extension $extension) {
$bootstrapper = $extension->getBootstrapperPath(); $bootstrapper = $extension->getBootstrapperPath();
if ($this->filesystem->exists($bootstrapper)) { if ($this->filesystem->exists($bootstrapper)) {
$extenders = require $bootstrapper; return (array) 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)];
} else { } else {
return []; 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;
}
}); });
} }