Skip to content

Commit

Permalink
Apply fixes from StyleCI
Browse files Browse the repository at this point in the history
  • Loading branch information
StyleCIBot committed Aug 14, 2023
1 parent 0db8007 commit e49dd8c
Show file tree
Hide file tree
Showing 47 changed files with 129 additions and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
use Flarum\Http\RequestUtil;
use Illuminate\Contracts\Bus\Dispatcher;
use Illuminate\Http\Request;
use Illuminate\Support\Arr;

class DeleteFlagsController extends AbstractDeleteController
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
use Flarum\PackageManager\Command\RemoveExtension;
use Flarum\PackageManager\Job\Dispatcher;
use Illuminate\Http\Request;
use Illuminate\Support\Arr;
use Laminas\Diactoros\Response\EmptyResponse;
use Laminas\Diactoros\Response\JsonResponse;
use Psr\Http\Message\ResponseInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
use Flarum\PackageManager\Command\WhyNot;
use Flarum\PackageManager\Job\Dispatcher;
use Illuminate\Http\Request;
use Illuminate\Support\Arr;
use Laminas\Diactoros\Response\JsonResponse;
use Psr\Http\Message\ResponseInterface;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public function replying_to_a_discussion_with_comment_post_as_last_post_sends_re
],
],
],
]), fn (Request $request ) => $request->attributes->set('bypassThrottling', true))
]), fn (Request $request) => $request->attributes->set('bypassThrottling', true))
);
}

Expand Down
6 changes: 1 addition & 5 deletions framework/core/src/Admin/AdminServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,14 @@
use Flarum\Extension\Event\Enabled;
use Flarum\Foundation\AbstractServiceProvider;
use Flarum\Foundation\Config;
use Flarum\Foundation\ErrorHandling\Registry;
use Flarum\Foundation\ErrorHandling\Reporter;
use Flarum\Foundation\ErrorHandling\ViewFormatter;
use Flarum\Foundation\ErrorHandling\WhoopsFormatter;
use Flarum\Foundation\Event\ClearingCache;
use Flarum\Frontend\AddLocaleAssets;
use Flarum\Frontend\AddTranslations;
use Flarum\Frontend\Compiler\Source\SourceCollector;
use Flarum\Frontend\RecompileFrontendAssets;
use Flarum\Http\Middleware as HttpMiddleware;
use Flarum\Http\Router;
use Flarum\Http\RouteHandlerFactory;
use Flarum\Http\Router;
use Flarum\Locale\LocaleManager;
use Flarum\Settings\Event\Saved;
use Illuminate\Contracts\Container\Container;
Expand Down
4 changes: 1 addition & 3 deletions framework/core/src/Admin/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,15 @@

use Flarum\Admin\Content\Index;
use Flarum\Admin\Controller\UpdateExtensionController;
use Flarum\Http\Router;
use Flarum\Http\RouteHandlerFactory;
use Flarum\Http\Router;

return function (Router $router, RouteHandlerFactory $factory) {

$router
->get('/', $factory->toAdmin(Index::class))
->name('index');

$router
->post('/extensions/{name}', $factory->toController(UpdateExtensionController::class))
->name('extensions.update');

};
3 changes: 0 additions & 3 deletions framework/core/src/Api/ApiServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
use Flarum\Api\Serializer\NotificationSerializer;
use Flarum\Foundation\AbstractServiceProvider;
use Flarum\Foundation\Config;
use Flarum\Foundation\ErrorHandling\JsonApiFormatter;
use Flarum\Foundation\ErrorHandling\Registry;
use Flarum\Foundation\ErrorHandling\Reporter;
use Flarum\Http\Middleware as HttpMiddleware;
use Flarum\Http\RouteHandlerFactory;
use Flarum\Http\Router;
Expand Down
8 changes: 7 additions & 1 deletion framework/core/src/Api/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,13 @@ public function send(string $method, string $path): JsonResponse
$config = $this->container->make(Config::class);

$symfonyRequest = SymfonyRequest::create(
$config->path('api').$path, $method, $this->queryParams, $parent->cookies->all(), $parent->files->all(), $parent->server->all(), json_encode($this->body)
$config->path('api').$path,
$method,
$this->queryParams,
$parent->cookies->all(),
$parent->files->all(),
$parent->server->all(),
json_encode($this->body)
);

$request = Request::createFromBase($symfonyRequest);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
use Illuminate\Contracts\Session\Session;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Http\Request;
use Illuminate\Support\Arr;

class DeleteAccessTokenController extends AbstractDeleteController
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function __construct(
protected function data(Request $request, Document $document): mixed
{
return $this->bus->dispatch(
new DeleteAvatar($request->route( 'id'), RequestUtil::getActor($request))
new DeleteAvatar($request->route('id'), RequestUtil::getActor($request))

Check failure on line 31 in framework/core/src/Api/Controller/DeleteAvatarController.php

View workflow job for this annotation

GitHub Actions / run / PHPStan PHP 8.1

Parameter #1 $userId of class Flarum\User\Command\DeleteAvatar constructor expects int, object|string|null given.
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
use Flarum\Http\RequestUtil;
use Illuminate\Contracts\Bus\Dispatcher;
use Illuminate\Http\Request;
use Illuminate\Support\Arr;

class DeleteDiscussionController extends AbstractDeleteController
{
Expand Down
1 change: 0 additions & 1 deletion framework/core/src/Api/Controller/ListPostsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
use Flarum\Post\PostRepository;
use Flarum\Query\QueryCriteria;
use Illuminate\Http\Request;
use Illuminate\Support\Arr;
use Tobscure\JsonApi\Document;
use Tobscure\JsonApi\Exception\InvalidParameterException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
use Flarum\Http\Controller\AbstractController;
use Flarum\Http\RequestUtil;
use Illuminate\Http\Request;
use Illuminate\Support\Arr;
use Laminas\Diactoros\Response\EmptyResponse;
use Psr\Http\Message\ResponseInterface;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
use Flarum\Extension\ExtensionManager;
use Flarum\Http\RequestUtil;
use Illuminate\Http\Request;
use Illuminate\Support\Arr;
use Tobscure\JsonApi\Document;

class ShowExtensionReadmeController extends AbstractShowController
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
use Flarum\Extension\ExtensionManager;
use Flarum\Http\RequestUtil;
use Illuminate\Http\Request;
use Illuminate\Support\Arr;

class UninstallExtensionController extends AbstractDeleteController
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
use Flarum\Http\RequestUtil;
use Illuminate\Contracts\Bus\Dispatcher;
use Illuminate\Http\Request;
use Illuminate\Support\Arr;
use Tobscure\JsonApi\Document;

class UpdateGroupController extends AbstractShowController
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
use Flarum\Notification\Notification;
use Illuminate\Contracts\Bus\Dispatcher;
use Illuminate\Http\Request;
use Illuminate\Support\Arr;
use Tobscure\JsonApi\Document;

class UpdateNotificationController extends AbstractShowController
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
use Flarum\User\User;
use Illuminate\Contracts\Bus\Dispatcher;
use Illuminate\Http\Request;
use Illuminate\Support\Arr;
use Tobscure\JsonApi\Document;

class UploadAvatarController extends AbstractShowController
Expand Down
2 changes: 0 additions & 2 deletions framework/core/src/Api/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
use Flarum\Http\Router;

return function (Router $router, RouteHandlerFactory $factory) {

// Get forum information
$router
->get('/', $factory->toController(Controller\ShowForumController::class))
Expand Down Expand Up @@ -292,5 +291,4 @@
$router
->post('/mail/test', $factory->toController(Controller\SendTestMailController::class))
->name('mailTest');

};
7 changes: 7 additions & 0 deletions framework/core/src/Extend/Concerns/ExtendsRoutes.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
<?php

/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/

namespace Flarum\Extend\Concerns;

use Flarum\Foundation\Config;
Expand Down
1 change: 0 additions & 1 deletion framework/core/src/Forum/Content/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
use Flarum\Http\UrlGenerator;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Http\Request;
use Illuminate\Support\Arr;

class User
{
Expand Down
6 changes: 1 addition & 5 deletions framework/core/src/Forum/ForumServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@
use Flarum\Formatter\Formatter;
use Flarum\Foundation\AbstractServiceProvider;
use Flarum\Foundation\Config;
use Flarum\Foundation\ErrorHandling\Registry;
use Flarum\Foundation\ErrorHandling\Reporter;
use Flarum\Foundation\ErrorHandling\ViewFormatter;
use Flarum\Foundation\ErrorHandling\WhoopsFormatter;
use Flarum\Foundation\Event\ClearingCache;
use Flarum\Frontend\AddLocaleAssets;
use Flarum\Frontend\AddTranslations;
Expand Down Expand Up @@ -181,7 +177,7 @@ protected function setDefaultRoute(Router $router, SettingsRepositoryInterface $
/** @var \Illuminate\Routing\Route $route */
$route = $router->getRoutes()->getRoutesByMethod()['GET'][$defaultRoutePath] ?? null;

if (!$route) {
if (! $route) {
$route = $router->getRoutes()->getRoutesByMethod()['GET']['all'];
}

Expand Down
2 changes: 0 additions & 2 deletions framework/core/src/Forum/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
use Flarum\Http\Router;

return function (Router $router, RouteHandlerFactory $factory) {

$router
->get('/all', $factory->toForum(Content\Index::class))
->name('index');
Expand Down Expand Up @@ -68,5 +67,4 @@
$router
->post('/reset', $factory->toController(Controller\SavePasswordController::class))
->name('savePassword');

};
8 changes: 7 additions & 1 deletion framework/core/src/Foundation/Bootstrap/BootProviders.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
<?php

/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/

namespace Flarum\Foundation\Bootstrap;

use Flarum\Foundation\Bootstrap\IlluminateBootstrapperInterface;
use Flarum\Foundation\SafeBooter;
use Illuminate\Contracts\Foundation\Application;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
<?php

/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/

namespace Flarum\Foundation\Bootstrap;

use Illuminate\Contracts\Foundation\Application;
Expand Down
7 changes: 7 additions & 0 deletions framework/core/src/Foundation/Bootstrap/PrepareInstaller.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
<?php

/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/

namespace Flarum\Foundation\Bootstrap;

use Flarum\Foundation\ErrorServiceProvider;
Expand Down
7 changes: 7 additions & 0 deletions framework/core/src/Foundation/Bootstrap/RegisterCache.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
<?php

/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/

namespace Flarum\Foundation\Bootstrap;

use Illuminate\Cache\FileStore;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
<?php

/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/

namespace Flarum\Foundation\Bootstrap;

use Flarum\Admin\AdminServiceProvider;
use Flarum\Api\ApiServiceProvider;
use Flarum\Bus\BusServiceProvider;
use Flarum\Console\ConsoleServiceProvider;
use Flarum\Database\DatabaseServiceProvider;
use Flarum\Discussion\DiscussionServiceProvider;
use Flarum\Extension\ExtensionServiceProvider;
use Flarum\Filesystem\FilesystemServiceProvider;
use Flarum\Filter\FilterServiceProvider;
use Flarum\Formatter\FormatterServiceProvider;
use Flarum\Forum\ForumServiceProvider;
use Flarum\Foundation\ErrorServiceProvider;
use Flarum\Frontend\FrontendServiceProvider;
use Flarum\Group\GroupServiceProvider;
use Flarum\Http\HttpServiceProvider;
Expand All @@ -23,7 +28,6 @@
use Flarum\Post\PostServiceProvider;
use Flarum\Queue\QueueServiceProvider;
use Flarum\Search\SearchServiceProvider;
use Flarum\Settings\SettingsServiceProvider;
use Flarum\Update\UpdateServiceProvider;
use Flarum\User\SessionServiceProvider;
use Flarum\User\UserServiceProvider;
Expand Down
7 changes: 7 additions & 0 deletions framework/core/src/Foundation/Bootstrap/RegisterLogger.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
<?php

/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/

namespace Flarum\Foundation\Bootstrap;

use Illuminate\Contracts\Foundation\Application;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
<?php

/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/

namespace Flarum\Foundation\Bootstrap;

use Flarum\Foundation\MaintenanceModeHandler;
Expand Down
2 changes: 1 addition & 1 deletion framework/core/src/Foundation/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function inMaintenanceMode(): bool

public function path(string $frontend): string
{
return match(true) {
return match (true) {
isset($this->data['paths'][$frontend]) => $this->data['paths'][$frontend],
$frontend === 'forum' => '/',
default => $frontend,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ public function report(Throwable $e): void
public function render($request, Throwable $e): Response /** @phpstan-ignore-line */
{
return $this->resolveFormatter($request)->format(
$this->getHandledError($e), $request
$this->getHandledError($e),
$request
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
use Flarum\Settings\SettingsRepositoryInterface;
use Illuminate\Contracts\View\Factory as ViewFactory;
use Illuminate\Http\Request;
use Laminas\Diactoros\Response\HtmlResponse;
use Symfony\Component\HttpFoundation\Response;

/**
Expand Down
Loading

0 comments on commit e49dd8c

Please sign in to comment.