Skip to content

Commit bd1226f

Browse files
committed
codestyle
1 parent 6e0f04b commit bd1226f

45 files changed

Lines changed: 125 additions & 180 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

files/lib/acp/form/DiscordBotAddForm.class.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace wcf\acp\form;
44

5-
use Override;
65
use wcf\data\discord\bot\DiscordBot;
76
use wcf\data\discord\bot\DiscordBotAction;
87
use wcf\form\AbstractFormBuilderForm;
@@ -49,7 +48,7 @@ class DiscordBotAddForm extends AbstractFormBuilderForm
4948
*/
5049
protected $guildIcon;
5150

52-
#[Override]
51+
#[\Override]
5352
protected function createForm()
5453
{
5554
parent::createForm();
@@ -145,7 +144,7 @@ protected function createForm()
145144
]);
146145
}
147146

148-
#[Override]
147+
#[\Override]
149148
public function save()
150149
{
151150
$additionalFields = [

files/lib/acp/form/DiscordBotAddManagerForm.class.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace wcf\acp\form;
44

5-
use Override;
65
use wcf\data\discord\bot\DiscordBot;
76
use wcf\data\discord\bot\DiscordBotAction;
87
use wcf\event\discord\DiscordIntentsCollecting;
@@ -63,7 +62,7 @@ class DiscordBotAddManagerForm extends AbstractFormBuilderForm
6362
*/
6463
protected array $neededIntents = [];
6564

66-
#[Override]
65+
#[\Override]
6766
public function readParameters(): void
6867
{
6968
parent::readParameters();
@@ -73,7 +72,7 @@ public function readParameters(): void
7372
}
7473
}
7574

76-
#[Override]
75+
#[\Override]
7776
protected function createForm(): void
7877
{
7978
parent::createForm();
@@ -297,13 +296,13 @@ protected function createFormStep5(): void
297296
]);
298297
}
299298

300-
#[Override]
299+
#[\Override]
301300
protected function setFormAction(): void
302301
{
303302
$this->form->action(LinkHandler::getInstance()->getControllerLink(static::class, ['step' => $this->step]));
304303
}
305304

306-
#[Override]
305+
#[\Override]
307306
public function save(): void
308307
{
309308
$this->step++;
@@ -320,7 +319,7 @@ public function save(): void
320319
}
321320
}
322321

323-
#[Override]
322+
#[\Override]
324323
public function assignVariables(): void
325324
{
326325
parent::assignVariables();

files/lib/acp/form/DiscordBotEditForm.class.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace wcf\acp\form;
44

55
use CuyZ\Valinor\Mapper\MappingError;
6-
use Override;
76
use wcf\data\discord\bot\DiscordBot;
87
use wcf\http\Helper;
98
use wcf\system\exception\IllegalLinkException;
@@ -16,7 +15,7 @@ class DiscordBotEditForm extends DiscordBotAddForm
1615
*/
1716
public $formAction = 'edit';
1817

19-
#[Override]
18+
#[\Override]
2019
public function readParameters()
2120
{
2221
parent::readParameters();
@@ -40,7 +39,7 @@ public function readParameters()
4039
}
4140
}
4241

43-
#[Override]
42+
#[\Override]
4443
protected function createForm()
4544
{
4645
parent::createForm();

files/lib/acp/page/DiscordBotListPage.class.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace wcf\acp\page;
44

5-
use Override;
65
use wcf\page\AbstractGridViewPage;
76
use wcf\system\gridView\admin\DiscordBotGridView;
87

@@ -28,7 +27,7 @@ final class DiscordBotListPage extends AbstractGridViewPage
2827
*/
2928
public $activeMenuItem = 'wcf.acp.menu.link.configuration.discord.discordBotList';
3029

31-
#[Override]
30+
#[\Override]
3231
protected function createGridView(): DiscordBotGridView
3332
{
3433
return new DiscordBotGridView();

files/lib/acp/page/DiscordWebhookListPage.class.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace wcf\acp\page;
44

5-
use Override;
65
use wcf\page\AbstractGridViewPage;
76
use wcf\system\gridView\admin\DiscordWebhookGridView;
87

@@ -28,7 +27,7 @@ final class DiscordWebhookListPage extends AbstractGridViewPage
2827
*/
2928
public $activeMenuItem = 'wcf.acp.menu.link.configuration.discord.discordWebhookList';
3029

31-
#[Override]
30+
#[\Override]
3231
protected function createGridView(): DiscordWebhookGridView
3332
{
3433
return new DiscordWebhookGridView();

files/lib/action/AbstractDiscordInteractionAction.class.php

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,11 @@
22

33
namespace wcf\action;
44

5-
use BadMethodCallException;
65
use Laminas\Diactoros\Response\HtmlResponse;
76
use Laminas\Diactoros\Response\JsonResponse;
8-
use LogicException;
9-
use OutOfBoundsException;
10-
use Override;
117
use Psr\Http\Message\ResponseInterface;
128
use Psr\Http\Message\ServerRequestInterface;
139
use Psr\Http\Server\RequestHandlerInterface;
14-
use Throwable;
15-
use UnexpectedValueException;
1610
use wcf\data\discord\bot\DiscordBotList;
1711
use wcf\data\discord\interaction\log\DiscordInteractionLogAction;
1812
use wcf\system\discord\DiscordApi;
@@ -21,7 +15,7 @@
2115

2216
abstract class AbstractDiscordInteractionAction implements RequestHandlerInterface, IDiscordInteractionAction
2317
{
24-
#[Override]
18+
#[\Override]
2519
public function handle(ServerRequestInterface $request): ResponseInterface
2620
{
2721
if ($request->getMethod() === 'POST') {
@@ -39,18 +33,18 @@ public function handle(ServerRequestInterface $request): ResponseInterface
3933
}
4034

4135
if ($body === '') {
42-
throw new BadMethodCallException('body is empty');
36+
throw new \BadMethodCallException('body is empty');
4337
}
4438
$data = [];
4539
try {
4640
$data = JSON::decode($body, true);
47-
} catch (Throwable) {
48-
throw new BadMethodCallException('body is not valid json');
41+
} catch (\Throwable) {
42+
throw new \BadMethodCallException('body is not valid json');
4943
}
5044

5145
$publicKeys = $this->getPublicKeys();
5246
if ($publicKeys === []) {
53-
throw new UnexpectedValueException('public key is empty');
47+
throw new \UnexpectedValueException('public key is empty');
5448
}
5549

5650
$validRequest = false;
@@ -61,11 +55,11 @@ public function handle(ServerRequestInterface $request): ResponseInterface
6155
}
6256
}
6357
if (!$validRequest) {
64-
throw new OutOfBoundsException('invalid request signature');
58+
throw new \OutOfBoundsException('invalid request signature');
6559
}
6660

6761
if (!isset($data['type'])) {
68-
throw new BadMethodCallException('type is empty');
62+
throw new \BadMethodCallException('type is empty');
6963
}
7064

7165
switch ($data['type']) {
@@ -80,17 +74,17 @@ public function handle(ServerRequestInterface $request): ResponseInterface
8074
case DiscordApi::DISCORD_MODAL_SUBMIT:
8175
return $this->handleModalCommand($data);
8276
default:
83-
throw new BadMethodCallException('unknown component');
77+
throw new \BadMethodCallException('unknown component');
8478
}
85-
} catch (BadMethodCallException $e) {
79+
} catch (\BadMethodCallException $e) {
8680
return new HtmlResponse($e->getMessage(), 400);
87-
} catch (OutOfBoundsException $e) {
81+
} catch (\OutOfBoundsException $e) {
8882
return new HtmlResponse($e->getMessage(), 401);
89-
} catch (UnexpectedValueException $e) {
83+
} catch (\UnexpectedValueException $e) {
9084
return new HtmlResponse($e->getMessage(), 501);
9185
}
9286
} else {
93-
throw new LogicException('Unreachable');
87+
throw new \LogicException('Unreachable');
9488
}
9589
}
9690

@@ -102,7 +96,7 @@ private function sendPong(): JsonResponse
10296
return new JsonResponse((new PingInteractionCallback())->getInteractionResponse());
10397
}
10498

105-
#[Override]
99+
#[\Override]
106100
public function getPublicKeys(): array
107101
{
108102
$publicKeys = [];

files/lib/action/DiscordInteractionAction.class.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use Laminas\Diactoros\Response\EmptyResponse;
66
use Laminas\Diactoros\Response\JsonResponse;
7-
use Override;
87
use Psr\Http\Message\ResponseInterface;
98
use wcf\http\attribute\DisableXsrfCheck;
109
use wcf\system\discord\event\ApplicationCommandAutocompleteReceived;
@@ -16,7 +15,7 @@
1615
#[DisableXsrfCheck]
1716
final class DiscordInteractionAction extends AbstractDiscordInteractionAction
1817
{
19-
#[Override]
18+
#[\Override]
2019
public function handleApplicationCommand(array $data): ResponseInterface
2120
{
2221
$event = new ApplicationCommandReceived($data);
@@ -30,7 +29,7 @@ public function handleApplicationCommand(array $data): ResponseInterface
3029
return new EmptyResponse();
3130
}
3231

33-
#[Override]
32+
#[\Override]
3433
public function handleMessageCommand(array $data): ResponseInterface
3534
{
3635
$event = new MessageCommandReceived($data);
@@ -44,7 +43,7 @@ public function handleMessageCommand(array $data): ResponseInterface
4443
return new EmptyResponse();
4544
}
4645

47-
#[Override]
46+
#[\Override]
4847
public function handleApplicationCommandAutocomplete(array $data): ResponseInterface
4948
{
5049
$event = new ApplicationCommandAutocompleteReceived($data);
@@ -58,7 +57,7 @@ public function handleApplicationCommandAutocomplete(array $data): ResponseInter
5857
return new EmptyResponse();
5958
}
6059

61-
#[Override]
60+
#[\Override]
6261
public function handleModalCommand(array $data): ResponseInterface
6362
{
6463
$event = new ModalCommandReceived($data);

files/lib/data/discord/bot/DiscordBotAction.class.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace wcf\data\discord\bot;
44

5-
use Override;
65
use wcf\data\AbstractDatabaseObjectAction;
76
use wcf\system\cache\builder\DiscordGuildChannelsCacheBuilder;
87
use wcf\system\exception\AJAXException;
@@ -38,7 +37,7 @@ final class DiscordBotAction extends AbstractDatabaseObjectAction
3837
*/
3938
public $className = DiscordBotEditor::class;
4039

41-
#[Override]
40+
#[\Override]
4241
public function create()
4342
{
4443
if (isset($this->parameters['data']['useApplicationCommands'])) {
@@ -48,7 +47,7 @@ public function create()
4847
return parent::create();
4948
}
5049

51-
#[Override]
50+
#[\Override]
5251
public function update()
5352
{
5453
if (isset($this->parameters['data']['botToken']) && $this->parameters['data']['botToken'] === '') {
@@ -61,7 +60,7 @@ public function update()
6160
parent::update();
6261
}
6362

64-
#[Override]
63+
#[\Override]
6564
protected function resetCache()
6665
{
6766
DiscordGuildChannelsCacheBuilder::getInstance()->reset();

files/lib/data/discord/webhook/DiscordWebhookAction.class.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace wcf\data\discord\webhook;
44

5-
use Override;
65
use wcf\data\AbstractDatabaseObjectAction;
76
use wcf\system\cache\builder\DiscordGuildChannelsCacheBuilder;
87

@@ -28,7 +27,7 @@ final class DiscordWebhookAction extends AbstractDatabaseObjectAction
2827
*/
2928
public $className = DiscordWebhookEditor::class;
3029

31-
#[Override]
30+
#[\Override]
3231
public function delete()
3332
{
3433
foreach ($this->objects as $object) {
@@ -40,7 +39,7 @@ public function delete()
4039
return parent::delete();
4140
}
4241

43-
#[Override]
42+
#[\Override]
4443
protected function resetCache()
4544
{
4645
DiscordGuildChannelsCacheBuilder::getInstance()->reset();

files/lib/system/cache/builder/DiscordCurrentGuildsCacheBuilder.class.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace wcf\system\cache\builder;
44

5-
use Override;
65
use wcf\system\discord\DiscordApi;
76

87
/**
@@ -20,7 +19,7 @@ final class DiscordCurrentGuildsCacheBuilder extends AbstractCacheBuilder
2019
*/
2120
protected $maxLifetime = 10;
2221

23-
#[Override]
22+
#[\Override]
2423
public function rebuild(array $parameters)
2524
{
2625
if (!isset($parameters['botToken']) || $parameters['botToken'] === '') {

0 commit comments

Comments
 (0)