diff --git a/extensions/akismet/src/Akismet.php b/extensions/akismet/src/Akismet.php index a4edef634b..a0ba43f6f8 100644 --- a/extensions/akismet/src/Akismet.php +++ b/extensions/akismet/src/Akismet.php @@ -50,7 +50,7 @@ protected function sendRequest(string $type): ResponseInterface $client = new Client(); return $client->request('POST', "$this->apiUrl/$type", [ - 'headers' => [ + 'headers' => [ 'User-Agent' => "Flarum/$this->flarumVersion | Akismet/$this->extensionVersion", ], 'form_params' => $this->params, diff --git a/extensions/flags/src/AddCanFlagAttribute.php b/extensions/flags/src/AddCanFlagAttribute.php index da354daa20..54a7e62b09 100644 --- a/extensions/flags/src/AddCanFlagAttribute.php +++ b/extensions/flags/src/AddCanFlagAttribute.php @@ -40,6 +40,7 @@ protected function checkFlagOwnPostSetting(User $actor, Post $post): bool // If $actor is the post author, check to see if the setting is enabled return (bool) $this->settings->get('flarum-flags.can_flag_own'); } + // $actor is not the post author return true; } diff --git a/extensions/flags/src/Api/Serializer/FlagSerializer.php b/extensions/flags/src/Api/Serializer/FlagSerializer.php index f307e3d7a3..4e9202bac2 100644 --- a/extensions/flags/src/Api/Serializer/FlagSerializer.php +++ b/extensions/flags/src/Api/Serializer/FlagSerializer.php @@ -31,10 +31,10 @@ protected function getDefaultAttributes($flag) } return [ - 'type' => $flag->type, - 'reason' => $flag->reason, + 'type' => $flag->type, + 'reason' => $flag->reason, 'reasonDetail' => $flag->reason_detail, - 'createdAt' => $this->formatDate($flag->created_at), + 'createdAt' => $this->formatDate($flag->created_at), ]; } diff --git a/extensions/mentions/tests/integration/api/PostMentionsTest.php b/extensions/mentions/tests/integration/api/PostMentionsTest.php index 6a21e71b90..25af7f255d 100644 --- a/extensions/mentions/tests/integration/api/PostMentionsTest.php +++ b/extensions/mentions/tests/integration/api/PostMentionsTest.php @@ -12,8 +12,8 @@ use Carbon\Carbon; use Flarum\Extend; use Flarum\Formatter\Formatter; -use Flarum\Post\Post; use Flarum\Post\CommentPost; +use Flarum\Post\Post; use Flarum\Testing\integration\RetrievesAuthorizedUsers; use Flarum\Testing\integration\TestCase; use Flarum\User\DisplayName\DriverInterface; @@ -574,7 +574,6 @@ public function rendering_post_mention_without_a_context_works() $this->assertStringContainsString('TOBY$', $renderedHtml); } - } class CustomOtherDisplayNameDriver implements DriverInterface diff --git a/extensions/package-manager/migrations/2024_01_10_000000_rename_to_extension_manager.php b/extensions/package-manager/migrations/2024_01_10_000000_rename_to_extension_manager.php index 64f223467f..17879dc0f9 100644 --- a/extensions/package-manager/migrations/2024_01_10_000000_rename_to_extension_manager.php +++ b/extensions/package-manager/migrations/2024_01_10_000000_rename_to_extension_manager.php @@ -1,5 +1,12 @@ paths->base); if ($safeMode) { - $temporaryVendorDir = $this->paths->base . DIRECTORY_SEPARATOR . 'temp-vendor'; + $temporaryVendorDir = $this->paths->base.DIRECTORY_SEPARATOR.'temp-vendor'; if (! $this->filesystem->isDirectory($temporaryVendorDir)) { $this->filesystem->makeDirectory($temporaryVendorDir); } diff --git a/extensions/package-manager/src/Composer/ComposerJson.php b/extensions/package-manager/src/Composer/ComposerJson.php index 8e5738cf18..528ddcd4ec 100644 --- a/extensions/package-manager/src/Composer/ComposerJson.php +++ b/extensions/package-manager/src/Composer/ComposerJson.php @@ -10,8 +10,8 @@ namespace Flarum\ExtensionManager\Composer; use Flarum\Extension\ExtensionManager; -use Flarum\Foundation\Paths; use Flarum\ExtensionManager\Support\Util; +use Flarum\Foundation\Paths; use Illuminate\Filesystem\Filesystem; use Illuminate\Support\Str; diff --git a/extensions/package-manager/src/ExtensionManagerServiceProvider.php b/extensions/package-manager/src/ExtensionManagerServiceProvider.php index 6af99178c5..dd78693d74 100755 --- a/extensions/package-manager/src/ExtensionManagerServiceProvider.php +++ b/extensions/package-manager/src/ExtensionManagerServiceProvider.php @@ -13,15 +13,15 @@ use Composer\Console\Application; use Composer\Util\Platform; use Flarum\Extension\ExtensionManager; -use Flarum\Foundation\AbstractServiceProvider; -use Flarum\Foundation\Paths; -use Flarum\Frontend\RecompileFrontendAssets; -use Flarum\Locale\LocaleManager; use Flarum\ExtensionManager\Composer\ComposerAdapter; use Flarum\ExtensionManager\Event\FlarumUpdated; use Flarum\ExtensionManager\Extension\Event\Updated; use Flarum\ExtensionManager\Listener\ClearCacheAfterUpdate; use Flarum\ExtensionManager\Listener\ReCheckForUpdates; +use Flarum\Foundation\AbstractServiceProvider; +use Flarum\Foundation\Paths; +use Flarum\Frontend\RecompileFrontendAssets; +use Flarum\Locale\LocaleManager; use Illuminate\Contracts\Container\Container; use Illuminate\Contracts\Events\Dispatcher; use Illuminate\Filesystem\Filesystem; diff --git a/extensions/package-manager/src/Listener/ClearCacheAfterUpdate.php b/extensions/package-manager/src/Listener/ClearCacheAfterUpdate.php index 5f4575af9a..99b6d231fe 100644 --- a/extensions/package-manager/src/Listener/ClearCacheAfterUpdate.php +++ b/extensions/package-manager/src/Listener/ClearCacheAfterUpdate.php @@ -11,8 +11,8 @@ use Composer\Command\ClearCacheCommand; use Flarum\Database\Console\MigrateCommand; -use Flarum\Foundation\Console\AssetsPublishCommand; use Flarum\ExtensionManager\Event\FlarumUpdated; +use Flarum\Foundation\Console\AssetsPublishCommand; use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Output\NullOutput; diff --git a/extensions/package-manager/tests/integration/TestCase.php b/extensions/package-manager/tests/integration/TestCase.php index 07a03f9843..9da5731c29 100644 --- a/extensions/package-manager/tests/integration/TestCase.php +++ b/extensions/package-manager/tests/integration/TestCase.php @@ -9,10 +9,10 @@ namespace Flarum\ExtensionManager\Tests\integration; -use Flarum\Foundation\Paths; use Flarum\ExtensionManager\Composer\ComposerAdapter; use Flarum\ExtensionManager\Composer\ComposerJson; use Flarum\ExtensionManager\Support\Util; +use Flarum\Foundation\Paths; use Flarum\Testing\integration\RetrievesAuthorizedUsers; use Illuminate\Support\Arr; use Psr\Http\Message\ResponseInterface; diff --git a/extensions/tags/src/Api/Serializer/TagSerializer.php b/extensions/tags/src/Api/Serializer/TagSerializer.php index a989061cb6..a1d686d11e 100644 --- a/extensions/tags/src/Api/Serializer/TagSerializer.php +++ b/extensions/tags/src/Api/Serializer/TagSerializer.php @@ -47,19 +47,19 @@ protected function getDefaultAttributes($tag) } $attributes = [ - 'name' => $tag->name, - 'description' => $tag->description, - 'slug' => $this->slugManager->forResource(Tag::class)->toSlug($tag), - 'color' => $tag->color, - 'backgroundUrl' => $tag->background_path, - 'backgroundMode' => $tag->background_mode, - 'icon' => $tag->icon, - 'discussionCount' => (int) $tag->discussion_count, - 'position' => $tag->position === null ? null : (int) $tag->position, - 'defaultSort' => $tag->default_sort, - 'isChild' => (bool) $tag->parent_id, - 'isHidden' => (bool) $tag->is_hidden, - 'lastPostedAt' => $this->formatDate($tag->last_posted_at), + 'name' => $tag->name, + 'description' => $tag->description, + 'slug' => $this->slugManager->forResource(Tag::class)->toSlug($tag), + 'color' => $tag->color, + 'backgroundUrl' => $tag->background_path, + 'backgroundMode' => $tag->background_mode, + 'icon' => $tag->icon, + 'discussionCount' => (int) $tag->discussion_count, + 'position' => $tag->position === null ? null : (int) $tag->position, + 'defaultSort' => $tag->default_sort, + 'isChild' => (bool) $tag->parent_id, + 'isHidden' => (bool) $tag->is_hidden, + 'lastPostedAt' => $this->formatDate($tag->last_posted_at), 'canStartDiscussion' => $this->actor->can('startDiscussion', $tag), 'canAddToDiscussion' => $this->actor->can('addToDiscussion', $tag) ]; diff --git a/extensions/tags/tests/integration/RetrievesRepresentativeTags.php b/extensions/tags/tests/integration/RetrievesRepresentativeTags.php index 2eafbd111c..778ab040f9 100644 --- a/extensions/tags/tests/integration/RetrievesRepresentativeTags.php +++ b/extensions/tags/tests/integration/RetrievesRepresentativeTags.php @@ -27,7 +27,7 @@ protected function tags() ['id' => 11, 'name' => 'Secondary Restricted', 'slug' => 'secondary-restricted', 'position' => null, 'parent_id' => null, 'is_restricted' => true], ['id' => 12, 'name' => 'Primary Restricted 2', 'slug' => 'primary-2-restricted', 'position' => 100, 'parent_id' => null, 'is_restricted' => true], ['id' => 13, 'name' => 'Primary Restricted 2 Child 1', 'slug' => 'primary-2-restricted-child-1', 'position' => 101, 'parent_id' => 12], - ['id' => 14, 'name' => 'Primary Restricted 3', 'slug' => 'primary-3-restricted', 'position' => 102, 'parent_id' =>null, 'is_restricted' => true], + ['id' => 14, 'name' => 'Primary Restricted 3', 'slug' => 'primary-3-restricted', 'position' => 102, 'parent_id' => null, 'is_restricted' => true], ]; } } diff --git a/framework/core/src/Api/Serializer/BasicDiscussionSerializer.php b/framework/core/src/Api/Serializer/BasicDiscussionSerializer.php index 64bbca7529..f713793acc 100644 --- a/framework/core/src/Api/Serializer/BasicDiscussionSerializer.php +++ b/framework/core/src/Api/Serializer/BasicDiscussionSerializer.php @@ -46,7 +46,7 @@ protected function getDefaultAttributes($discussion) return [ 'title' => $discussion->title, - 'slug' => $this->slugManager->forResource(Discussion::class)->toSlug($discussion), + 'slug' => $this->slugManager->forResource(Discussion::class)->toSlug($discussion), ]; } diff --git a/framework/core/src/Api/Serializer/BasicPostSerializer.php b/framework/core/src/Api/Serializer/BasicPostSerializer.php index 55f04533a4..f0453e4544 100644 --- a/framework/core/src/Api/Serializer/BasicPostSerializer.php +++ b/framework/core/src/Api/Serializer/BasicPostSerializer.php @@ -53,8 +53,8 @@ protected function getDefaultAttributes($post) } $attributes = [ - 'number' => (int) $post->number, - 'createdAt' => $this->formatDate($post->created_at), + 'number' => (int) $post->number, + 'createdAt' => $this->formatDate($post->created_at), 'contentType' => $post->type ]; diff --git a/framework/core/src/Api/Serializer/BasicUserSerializer.php b/framework/core/src/Api/Serializer/BasicUserSerializer.php index e024d338d6..ccd7dc6d78 100644 --- a/framework/core/src/Api/Serializer/BasicUserSerializer.php +++ b/framework/core/src/Api/Serializer/BasicUserSerializer.php @@ -45,10 +45,10 @@ protected function getDefaultAttributes($user) } return [ - 'username' => $user->username, + 'username' => $user->username, 'displayName' => $user->display_name, - 'avatarUrl' => $user->avatar_url, - 'slug' => $this->slugManager->forResource(User::class)->toSlug($user) + 'avatarUrl' => $user->avatar_url, + 'slug' => $this->slugManager->forResource(User::class)->toSlug($user) ]; } diff --git a/framework/core/src/Api/Serializer/CurrentUserSerializer.php b/framework/core/src/Api/Serializer/CurrentUserSerializer.php index 24a9417a7d..6a65772be0 100644 --- a/framework/core/src/Api/Serializer/CurrentUserSerializer.php +++ b/framework/core/src/Api/Serializer/CurrentUserSerializer.php @@ -20,13 +20,13 @@ protected function getDefaultAttributes($user) $attributes = parent::getDefaultAttributes($user); $attributes += [ - 'isEmailConfirmed' => (bool) $user->is_email_confirmed, - 'email' => $user->email, - 'markedAllAsReadAt' => $this->formatDate($user->marked_all_as_read_at), - 'unreadNotificationCount' => (int) $user->getUnreadNotificationCount(), - 'newNotificationCount' => (int) $user->getNewNotificationCount(), - 'preferences' => (array) $user->preferences, - 'isAdmin' => $user->isAdmin(), + 'isEmailConfirmed' => (bool) $user->is_email_confirmed, + 'email' => $user->email, + 'markedAllAsReadAt' => $this->formatDate($user->marked_all_as_read_at), + 'unreadNotificationCount' => (int) $user->getUnreadNotificationCount(), + 'newNotificationCount' => (int) $user->getNewNotificationCount(), + 'preferences' => (array) $user->preferences, + 'isAdmin' => $user->isAdmin(), ]; return $attributes; diff --git a/framework/core/src/Api/Serializer/DiscussionSerializer.php b/framework/core/src/Api/Serializer/DiscussionSerializer.php index c12670d29d..43bacae780 100644 --- a/framework/core/src/Api/Serializer/DiscussionSerializer.php +++ b/framework/core/src/Api/Serializer/DiscussionSerializer.php @@ -19,15 +19,15 @@ class DiscussionSerializer extends BasicDiscussionSerializer protected function getDefaultAttributes($discussion) { $attributes = parent::getDefaultAttributes($discussion) + [ - 'commentCount' => (int) $discussion->comment_count, - 'participantCount' => (int) $discussion->participant_count, - 'createdAt' => $this->formatDate($discussion->created_at), - 'lastPostedAt' => $this->formatDate($discussion->last_posted_at), - 'lastPostNumber' => (int) $discussion->last_post_number, - 'canReply' => $this->actor->can('reply', $discussion), - 'canRename' => $this->actor->can('rename', $discussion), - 'canDelete' => $this->actor->can('delete', $discussion), - 'canHide' => $this->actor->can('hide', $discussion) + 'commentCount' => (int) $discussion->comment_count, + 'participantCount' => (int) $discussion->participant_count, + 'createdAt' => $this->formatDate($discussion->created_at), + 'lastPostedAt' => $this->formatDate($discussion->last_posted_at), + 'lastPostNumber' => (int) $discussion->last_post_number, + 'canReply' => $this->actor->can('reply', $discussion), + 'canRename' => $this->actor->can('rename', $discussion), + 'canDelete' => $this->actor->can('delete', $discussion), + 'canHide' => $this->actor->can('hide', $discussion) ]; if ($discussion->hidden_at) { diff --git a/framework/core/src/Api/Serializer/ForumSerializer.php b/framework/core/src/Api/Serializer/ForumSerializer.php index 3e40dd58e3..878862303e 100644 --- a/framework/core/src/Api/Serializer/ForumSerializer.php +++ b/framework/core/src/Api/Serializer/ForumSerializer.php @@ -89,7 +89,7 @@ protected function getDefaultAttributes($model): array 'headerHtml' => $this->settings->get('custom_header'), 'footerHtml' => $this->settings->get('custom_footer'), 'allowSignUp' => (bool) $this->settings->get('allow_sign_up'), - 'defaultRoute' => $this->settings->get('default_route'), + 'defaultRoute' => $this->settings->get('default_route'), 'canViewForum' => $this->actor->can('viewForum'), 'canStartDiscussion' => $this->actor->can('startDiscussion'), 'canSearchUsers' => $this->actor->can('searchUsers'), diff --git a/framework/core/src/Api/Serializer/GroupSerializer.php b/framework/core/src/Api/Serializer/GroupSerializer.php index cac9cb5786..2b067d9bef 100644 --- a/framework/core/src/Api/Serializer/GroupSerializer.php +++ b/framework/core/src/Api/Serializer/GroupSerializer.php @@ -49,10 +49,10 @@ protected function getDefaultAttributes($group) return [ 'nameSingular' => $this->translateGroupName($group->name_singular), - 'namePlural' => $this->translateGroupName($group->name_plural), - 'color' => $group->color, - 'icon' => $group->icon, - 'isHidden' => $group->is_hidden + 'namePlural' => $this->translateGroupName($group->name_plural), + 'color' => $group->color, + 'icon' => $group->icon, + 'isHidden' => $group->is_hidden ]; } diff --git a/framework/core/src/Api/Serializer/NotificationSerializer.php b/framework/core/src/Api/Serializer/NotificationSerializer.php index 9a7bdfc8ab..319dded62f 100644 --- a/framework/core/src/Api/Serializer/NotificationSerializer.php +++ b/framework/core/src/Api/Serializer/NotificationSerializer.php @@ -43,9 +43,9 @@ protected function getDefaultAttributes($notification) return [ 'contentType' => $notification->type, - 'content' => $notification->data, - 'createdAt' => $this->formatDate($notification->created_at), - 'isRead' => (bool) $notification->read_at + 'content' => $notification->data, + 'createdAt' => $this->formatDate($notification->created_at), + 'isRead' => (bool) $notification->read_at ]; } diff --git a/framework/core/src/Api/Serializer/PostSerializer.php b/framework/core/src/Api/Serializer/PostSerializer.php index 325c2d781c..74455697f5 100644 --- a/framework/core/src/Api/Serializer/PostSerializer.php +++ b/framework/core/src/Api/Serializer/PostSerializer.php @@ -45,9 +45,9 @@ protected function getDefaultAttributes($post) } $attributes += [ - 'canEdit' => $canEdit, + 'canEdit' => $canEdit, 'canDelete' => $this->actor->can('delete', $post), - 'canHide' => $this->actor->can('hide', $post) + 'canHide' => $this->actor->can('hide', $post) ]; return $attributes; diff --git a/framework/core/src/Api/Serializer/UserSerializer.php b/framework/core/src/Api/Serializer/UserSerializer.php index 9f9d3fc97d..cb2fdf1f6c 100644 --- a/framework/core/src/Api/Serializer/UserSerializer.php +++ b/framework/core/src/Api/Serializer/UserSerializer.php @@ -20,13 +20,13 @@ protected function getDefaultAttributes($user) $attributes = parent::getDefaultAttributes($user); $attributes += [ - 'joinTime' => $this->formatDate($user->joined_at), - 'discussionCount' => (int) $user->discussion_count, - 'commentCount' => (int) $user->comment_count, - 'canEdit' => $this->actor->can('edit', $user), + 'joinTime' => $this->formatDate($user->joined_at), + 'discussionCount' => (int) $user->discussion_count, + 'commentCount' => (int) $user->comment_count, + 'canEdit' => $this->actor->can('edit', $user), 'canEditCredentials' => $this->actor->can('editCredentials', $user), - 'canEditGroups' => $this->actor->can('editGroups', $user), - 'canDelete' => $this->actor->can('delete', $user), + 'canEditGroups' => $this->actor->can('editGroups', $user), + 'canDelete' => $this->actor->can('delete', $user), ]; if ($user->getPreference('discloseOnline') || $this->actor->can('viewLastSeenAt', $user)) { @@ -38,7 +38,7 @@ protected function getDefaultAttributes($user) if ($attributes['canEditCredentials'] || $this->actor->id === $user->id) { $attributes += [ 'isEmailConfirmed' => (bool) $user->is_email_confirmed, - 'email' => $user->email + 'email' => $user->email ]; } diff --git a/framework/core/src/Extension/Extension.php b/framework/core/src/Extension/Extension.php index 6971ecb184..8cccbd3007 100644 --- a/framework/core/src/Extension/Extension.php +++ b/framework/core/src/Extension/Extension.php @@ -510,15 +510,15 @@ public function migrate(Migrator $migrator, $direction = 'up') public function toArray() { return (array) array_merge([ - 'id' => $this->getId(), - 'version' => $this->getVersion(), - 'path' => $this->getPath(), - 'icon' => $this->getIcon(), - 'hasAssets' => $this->hasAssets(), - 'hasMigrations' => $this->hasMigrations(), + 'id' => $this->getId(), + 'version' => $this->getVersion(), + 'path' => $this->getPath(), + 'icon' => $this->getIcon(), + 'hasAssets' => $this->hasAssets(), + 'hasMigrations' => $this->hasMigrations(), 'extensionDependencyIds' => $this->getExtensionDependencyIds(), - 'optionalDependencyIds' => $this->getOptionalDependencyIds(), - 'links' => $this->getLinks(), + 'optionalDependencyIds' => $this->getOptionalDependencyIds(), + 'links' => $this->getLinks(), ], $this->composerJson); } diff --git a/framework/core/src/Filesystem/FilesystemServiceProvider.php b/framework/core/src/Filesystem/FilesystemServiceProvider.php index 0c3d2cb5b8..b05f394eed 100644 --- a/framework/core/src/Filesystem/FilesystemServiceProvider.php +++ b/framework/core/src/Filesystem/FilesystemServiceProvider.php @@ -36,14 +36,14 @@ public function register() return [ 'flarum-assets' => function (Paths $paths, UrlGenerator $url) { return [ - 'root' => "$paths->public/assets", - 'url' => $url->to('forum')->path('assets') + 'root' => "$paths->public/assets", + 'url' => $url->to('forum')->path('assets') ]; }, 'flarum-avatars' => function (Paths $paths, UrlGenerator $url) { return [ - 'root' => "$paths->public/assets/avatars", - 'url' => $url->to('forum')->path('assets/avatars') + 'root' => "$paths->public/assets/avatars", + 'url' => $url->to('forum')->path('assets/avatars') ]; }, ]; diff --git a/framework/core/src/Forum/Controller/LogOutController.php b/framework/core/src/Forum/Controller/LogOutController.php index 9f3ab2c0d9..b38bded626 100644 --- a/framework/core/src/Forum/Controller/LogOutController.php +++ b/framework/core/src/Forum/Controller/LogOutController.php @@ -107,7 +107,7 @@ public function handle(Request $request): ResponseInterface if (Arr::get($request->getQueryParams(), 'token') !== $csrfToken) { $view = $this->view->make('flarum.forum::log-out') - ->with('url', $this->url->to('forum')->route('logout') . '?token=' . $csrfToken . ($returnUrl ? '&return=' . urlencode($return) : '')); + ->with('url', $this->url->to('forum')->route('logout').'?token='.$csrfToken.($returnUrl ? '&return='.urlencode($return) : '')); return new HtmlResponse($view->render()); } diff --git a/framework/core/src/Foundation/Application.php b/framework/core/src/Foundation/Application.php index 9a766f2ab2..32731dbefd 100644 --- a/framework/core/src/Foundation/Application.php +++ b/framework/core/src/Foundation/Application.php @@ -336,22 +336,22 @@ protected function fireAppCallbacks(array $callbacks) public function registerCoreContainerAliases() { $aliases = [ - 'app' => [\Illuminate\Contracts\Container\Container::class, \Illuminate\Contracts\Foundation\Application::class, \Psr\Container\ContainerInterface::class], - 'blade.compiler' => [\Illuminate\View\Compilers\BladeCompiler::class], - 'cache' => [\Illuminate\Cache\CacheManager::class, \Illuminate\Contracts\Cache\Factory::class], - 'cache.store' => [\Illuminate\Cache\Repository::class, \Illuminate\Contracts\Cache\Repository::class], - 'config' => [\Illuminate\Config\Repository::class, \Illuminate\Contracts\Config\Repository::class], - 'db' => [\Illuminate\Database\DatabaseManager::class], - 'db.connection' => [\Illuminate\Database\Connection::class, \Illuminate\Database\ConnectionInterface::class], - 'events' => [\Illuminate\Events\Dispatcher::class, \Illuminate\Contracts\Events\Dispatcher::class], - 'files' => [\Illuminate\Filesystem\Filesystem::class], - 'filesystem' => [\Illuminate\Filesystem\FilesystemManager::class, \Illuminate\Contracts\Filesystem\Factory::class], - 'filesystem.disk' => [\Illuminate\Contracts\Filesystem\Filesystem::class], - 'filesystem.cloud' => [\Illuminate\Contracts\Filesystem\Cloud::class], - 'hash' => [\Illuminate\Contracts\Hashing\Hasher::class], - 'mailer' => [\Illuminate\Mail\Mailer::class, \Illuminate\Contracts\Mail\Mailer::class, \Illuminate\Contracts\Mail\MailQueue::class], - 'validator' => [\Illuminate\Validation\Factory::class, \Illuminate\Contracts\Validation\Factory::class], - 'view' => [\Illuminate\View\Factory::class, \Illuminate\Contracts\View\Factory::class], + 'app' => [\Illuminate\Contracts\Container\Container::class, \Illuminate\Contracts\Foundation\Application::class, \Psr\Container\ContainerInterface::class], + 'blade.compiler' => [\Illuminate\View\Compilers\BladeCompiler::class], + 'cache' => [\Illuminate\Cache\CacheManager::class, \Illuminate\Contracts\Cache\Factory::class], + 'cache.store' => [\Illuminate\Cache\Repository::class, \Illuminate\Contracts\Cache\Repository::class], + 'config' => [\Illuminate\Config\Repository::class, \Illuminate\Contracts\Config\Repository::class], + 'db' => [\Illuminate\Database\DatabaseManager::class], + 'db.connection' => [\Illuminate\Database\Connection::class, \Illuminate\Database\ConnectionInterface::class], + 'events' => [\Illuminate\Events\Dispatcher::class, \Illuminate\Contracts\Events\Dispatcher::class], + 'files' => [\Illuminate\Filesystem\Filesystem::class], + 'filesystem' => [\Illuminate\Filesystem\FilesystemManager::class, \Illuminate\Contracts\Filesystem\Factory::class], + 'filesystem.disk' => [\Illuminate\Contracts\Filesystem\Filesystem::class], + 'filesystem.cloud' => [\Illuminate\Contracts\Filesystem\Cloud::class], + 'hash' => [\Illuminate\Contracts\Hashing\Hasher::class], + 'mailer' => [\Illuminate\Mail\Mailer::class, \Illuminate\Contracts\Mail\Mailer::class, \Illuminate\Contracts\Mail\MailQueue::class], + 'validator' => [\Illuminate\Validation\Factory::class, \Illuminate\Contracts\Validation\Factory::class], + 'view' => [\Illuminate\View\Factory::class, \Illuminate\Contracts\View\Factory::class], ]; foreach ($aliases as $key => $aliases) { diff --git a/framework/core/src/Frontend/FrontendServiceProvider.php b/framework/core/src/Frontend/FrontendServiceProvider.php index bcb5a11bd9..77a11f8c19 100644 --- a/framework/core/src/Frontend/FrontendServiceProvider.php +++ b/framework/core/src/Frontend/FrontendServiceProvider.php @@ -136,19 +136,19 @@ function (Container $container) { $this->container->singleton('flarum.less.config', function (Container $container) { return [ - 'config-primary-color' => [ + 'config-primary-color' => [ 'key' => 'theme_primary_color', ], 'config-secondary-color' => [ 'key' => 'theme_secondary_color', ], - 'config-dark-mode' => [ + 'config-dark-mode' => [ 'key' => 'theme_dark_mode', 'callback' => function ($value) { return $value ? 'true' : 'false'; }, ], - 'config-colored-header' => [ + 'config-colored-header' => [ 'key' => 'theme_colored_header', 'callback' => function ($value) { return $value ? 'true' : 'false'; diff --git a/framework/core/src/Install/DatabaseConfig.php b/framework/core/src/Install/DatabaseConfig.php index df6dcd1fa0..2671f85a3f 100644 --- a/framework/core/src/Install/DatabaseConfig.php +++ b/framework/core/src/Install/DatabaseConfig.php @@ -37,17 +37,17 @@ public function __construct($driver, $host, $port, $database, $username, $passwo public function toArray() { return [ - 'driver' => $this->driver, - 'host' => $this->host, - 'port' => $this->port, - 'database' => $this->database, - 'username' => $this->username, - 'password' => $this->password, - 'charset' => 'utf8mb4', + 'driver' => $this->driver, + 'host' => $this->host, + 'port' => $this->port, + 'database' => $this->database, + 'username' => $this->username, + 'password' => $this->password, + 'charset' => 'utf8mb4', 'collation' => 'utf8mb4_unicode_ci', - 'prefix' => $this->prefix, - 'strict' => false, - 'engine' => 'InnoDB', + 'prefix' => $this->prefix, + 'strict' => false, + 'engine' => 'InnoDB', 'prefix_indexes' => true ]; } diff --git a/framework/core/src/Install/Steps/StoreConfig.php b/framework/core/src/Install/Steps/StoreConfig.php index e878e6013c..2565d1f4b1 100644 --- a/framework/core/src/Install/Steps/StoreConfig.php +++ b/framework/core/src/Install/Steps/StoreConfig.php @@ -53,12 +53,12 @@ public function revert() private function buildConfig() { return [ - 'debug' => $this->debugMode, + 'debug' => $this->debugMode, 'database' => $this->dbConfig->toArray(), - 'url' => (string) $this->baseUrl, - 'paths' => $this->getPathsConfig(), - 'headers' => [ - 'poweredByHeader' => true, + 'url' => (string) $this->baseUrl, + 'paths' => $this->getPathsConfig(), + 'headers' => [ + 'poweredByHeader' => true, 'referrerPolicy' => 'same-origin', ] ]; @@ -67,7 +67,7 @@ private function buildConfig() private function getPathsConfig() { return [ - 'api' => 'api', + 'api' => 'api', 'admin' => 'admin', ]; } diff --git a/framework/core/tests/integration/api/users/CreateTest.php b/framework/core/tests/integration/api/users/CreateTest.php index 8c04292918..4e667c4f29 100644 --- a/framework/core/tests/integration/api/users/CreateTest.php +++ b/framework/core/tests/integration/api/users/CreateTest.php @@ -186,7 +186,7 @@ public function cannot_create_user_with_invalid_avatar_uri_scheme() 'username' => 'test', 'email' => 'test@machine.local', 'is_email_confirmed' => 1, - 'avatar_url' => 'file://localhost/etc/passwd' + 'avatar_url' => 'file://localhost/etc/passwd' ], []), 'scheme' => 'file' ]; @@ -251,28 +251,28 @@ public function cannot_create_user_with_invalid_avatar_uri() 'username' => 'test', 'email' => 'test@machine.local', 'is_email_confirmed' => 1, - 'avatar_url' => 'https://127.0.0.1/image.png' + 'avatar_url' => 'https://127.0.0.1/image.png' ], []); $regTokens[] = RegistrationToken::generate('flarum', '1', [ 'username' => 'test', 'email' => 'test@machine.local', 'is_email_confirmed' => 1, - 'avatar_url' => 'https://192.168.0.1/image.png' + 'avatar_url' => 'https://192.168.0.1/image.png' ], []); $regTokens[] = RegistrationToken::generate('flarum', '1', [ 'username' => 'test', 'email' => 'test@machine.local', 'is_email_confirmed' => 1, - 'avatar_url' => '../image.png' + 'avatar_url' => '../image.png' ], []); $regTokens[] = RegistrationToken::generate('flarum', '1', [ 'username' => 'test', 'email' => 'test@machine.local', 'is_email_confirmed' => 1, - 'avatar_url' => 'image.png' + 'avatar_url' => 'image.png' ], []); // Test each reg token @@ -325,28 +325,28 @@ public function can_create_user_with_valid_avatar_uri() 'username' => 'test1', 'email' => 'test1@machine.local', 'is_email_confirmed' => 1, - 'avatar_url' => 'https://raw.githubusercontent.com/flarum/framework/main/framework/core/tests/fixtures/assets/avatar.png' + 'avatar_url' => 'https://raw.githubusercontent.com/flarum/framework/main/framework/core/tests/fixtures/assets/avatar.png' ], []); $regTokens[] = RegistrationToken::generate('flarum', '2', [ 'username' => 'test2', 'email' => 'test2@machine.local', 'is_email_confirmed' => 1, - 'avatar_url' => 'https://raw.githubusercontent.com/flarum/framework/main/framework/core/tests/fixtures/assets/avatar.jpg' + 'avatar_url' => 'https://raw.githubusercontent.com/flarum/framework/main/framework/core/tests/fixtures/assets/avatar.jpg' ], []); $regTokens[] = RegistrationToken::generate('flarum', '3', [ 'username' => 'test3', 'email' => 'test3@machine.local', 'is_email_confirmed' => 1, - 'avatar_url' => 'https://raw.githubusercontent.com/flarum/framework/main/framework/core/tests/fixtures/assets/avatar.gif' + 'avatar_url' => 'https://raw.githubusercontent.com/flarum/framework/main/framework/core/tests/fixtures/assets/avatar.gif' ], []); $regTokens[] = RegistrationToken::generate('flarum', '4', [ 'username' => 'test4', 'email' => 'test4@machine.local', 'is_email_confirmed' => 1, - 'avatar_url' => 'http://raw.githubusercontent.com/flarum/framework/main/framework/core/tests/fixtures/assets/avatar.png' + 'avatar_url' => 'http://raw.githubusercontent.com/flarum/framework/main/framework/core/tests/fixtures/assets/avatar.png' ], []); /** diff --git a/framework/core/tests/integration/extenders/FilesystemTest.php b/framework/core/tests/integration/extenders/FilesystemTest.php index 3edcaf4bf7..82bcee444c 100644 --- a/framework/core/tests/integration/extenders/FilesystemTest.php +++ b/framework/core/tests/integration/extenders/FilesystemTest.php @@ -45,7 +45,7 @@ public function custom_disk_exists_if_added_and_uses_local_adapter_by_default() $this->extend((new Extend\Filesystem)->disk('flarum-uploads', function (Paths $paths, UrlGenerator $url) { return [ 'root' => "$paths->public/assets/uploads", - 'url' => $url->to('forum')->path('assets/uploads') + 'url' => $url->to('forum')->path('assets/uploads') ]; })); @@ -137,7 +137,7 @@ public function __invoke(Paths $paths, UrlGenerator $url) { return [ 'root' => "$paths->public/assets/uploads", - 'url' => $url->to('forum')->path('assets/uploads') + 'url' => $url->to('forum')->path('assets/uploads') ]; } } diff --git a/php-packages/testing/src/integration/TestCase.php b/php-packages/testing/src/integration/TestCase.php index fa26609710..3c50f37c73 100644 --- a/php-packages/testing/src/integration/TestCase.php +++ b/php-packages/testing/src/integration/TestCase.php @@ -192,6 +192,7 @@ protected function server(): RequestHandlerInterface protected function database(): ConnectionInterface { $this->app(); + // Set in `BeginTransactionAndSetDatabase` extender. return $this->database; }