mirror of
https://github.com/flarum/core.git
synced 2025-07-25 02:31:17 +02:00
Re-introduce Compat extender
Turns out Container::call() does not work with invokable classes. Thus, we need to wrap callables in a custom extender class to support injecting any resolvable type-hint automatically. Refs #851.
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
namespace Flarum\Extension;
|
||||
|
||||
use Flarum\Database\Migrator;
|
||||
use Flarum\Extend\Compat;
|
||||
use Flarum\Extension\Event\Disabled;
|
||||
use Flarum\Extension\Event\Disabling;
|
||||
use Flarum\Extension\Event\Enabled;
|
||||
@@ -285,7 +286,14 @@ class ExtensionManager
|
||||
if ($this->filesystem->exists($bootstrapper)) {
|
||||
$extenders = require $bootstrapper;
|
||||
|
||||
return (array) $extenders;
|
||||
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 {
|
||||
return [];
|
||||
}
|
||||
|
Reference in New Issue
Block a user