From 8da397b18386844de68128c881c198c42cc80749 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Fri, 18 Nov 2022 14:20:56 +0100 Subject: [PATCH] Fix PHP Codestyle --- .../files/acp/database/update_com.woltlab.wcf_6.0.php | 2 +- wcfsetup/install/files/lib/form/SettingsForm.class.php | 2 +- .../http/middleware/EnforceAcpAuthentication.class.php | 1 - .../install/files/lib/http/middleware/JsonBody.class.php | 1 - .../lib/http/middleware/TriggerBackgroundQueue.class.php | 1 + wcfsetup/install/files/lib/http/middleware/Xsrf.class.php | 3 ++- .../system/background/BackgroundQueueHandler.class.php | 1 + .../lib/system/cronjob/DailyCleanUpCronjob.class.php | 1 - .../install/files/lib/system/database/Database.class.php | 1 - .../install/files/lib/system/event/EventHandler.class.php | 8 ++++---- .../preload/command/CachePreloadPhrases.class.php | 1 + .../package/PackageInstallationDispatcher.class.php | 2 +- .../system/upload/AvatarUploadFileSaveStrategy.class.php | 4 ++-- 13 files changed, 14 insertions(+), 14 deletions(-) diff --git a/wcfsetup/install/files/acp/database/update_com.woltlab.wcf_6.0.php b/wcfsetup/install/files/acp/database/update_com.woltlab.wcf_6.0.php index ec00c3feb4..e094ef8583 100644 --- a/wcfsetup/install/files/acp/database/update_com.woltlab.wcf_6.0.php +++ b/wcfsetup/install/files/acp/database/update_com.woltlab.wcf_6.0.php @@ -34,7 +34,7 @@ return [ VarcharDatabaseTableColumn::create('locale') ->notNull() ->length(50) - ->defaultValue('') + ->defaultValue(''), ]), PartialDatabaseTable::create('wcf1_package_installation_node') ->columns([ diff --git a/wcfsetup/install/files/lib/form/SettingsForm.class.php b/wcfsetup/install/files/lib/form/SettingsForm.class.php index 012eb4ca65..9acf398d35 100644 --- a/wcfsetup/install/files/lib/form/SettingsForm.class.php +++ b/wcfsetup/install/files/lib/form/SettingsForm.class.php @@ -297,7 +297,7 @@ class SettingsForm extends AbstractForm 'formAction' => LinkHandler::getInstance()->getControllerLink( static::class, $formActionParameters - ) + ), ]); // static options diff --git a/wcfsetup/install/files/lib/http/middleware/EnforceAcpAuthentication.class.php b/wcfsetup/install/files/lib/http/middleware/EnforceAcpAuthentication.class.php index 306ecfdd9a..cb7ce6b09a 100644 --- a/wcfsetup/install/files/lib/http/middleware/EnforceAcpAuthentication.class.php +++ b/wcfsetup/install/files/lib/http/middleware/EnforceAcpAuthentication.class.php @@ -14,7 +14,6 @@ use wcf\acp\form\MultifactorAuthenticationForm; use wcf\acp\form\ReauthenticationForm; use wcf\http\Helper; use wcf\system\exception\AJAXException; -use wcf\system\exception\NamedUserException; use wcf\system\request\LinkHandler; use wcf\system\request\RequestHandler; use wcf\system\user\multifactor\TMultifactorRequirementEnforcer; diff --git a/wcfsetup/install/files/lib/http/middleware/JsonBody.class.php b/wcfsetup/install/files/lib/http/middleware/JsonBody.class.php index 61a2a31ec6..70243aa440 100644 --- a/wcfsetup/install/files/lib/http/middleware/JsonBody.class.php +++ b/wcfsetup/install/files/lib/http/middleware/JsonBody.class.php @@ -3,7 +3,6 @@ namespace wcf\http\middleware; use GuzzleHttp\Psr7\Header; -use Laminas\Diactoros\Response\JsonResponse; use Laminas\Diactoros\Response\TextResponse; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; diff --git a/wcfsetup/install/files/lib/http/middleware/TriggerBackgroundQueue.class.php b/wcfsetup/install/files/lib/http/middleware/TriggerBackgroundQueue.class.php index 3f84f9c103..7cb584b55b 100644 --- a/wcfsetup/install/files/lib/http/middleware/TriggerBackgroundQueue.class.php +++ b/wcfsetup/install/files/lib/http/middleware/TriggerBackgroundQueue.class.php @@ -23,6 +23,7 @@ use wcf\system\request\RequestHandler; final class TriggerBackgroundQueue implements MiddlewareInterface { private readonly BackgroundQueueHandler $backgroundQueueHandler; + private readonly RequestHandler $requestHandler; public function __construct() diff --git a/wcfsetup/install/files/lib/http/middleware/Xsrf.class.php b/wcfsetup/install/files/lib/http/middleware/Xsrf.class.php index c4813ce2a3..9c4da2d17a 100644 --- a/wcfsetup/install/files/lib/http/middleware/Xsrf.class.php +++ b/wcfsetup/install/files/lib/http/middleware/Xsrf.class.php @@ -63,7 +63,8 @@ final class Xsrf implements MiddlewareInterface return $handler->handle($request); } - private function isSafeHttpMethod(string $verb): bool { + private function isSafeHttpMethod(string $verb): bool + { // HTTP requests using the 'GET' or 'HEAD' verb are safe // by design, because those should not alter the state. return $verb === 'GET' || $verb === 'HEAD'; diff --git a/wcfsetup/install/files/lib/system/background/BackgroundQueueHandler.class.php b/wcfsetup/install/files/lib/system/background/BackgroundQueueHandler.class.php index b0e363ea8d..9ec92ee260 100644 --- a/wcfsetup/install/files/lib/system/background/BackgroundQueueHandler.class.php +++ b/wcfsetup/install/files/lib/system/background/BackgroundQueueHandler.class.php @@ -21,6 +21,7 @@ use wcf\system\WCF; final class BackgroundQueueHandler extends SingletonFactory { public const FORCE_CHECK_HTTP_HEADER_NAME = 'woltlab-background-queue-check'; + public const FORCE_CHECK_HTTP_HEADER_VALUE = 'yes'; private bool $hasPendingCheck = false; diff --git a/wcfsetup/install/files/lib/system/cronjob/DailyCleanUpCronjob.class.php b/wcfsetup/install/files/lib/system/cronjob/DailyCleanUpCronjob.class.php index 413d21e6ae..2fe9e74fe3 100644 --- a/wcfsetup/install/files/lib/system/cronjob/DailyCleanUpCronjob.class.php +++ b/wcfsetup/install/files/lib/system/cronjob/DailyCleanUpCronjob.class.php @@ -4,7 +4,6 @@ namespace wcf\system\cronjob; use wcf\data\cronjob\Cronjob; use wcf\data\email\log\entry\EmailLogEntryAction; -use wcf\data\object\type\ObjectTypeCache; use wcf\system\flood\FloodControl; use wcf\system\user\multifactor\EmailMultifactorMethod; use wcf\system\visitTracker\VisitTracker; diff --git a/wcfsetup/install/files/lib/system/database/Database.class.php b/wcfsetup/install/files/lib/system/database/Database.class.php index f3175bf12b..3699718adb 100644 --- a/wcfsetup/install/files/lib/system/database/Database.class.php +++ b/wcfsetup/install/files/lib/system/database/Database.class.php @@ -2,7 +2,6 @@ namespace wcf\system\database; -use wcf\data\application\Application; use wcf\system\application\ApplicationHandler; use wcf\system\benchmark\Benchmark; use wcf\system\database\editor\DatabaseEditor; diff --git a/wcfsetup/install/files/lib/system/event/EventHandler.class.php b/wcfsetup/install/files/lib/system/event/EventHandler.class.php index b84be13d65..3a775f15d1 100644 --- a/wcfsetup/install/files/lib/system/event/EventHandler.class.php +++ b/wcfsetup/install/files/lib/system/event/EventHandler.class.php @@ -249,7 +249,7 @@ final class EventHandler extends SingletonFactory * * @return iterable */ - private function getListenersForEvent(object $event) : iterable + private function getListenersForEvent(object $event): iterable { $classes = \array_values([ $event::class, @@ -263,7 +263,7 @@ final class EventHandler extends SingletonFactory } /** - * @param class-string $eventClass + * @param class-string $eventClass * @return iterable */ private function getPsr14Listeners(string $eventClass): iterable @@ -288,8 +288,8 @@ final class EventHandler extends SingletonFactory * must either be a class name of a class that implements __invoke() * or a callable. * - * @param class-string $event - * @param class-string|callable $listener + * @param class-string $event + * @param class-string|callable $listener */ public function register(string $event, string|callable $listener): void { diff --git a/wcfsetup/install/files/lib/system/language/preload/command/CachePreloadPhrases.class.php b/wcfsetup/install/files/lib/system/language/preload/command/CachePreloadPhrases.class.php index fc1168e8b1..1a8dce9d30 100644 --- a/wcfsetup/install/files/lib/system/language/preload/command/CachePreloadPhrases.class.php +++ b/wcfsetup/install/files/lib/system/language/preload/command/CachePreloadPhrases.class.php @@ -21,6 +21,7 @@ use wcf\util\StringUtil; final class CachePreloadPhrases { private readonly EventHandler $eventHandler; + private readonly Language $language; public function __construct(Language $language) diff --git a/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php b/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php index 59ca2d7935..3256f74fc6 100644 --- a/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php +++ b/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php @@ -177,7 +177,7 @@ class PackageInstallationDispatcher Process#: {$this->queue->processNo} EOT ); - + $this->logInstallationStep([], 'start cleanup'); // update "last update time" option diff --git a/wcfsetup/install/files/lib/system/upload/AvatarUploadFileSaveStrategy.class.php b/wcfsetup/install/files/lib/system/upload/AvatarUploadFileSaveStrategy.class.php index 1427f4cc7b..02677ae3f4 100644 --- a/wcfsetup/install/files/lib/system/upload/AvatarUploadFileSaveStrategy.class.php +++ b/wcfsetup/install/files/lib/system/upload/AvatarUploadFileSaveStrategy.class.php @@ -79,13 +79,13 @@ class AvatarUploadFileSaveStrategy implements IUploadFileSaveStrategy // shrink avatar if necessary try { $newWidth = $newHeight = UserAvatar::AVATAR_SIZE; - + // Save HiDPI version if possible. $imageData = \getimagesize($fileLocation); if ($imageData[0] >= UserAvatar::AVATAR_SIZE_2X && $imageData[1] >= UserAvatar::AVATAR_SIZE_2X) { $newWidth = $newHeight = UserAvatar::AVATAR_SIZE_2X; } - + $fileLocation = ImageUtil::enforceDimensions( $fileLocation, $newWidth, -- 2.20.1