1
0
mirror of https://github.com/flarum/core.git synced 2025-10-14 00:15:51 +02:00

Fix Callables for Extenders (#2423)

- Standardize signatures and variable names for extenders that take callbacks
- Adjust model extender docblock to clarify that default calue can't be an invokable class.
- Make invokable classes provided to Model->relationship
- Add integration tests to ensure Model->relationship and User->groupProcessor extenders accept callbacks
- Extract code for wrapping callbacks into central util
This commit is contained in:
Alexander Skvortsov
2020-11-08 21:36:38 -05:00
committed by GitHub
parent c10cc92deb
commit 47d2eee9ce
10 changed files with 108 additions and 39 deletions

View File

@@ -11,6 +11,7 @@ namespace Flarum\User;
use Flarum\Event\ConfigureUserPreferences;
use Flarum\Foundation\AbstractServiceProvider;
use Flarum\Foundation\ContainerUtil;
use Flarum\Settings\SettingsRepositoryInterface;
use Flarum\User\DisplayName\DriverInterface;
use Flarum\User\DisplayName\UsernameDriver;
@@ -77,11 +78,7 @@ class UserServiceProvider extends AbstractServiceProvider
public function boot()
{
foreach ($this->app->make('flarum.user.group_processors') as $callback) {
if (is_string($callback)) {
$callback = $this->app->make($callback);
}
User::addGroupProcessor($callback);
User::addGroupProcessor(ContainerUtil::wrapCallback($callback, $this->app));
}
User::setHasher($this->app->make('hash'));