Convert closures in arrays to Compat extenders as well

Refs #851.
This commit is contained in:
Franz Liedke 2018-01-21 22:38:06 +01:00
parent fa14be591c
commit 4b1a299b3c
No known key found for this signature in database
GPG Key ID: 9A0231A879B055F4

View File

@ -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;
}
});
}