From 363c4fd49f87de5acda9a32b1a69c041e5d2a128 Mon Sep 17 00:00:00 2001 From: Matthew Penner Date: Wed, 14 Dec 2022 17:06:28 -0700 Subject: [PATCH] php-cs-fixer --- app/Exceptions/Handler.php | 2 +- app/Http/Controllers/Api/Client/ClientApiController.php | 1 - app/Services/Eggs/Sharing/EggUpdateImporterService.php | 2 +- app/Transformers/Api/Client/ServerTransformer.php | 2 -- app/Transformers/Api/Client/UserTransformer.php | 1 - app/Transformers/Api/Transformer.php | 8 +++----- tests/Traits/Http/MocksMiddlewareClosure.php | 2 +- 7 files changed, 6 insertions(+), 12 deletions(-) diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 4cfee8e46..6fd1b5d8e 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -233,7 +233,7 @@ final class Handler extends ExceptionHandler /** * Return an array of exceptions that should not be reported. */ - public static function isReportable(Exception $exception): bool + public static function isReportable(\Exception $exception): bool { return (new static(Container::getInstance()))->shouldReport($exception); } diff --git a/app/Http/Controllers/Api/Client/ClientApiController.php b/app/Http/Controllers/Api/Client/ClientApiController.php index 380cbf548..12a09cb04 100644 --- a/app/Http/Controllers/Api/Client/ClientApiController.php +++ b/app/Http/Controllers/Api/Client/ClientApiController.php @@ -2,7 +2,6 @@ namespace Pterodactyl\Http\Controllers\Api\Client; -use Webmozart\Assert\Assert; use Pterodactyl\Transformers\Api\Transformer; use Pterodactyl\Http\Controllers\Api\Application\ApplicationApiController; diff --git a/app/Services/Eggs/Sharing/EggUpdateImporterService.php b/app/Services/Eggs/Sharing/EggUpdateImporterService.php index ad17a16f0..d428ce8f4 100644 --- a/app/Services/Eggs/Sharing/EggUpdateImporterService.php +++ b/app/Services/Eggs/Sharing/EggUpdateImporterService.php @@ -8,8 +8,8 @@ use Illuminate\Support\Collection; use Pterodactyl\Models\EggVariable; use Illuminate\Database\ConnectionInterface; use Pterodactyl\Services\Eggs\EggParserService; -use Pterodactyl\Exceptions\Service\InvalidFileUploadException; use Pterodactyl\Exceptions\Service\Egg\BadJsonFormatException; +use Pterodactyl\Exceptions\Service\InvalidFileUploadException; class EggUpdateImporterService { diff --git a/app/Transformers/Api/Client/ServerTransformer.php b/app/Transformers/Api/Client/ServerTransformer.php index 782e6b435..401c34905 100644 --- a/app/Transformers/Api/Client/ServerTransformer.php +++ b/app/Transformers/Api/Client/ServerTransformer.php @@ -4,12 +4,10 @@ namespace Pterodactyl\Transformers\Api\Client; use Pterodactyl\Models\Egg; use Pterodactyl\Models\Server; -use Pterodactyl\Models\Subuser; use League\Fractal\Resource\Item; use Pterodactyl\Models\Allocation; use Pterodactyl\Models\Permission; use Illuminate\Container\Container; -use Pterodactyl\Models\EggVariable; use League\Fractal\Resource\Collection; use League\Fractal\Resource\NullResource; use Pterodactyl\Transformers\Api\Transformer; diff --git a/app/Transformers/Api/Client/UserTransformer.php b/app/Transformers/Api/Client/UserTransformer.php index b6275c3c1..7a2f07754 100644 --- a/app/Transformers/Api/Client/UserTransformer.php +++ b/app/Transformers/Api/Client/UserTransformer.php @@ -2,7 +2,6 @@ namespace Pterodactyl\Transformers\Api\Client; -use Illuminate\Support\Str; use Pterodactyl\Models\User; use Pterodactyl\Transformers\Api\Transformer; diff --git a/app/Transformers/Api/Transformer.php b/app/Transformers/Api/Transformer.php index 8b7e013bb..89051d77f 100644 --- a/app/Transformers/Api/Transformer.php +++ b/app/Transformers/Api/Transformer.php @@ -2,8 +2,6 @@ namespace Pterodactyl\Transformers\Api; -use Closure; -use DateTimeInterface; use Carbon\CarbonImmutable; use Carbon\CarbonInterface; use Illuminate\Http\Request; @@ -70,7 +68,7 @@ abstract class Transformer extends TransformerAbstract */ protected function item($data, $transformer, ?string $resourceKey = null): Item { - if (!$transformer instanceof Closure) { + if (!$transformer instanceof \Closure) { self::assertSameNamespace($transformer); } @@ -91,7 +89,7 @@ abstract class Transformer extends TransformerAbstract */ protected function collection($data, $transformer, ?string $resourceKey = null): Collection { - if (!$transformer instanceof Closure) { + if (!$transformer instanceof \Closure) { self::assertSameNamespace($transformer); } @@ -145,7 +143,7 @@ abstract class Transformer extends TransformerAbstract return null; } - if ($timestamp instanceof DateTimeInterface) { + if ($timestamp instanceof \DateTimeInterface) { $value = CarbonImmutable::instance($timestamp); } else { $value = CarbonImmutable::createFromFormat(CarbonInterface::DEFAULT_TO_STRING_FORMAT, $timestamp); diff --git a/tests/Traits/Http/MocksMiddlewareClosure.php b/tests/Traits/Http/MocksMiddlewareClosure.php index 3519238bb..9cbe315bd 100644 --- a/tests/Traits/Http/MocksMiddlewareClosure.php +++ b/tests/Traits/Http/MocksMiddlewareClosure.php @@ -11,7 +11,7 @@ trait MocksMiddlewareClosure * Provide a closure to be used when validating that the response from the middleware * is the same request object we passed into it. */ - protected function getClosureAssertions(): Closure + protected function getClosureAssertions(): \Closure { if (is_null($this->request)) { throw new \BadFunctionCallException('Calling getClosureAssertions without defining a request object is not supported.');