From 5399c86a1b722f78304dfb49a199f945ac06c9f8 Mon Sep 17 00:00:00 2001 From: StyleCI Bot Date: Tue, 9 Jan 2024 15:06:12 +0000 Subject: [PATCH] Apply fixes from StyleCI --- extensions/akismet/src/Akismet.php | 2 +- extensions/flags/src/AddCanFlagAttribute.php | 1 + .../src/Api/Serializer/FlagSerializer.php | 6 ++-- .../tags/src/Api/Serializer/TagSerializer.php | 26 +++++++-------- .../RetrievesRepresentativeTags.php | 2 +- .../Serializer/BasicDiscussionSerializer.php | 2 +- .../Api/Serializer/BasicPostSerializer.php | 4 +-- .../Api/Serializer/BasicUserSerializer.php | 6 ++-- .../Api/Serializer/CurrentUserSerializer.php | 14 ++++---- .../Api/Serializer/DiscussionSerializer.php | 18 +++++------ .../src/Api/Serializer/ForumSerializer.php | 2 +- .../src/Api/Serializer/GroupSerializer.php | 8 ++--- .../Api/Serializer/NotificationSerializer.php | 6 ++-- .../src/Api/Serializer/PostSerializer.php | 4 +-- .../src/Api/Serializer/UserSerializer.php | 14 ++++---- framework/core/src/Extension/Extension.php | 16 +++++----- .../Filesystem/FilesystemServiceProvider.php | 8 ++--- framework/core/src/Foundation/Application.php | 32 +++++++++---------- .../src/Frontend/FrontendServiceProvider.php | 6 ++-- framework/core/src/Install/DatabaseConfig.php | 20 ++++++------ .../core/src/Install/Steps/StoreConfig.php | 12 +++---- .../src/Notification/UnsubscribeToken.php | 2 +- .../integration/api/users/CreateTest.php | 18 +++++------ .../integration/extenders/FilesystemTest.php | 4 +-- .../testing/src/integration/TestCase.php | 1 + 25 files changed, 118 insertions(+), 116 deletions(-) diff --git a/extensions/akismet/src/Akismet.php b/extensions/akismet/src/Akismet.php index 0182144ec..cf6767e61 100644 --- a/extensions/akismet/src/Akismet.php +++ b/extensions/akismet/src/Akismet.php @@ -47,7 +47,7 @@ class Akismet $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 83731dd37..1e1e6793c 100644 --- a/extensions/flags/src/AddCanFlagAttribute.php +++ b/extensions/flags/src/AddCanFlagAttribute.php @@ -32,6 +32,7 @@ class AddCanFlagAttribute // 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 c1d76354d..83e8e7d3c 100644 --- a/extensions/flags/src/Api/Serializer/FlagSerializer.php +++ b/extensions/flags/src/Api/Serializer/FlagSerializer.php @@ -29,10 +29,10 @@ class FlagSerializer extends AbstractSerializer } return [ - 'type' => $model->type, - 'reason' => $model->reason, + 'type' => $model->type, + 'reason' => $model->reason, 'reasonDetail' => $model->reason_detail, - 'createdAt' => $this->formatDate($model->created_at), + 'createdAt' => $this->formatDate($model->created_at), ]; } diff --git a/extensions/tags/src/Api/Serializer/TagSerializer.php b/extensions/tags/src/Api/Serializer/TagSerializer.php index bb6e0aba1..f3f14bce1 100644 --- a/extensions/tags/src/Api/Serializer/TagSerializer.php +++ b/extensions/tags/src/Api/Serializer/TagSerializer.php @@ -34,19 +34,19 @@ class TagSerializer extends AbstractSerializer } $attributes = [ - 'name' => $model->name, - 'description' => $model->description, - 'slug' => $this->slugManager->forResource(Tag::class)->toSlug($model), - 'color' => $model->color, - 'backgroundUrl' => $model->background_path, - 'backgroundMode' => $model->background_mode, - 'icon' => $model->icon, - 'discussionCount' => (int) $model->discussion_count, - 'position' => $model->position === null ? null : (int) $model->position, - 'defaultSort' => $model->default_sort, - 'isChild' => (bool) $model->parent_id, - 'isHidden' => (bool) $model->is_hidden, - 'lastPostedAt' => $this->formatDate($model->last_posted_at), + 'name' => $model->name, + 'description' => $model->description, + 'slug' => $this->slugManager->forResource(Tag::class)->toSlug($model), + 'color' => $model->color, + 'backgroundUrl' => $model->background_path, + 'backgroundMode' => $model->background_mode, + 'icon' => $model->icon, + 'discussionCount' => (int) $model->discussion_count, + 'position' => $model->position === null ? null : (int) $model->position, + 'defaultSort' => $model->default_sort, + 'isChild' => (bool) $model->parent_id, + 'isHidden' => (bool) $model->is_hidden, + 'lastPostedAt' => $this->formatDate($model->last_posted_at), 'canStartDiscussion' => $this->actor->can('startDiscussion', $model), 'canAddToDiscussion' => $this->actor->can('addToDiscussion', $model) ]; diff --git a/extensions/tags/tests/integration/RetrievesRepresentativeTags.php b/extensions/tags/tests/integration/RetrievesRepresentativeTags.php index 2eafbd111..778ab040f 100644 --- a/extensions/tags/tests/integration/RetrievesRepresentativeTags.php +++ b/extensions/tags/tests/integration/RetrievesRepresentativeTags.php @@ -27,7 +27,7 @@ trait RetrievesRepresentativeTags ['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 f1f58ce17..7260f09df 100644 --- a/framework/core/src/Api/Serializer/BasicDiscussionSerializer.php +++ b/framework/core/src/Api/Serializer/BasicDiscussionSerializer.php @@ -36,7 +36,7 @@ class BasicDiscussionSerializer extends AbstractSerializer return [ 'title' => $model->title, - 'slug' => $this->slugManager->forResource(Discussion::class)->toSlug($model), + 'slug' => $this->slugManager->forResource(Discussion::class)->toSlug($model), ]; } diff --git a/framework/core/src/Api/Serializer/BasicPostSerializer.php b/framework/core/src/Api/Serializer/BasicPostSerializer.php index 25502ff87..8193e2e24 100644 --- a/framework/core/src/Api/Serializer/BasicPostSerializer.php +++ b/framework/core/src/Api/Serializer/BasicPostSerializer.php @@ -39,8 +39,8 @@ class BasicPostSerializer extends AbstractSerializer } $attributes = [ - 'number' => (int) $model->number, - 'createdAt' => $this->formatDate($model->created_at), + 'number' => (int) $model->number, + 'createdAt' => $this->formatDate($model->created_at), 'contentType' => $model->type ]; diff --git a/framework/core/src/Api/Serializer/BasicUserSerializer.php b/framework/core/src/Api/Serializer/BasicUserSerializer.php index a7aef27a7..0c23b9f47 100644 --- a/framework/core/src/Api/Serializer/BasicUserSerializer.php +++ b/framework/core/src/Api/Serializer/BasicUserSerializer.php @@ -35,10 +35,10 @@ class BasicUserSerializer extends AbstractSerializer } return [ - 'username' => $model->username, + 'username' => $model->username, 'displayName' => $model->display_name, - 'avatarUrl' => $model->avatar_url, - 'slug' => $this->slugManager->forResource(User::class)->toSlug($model) + 'avatarUrl' => $model->avatar_url, + 'slug' => $this->slugManager->forResource(User::class)->toSlug($model) ]; } diff --git a/framework/core/src/Api/Serializer/CurrentUserSerializer.php b/framework/core/src/Api/Serializer/CurrentUserSerializer.php index 608260959..b98bf7875 100644 --- a/framework/core/src/Api/Serializer/CurrentUserSerializer.php +++ b/framework/core/src/Api/Serializer/CurrentUserSerializer.php @@ -25,13 +25,13 @@ class CurrentUserSerializer extends UserSerializer $attributes = parent::getDefaultAttributes($model); $attributes += [ - 'isEmailConfirmed' => (bool) $model->is_email_confirmed, - 'email' => $model->email, - 'markedAllAsReadAt' => $this->formatDate($model->marked_all_as_read_at), - 'unreadNotificationCount' => (int) $model->getUnreadNotificationCount(), - 'newNotificationCount' => (int) $model->getNewNotificationCount(), - 'preferences' => (array) $model->preferences, - 'isAdmin' => $model->isAdmin(), + 'isEmailConfirmed' => (bool) $model->is_email_confirmed, + 'email' => $model->email, + 'markedAllAsReadAt' => $this->formatDate($model->marked_all_as_read_at), + 'unreadNotificationCount' => (int) $model->getUnreadNotificationCount(), + 'newNotificationCount' => (int) $model->getNewNotificationCount(), + 'preferences' => (array) $model->preferences, + 'isAdmin' => $model->isAdmin(), ]; return $attributes; diff --git a/framework/core/src/Api/Serializer/DiscussionSerializer.php b/framework/core/src/Api/Serializer/DiscussionSerializer.php index a4274e71d..705324015 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(object|array $model): array { $attributes = parent::getDefaultAttributes($model) + [ - 'commentCount' => (int) $model->comment_count, - 'participantCount' => (int) $model->participant_count, - 'createdAt' => $this->formatDate($model->created_at), - 'lastPostedAt' => $this->formatDate($model->last_posted_at), - 'lastPostNumber' => (int) $model->last_post_number, - 'canReply' => $this->actor->can('reply', $model), - 'canRename' => $this->actor->can('rename', $model), - 'canDelete' => $this->actor->can('delete', $model), - 'canHide' => $this->actor->can('hide', $model) + 'commentCount' => (int) $model->comment_count, + 'participantCount' => (int) $model->participant_count, + 'createdAt' => $this->formatDate($model->created_at), + 'lastPostedAt' => $this->formatDate($model->last_posted_at), + 'lastPostNumber' => (int) $model->last_post_number, + 'canReply' => $this->actor->can('reply', $model), + 'canRename' => $this->actor->can('rename', $model), + 'canDelete' => $this->actor->can('delete', $model), + 'canHide' => $this->actor->can('hide', $model) ]; if ($model->hidden_at) { diff --git a/framework/core/src/Api/Serializer/ForumSerializer.php b/framework/core/src/Api/Serializer/ForumSerializer.php index 1453578a0..06489a8c2 100644 --- a/framework/core/src/Api/Serializer/ForumSerializer.php +++ b/framework/core/src/Api/Serializer/ForumSerializer.php @@ -83,7 +83,7 @@ class ForumSerializer extends AbstractSerializer '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 4a27d33b4..529304d4b 100644 --- a/framework/core/src/Api/Serializer/GroupSerializer.php +++ b/framework/core/src/Api/Serializer/GroupSerializer.php @@ -35,10 +35,10 @@ class GroupSerializer extends AbstractSerializer return [ 'nameSingular' => $this->translateGroupName($model->name_singular), - 'namePlural' => $this->translateGroupName($model->name_plural), - 'color' => $model->color, - 'icon' => $model->icon, - 'isHidden' => $model->is_hidden + 'namePlural' => $this->translateGroupName($model->name_plural), + 'color' => $model->color, + 'icon' => $model->icon, + 'isHidden' => $model->is_hidden ]; } diff --git a/framework/core/src/Api/Serializer/NotificationSerializer.php b/framework/core/src/Api/Serializer/NotificationSerializer.php index 9726a5001..70bf2288e 100644 --- a/framework/core/src/Api/Serializer/NotificationSerializer.php +++ b/framework/core/src/Api/Serializer/NotificationSerializer.php @@ -36,9 +36,9 @@ class NotificationSerializer extends AbstractSerializer return [ 'contentType' => $model->type, - 'content' => $model->data, - 'createdAt' => $this->formatDate($model->created_at), - 'isRead' => (bool) $model->read_at + 'content' => $model->data, + 'createdAt' => $this->formatDate($model->created_at), + 'isRead' => (bool) $model->read_at ]; } diff --git a/framework/core/src/Api/Serializer/PostSerializer.php b/framework/core/src/Api/Serializer/PostSerializer.php index 79a80d5c4..7bf965c51 100644 --- a/framework/core/src/Api/Serializer/PostSerializer.php +++ b/framework/core/src/Api/Serializer/PostSerializer.php @@ -47,9 +47,9 @@ class PostSerializer extends BasicPostSerializer } $attributes += [ - 'canEdit' => $canEdit, + 'canEdit' => $canEdit, 'canDelete' => $this->actor->can('delete', $model), - 'canHide' => $this->actor->can('hide', $model) + 'canHide' => $this->actor->can('hide', $model) ]; return $attributes; diff --git a/framework/core/src/Api/Serializer/UserSerializer.php b/framework/core/src/Api/Serializer/UserSerializer.php index 353514d4d..28647f27e 100644 --- a/framework/core/src/Api/Serializer/UserSerializer.php +++ b/framework/core/src/Api/Serializer/UserSerializer.php @@ -21,13 +21,13 @@ class UserSerializer extends BasicUserSerializer $attributes = parent::getDefaultAttributes($model); $attributes += [ - 'joinTime' => $this->formatDate($model->joined_at), - 'discussionCount' => (int) $model->discussion_count, - 'commentCount' => (int) $model->comment_count, - 'canEdit' => $this->actor->can('edit', $model), + 'joinTime' => $this->formatDate($model->joined_at), + 'discussionCount' => (int) $model->discussion_count, + 'commentCount' => (int) $model->comment_count, + 'canEdit' => $this->actor->can('edit', $model), 'canEditCredentials' => $this->actor->can('editCredentials', $model), - 'canEditGroups' => $this->actor->can('editGroups', $model), - 'canDelete' => $this->actor->can('delete', $model), + 'canEditGroups' => $this->actor->can('editGroups', $model), + 'canDelete' => $this->actor->can('delete', $model), ]; if ($model->getPreference('discloseOnline') || $this->actor->can('viewLastSeenAt', $model)) { @@ -39,7 +39,7 @@ class UserSerializer extends BasicUserSerializer if ($attributes['canEditCredentials'] || $this->actor->id === $model->id) { $attributes += [ 'isEmailConfirmed' => (bool) $model->is_email_confirmed, - 'email' => $model->email + 'email' => $model->email ]; } diff --git a/framework/core/src/Extension/Extension.php b/framework/core/src/Extension/Extension.php index 786c61bbf..a7c87b8f8 100644 --- a/framework/core/src/Extension/Extension.php +++ b/framework/core/src/Extension/Extension.php @@ -453,15 +453,15 @@ class Extension implements Arrayable public function toArray(): array { 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 31273ef95..dd7bd9116 100644 --- a/framework/core/src/Filesystem/FilesystemServiceProvider.php +++ b/framework/core/src/Filesystem/FilesystemServiceProvider.php @@ -34,15 +34,15 @@ class FilesystemServiceProvider extends AbstractServiceProvider 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'), 'visibility' => Visibility::PUBLIC ]; }, '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/Foundation/Application.php b/framework/core/src/Foundation/Application.php index dece4954c..f99f80359 100644 --- a/framework/core/src/Foundation/Application.php +++ b/framework/core/src/Foundation/Application.php @@ -199,22 +199,22 @@ class Application extends IlluminateContainer implements LaravelApplication public function registerCoreContainerAliases(): void { $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 => $aliasGroup) { diff --git a/framework/core/src/Frontend/FrontendServiceProvider.php b/framework/core/src/Frontend/FrontendServiceProvider.php index c72452e2a..f21b44bb8 100644 --- a/framework/core/src/Frontend/FrontendServiceProvider.php +++ b/framework/core/src/Frontend/FrontendServiceProvider.php @@ -142,19 +142,19 @@ class FrontendServiceProvider extends AbstractServiceProvider $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 49a5ee141..b0d46134c 100644 --- a/framework/core/src/Install/DatabaseConfig.php +++ b/framework/core/src/Install/DatabaseConfig.php @@ -28,17 +28,17 @@ class DatabaseConfig implements Arrayable public function toArray(): array { 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 f6ec0fc9f..596482b04 100644 --- a/framework/core/src/Install/Steps/StoreConfig.php +++ b/framework/core/src/Install/Steps/StoreConfig.php @@ -44,12 +44,12 @@ class StoreConfig implements ReversibleStep private function buildConfig(): array { 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', ] ]; @@ -58,7 +58,7 @@ class StoreConfig implements ReversibleStep private function getPathsConfig(): array { return [ - 'api' => 'api', + 'api' => 'api', 'admin' => 'admin', ]; } diff --git a/framework/core/src/Notification/UnsubscribeToken.php b/framework/core/src/Notification/UnsubscribeToken.php index a35f2aab8..035025e10 100644 --- a/framework/core/src/Notification/UnsubscribeToken.php +++ b/framework/core/src/Notification/UnsubscribeToken.php @@ -30,7 +30,7 @@ class UnsubscribeToken extends AbstractModel protected $table = 'unsubscribe_tokens'; protected $casts = [ - 'user_id' => 'int', + 'user_id' => 'int', 'unsubscribed_at' => 'datetime' ]; diff --git a/framework/core/tests/integration/api/users/CreateTest.php b/framework/core/tests/integration/api/users/CreateTest.php index 92789763d..c3894fc0e 100644 --- a/framework/core/tests/integration/api/users/CreateTest.php +++ b/framework/core/tests/integration/api/users/CreateTest.php @@ -186,7 +186,7 @@ class CreateTest extends TestCase '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 @@ class CreateTest extends TestCase '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://i_do_not_exist.flarum.org/image.png' + 'avatar_url' => 'https://i_do_not_exist.flarum.org/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 @@ class CreateTest extends TestCase '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 fb532119e..d0f7b51f6 100644 --- a/framework/core/tests/integration/extenders/FilesystemTest.php +++ b/framework/core/tests/integration/extenders/FilesystemTest.php @@ -44,7 +44,7 @@ class FilesystemTest extends TestCase $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') ]; })); @@ -148,7 +148,7 @@ class UploadsDisk { 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 4c773e262..8cd464034 100644 --- a/php-packages/testing/src/integration/TestCase.php +++ b/php-packages/testing/src/integration/TestCase.php @@ -170,6 +170,7 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase protected function database(): ConnectionInterface { $this->app(); + // Set in `BeginTransactionAndSetDatabase` extender. return $this->database; }