diff --git a/src/Extend/Assets.php b/src/Extend/Assets.php index 6fb52dbd7..b09654aba 100644 --- a/src/Extend/Assets.php +++ b/src/Extend/Assets.php @@ -15,7 +15,7 @@ use Flarum\Frontend\Event\Rendering; use Illuminate\Contracts\Container\Container; use Illuminate\Events\Dispatcher; -class Assets implements Extender +class Assets { protected $appName; @@ -49,7 +49,7 @@ class Assets implements Extender return $this; } - public function apply(Container $container) + public function __invoke(Container $container) { $container->make(Dispatcher::class)->listen( Rendering::class, diff --git a/src/Extend/Compat.php b/src/Extend/Compat.php index 3678f2a84..469729b5b 100644 --- a/src/Extend/Compat.php +++ b/src/Extend/Compat.php @@ -22,7 +22,7 @@ use Illuminate\Contracts\Container\Container; * * @deprecated */ -class Compat implements Extender +class Compat { protected $callback; @@ -31,7 +31,7 @@ class Compat implements Extender $this->callback = $callback; } - public function apply(Container $container) + public function __invoke(Container $container) { $container->call($this->callback); } diff --git a/src/Extend/Extender.php b/src/Extend/Extender.php deleted file mode 100644 index 71274391e..000000000 --- a/src/Extend/Extender.php +++ /dev/null @@ -1,19 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Flarum\Extend; - -use Illuminate\Contracts\Container\Container; - -interface Extender -{ - public function apply(Container $container); -} diff --git a/src/Extend/FormatterConfiguration.php b/src/Extend/FormatterConfiguration.php index 1608a35fd..ad6ca0ab7 100644 --- a/src/Extend/FormatterConfiguration.php +++ b/src/Extend/FormatterConfiguration.php @@ -15,7 +15,7 @@ use Flarum\Formatter\Event\Configuring; use Illuminate\Contracts\Container\Container; use Illuminate\Events\Dispatcher; -class FormatterConfiguration implements Extender +class FormatterConfiguration { protected $callback; @@ -24,7 +24,7 @@ class FormatterConfiguration implements Extender $this->callback = $callback; } - public function apply(Container $container) + public function __invoke(Container $container) { $container->make(Dispatcher::class)->listen( Configuring::class, diff --git a/src/Extend/Locale.php b/src/Extend/Locale.php index 08e126b41..916e9da88 100644 --- a/src/Extend/Locale.php +++ b/src/Extend/Locale.php @@ -16,7 +16,7 @@ use Flarum\Locale\LocaleManager; use Illuminate\Contracts\Container\Container; use RuntimeException; -class Locale implements Extender +class Locale { protected $directory; @@ -25,7 +25,7 @@ class Locale implements Extender $this->directory = $directory; } - public function apply(Container $container) + public function __invoke(Container $container) { $this->loadLanguagePackFrom( $this->directory, diff --git a/src/Extend/Routes.php b/src/Extend/Routes.php index c8dda4255..c02ff92eb 100644 --- a/src/Extend/Routes.php +++ b/src/Extend/Routes.php @@ -14,7 +14,7 @@ namespace Flarum\Extend; use Flarum\Http\RouteHandlerFactory; use Illuminate\Contracts\Container\Container; -class Routes implements Extender +class Routes { protected $appName; @@ -62,7 +62,7 @@ class Routes implements Extender return $this; } - public function apply(Container $container) + public function __invoke(Container $container) { if (empty($this->routes)) { return; diff --git a/src/Extension/ExtensionServiceProvider.php b/src/Extension/ExtensionServiceProvider.php index 78b8be201..2e484bfbc 100644 --- a/src/Extension/ExtensionServiceProvider.php +++ b/src/Extension/ExtensionServiceProvider.php @@ -24,11 +24,11 @@ class ExtensionServiceProvider extends AbstractServiceProvider $this->app->bind('flarum.extensions', ExtensionManager::class); $this->app->booting(function (Container $app) { - /** @var \Flarum\Extend\Extender[] $extenders */ + /** @var callable[] $extenders */ $extenders = $app->make('flarum.extensions')->getActiveExtenders(); foreach ($extenders as $extender) { - $extender->apply($app); + $app->call($extender); } }); }