Skip to content

Feature/laravel pint #1303

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
"phpunit/phpunit": "^9.4.4",
"davidcole1340/reactsh": "dev-master",
"wyrihaximus/react-cache-redis": "^4.5",
"symfony/cache": "^5.4"
"symfony/cache": "^5.4",
"laravel/pint": "^1.21"
},
"autoload": {
"files": [
Expand All @@ -58,6 +59,7 @@
"ext-fileinfo": "For function mime_content_type()."
},
"scripts": {
"pint": ["./vendor/bin/pint --config ./pint.json ./src"],
"cs": ["./vendor/bin/php-cs-fixer fix"],
"unit": ["./vendor/bin/phpunit --testdox"],
"coverage": ["XDEBUG_MODE=coverage ./vendor/bin/phpunit --coverage-html coverage --testdox"],
Expand Down
6 changes: 6 additions & 0 deletions pint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"preset": "psr12",
"rules": {
"declare_strict_types": true
}
}
2 changes: 2 additions & 0 deletions src/Discord/Builders/CommandAttributes.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is a part of the DiscordPHP project.
*
Expand Down
2 changes: 2 additions & 0 deletions src/Discord/Builders/CommandBuilder.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is a part of the DiscordPHP project.
*
Expand Down
2 changes: 2 additions & 0 deletions src/Discord/Builders/Components/ActionRow.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is a part of the DiscordPHP project.
*
Expand Down
4 changes: 3 additions & 1 deletion src/Discord/Builders/Components/Button.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is a part of the DiscordPHP project.
*
Expand Down Expand Up @@ -335,7 +337,7 @@ public function setListener(?callable $callback, Discord $discord, bool $oneOff
$this->listener = function (Interaction $interaction) use ($callback, $oneOff) {
if ($interaction->data->component_type == Component::TYPE_BUTTON && $interaction->data->custom_id == $this->custom_id) {
$response = $callback($interaction);
$ack = static fn() => $interaction->isResponded() ?: $interaction->acknowledge();
$ack = static fn () => $interaction->isResponded() ?: $interaction->acknowledge();

if ($response instanceof PromiseInterface) {
$response->then($ack);
Expand Down
2 changes: 2 additions & 0 deletions src/Discord/Builders/Components/ChannelSelect.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is a part of the DiscordPHP project.
*
Expand Down
2 changes: 2 additions & 0 deletions src/Discord/Builders/Components/Component.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is a part of the DiscordPHP project.
*
Expand Down
2 changes: 2 additions & 0 deletions src/Discord/Builders/Components/MentionableSelect.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is a part of the DiscordPHP project.
*
Expand Down
2 changes: 2 additions & 0 deletions src/Discord/Builders/Components/Option.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is a part of the DiscordPHP project.
*
Expand Down
2 changes: 2 additions & 0 deletions src/Discord/Builders/Components/RoleSelect.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is a part of the DiscordPHP project.
*
Expand Down
4 changes: 3 additions & 1 deletion src/Discord/Builders/Components/SelectMenu.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is a part of the DiscordPHP project.
*
Expand Down Expand Up @@ -360,7 +362,7 @@ public function setListener(?callable $callback, Discord $discord, bool $oneOff

$response = $callback($interaction, $options);
}
$ack = static fn() => $interaction->isResponded() ?: $interaction->acknowledge();
$ack = static fn () => $interaction->isResponded() ?: $interaction->acknowledge();

if ($response instanceof PromiseInterface) {
$response->then($ack);
Expand Down
2 changes: 2 additions & 0 deletions src/Discord/Builders/Components/StringSelect.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is a part of the DiscordPHP project.
*
Expand Down
2 changes: 2 additions & 0 deletions src/Discord/Builders/Components/TextInput.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is a part of the DiscordPHP project.
*
Expand Down
2 changes: 2 additions & 0 deletions src/Discord/Builders/Components/UserSelect.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is a part of the DiscordPHP project.
*
Expand Down
2 changes: 2 additions & 0 deletions src/Discord/Builders/MessageBuilder.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is a part of the DiscordPHP project.
*
Expand Down
2 changes: 2 additions & 0 deletions src/Discord/CommandClient/Command.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is a part of the DiscordPHP project.
*
Expand Down
2 changes: 2 additions & 0 deletions src/Discord/Discord.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is a part of the DiscordPHP project.
*
Expand Down
2 changes: 2 additions & 0 deletions src/Discord/DiscordCommandClient.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is a part of the DiscordPHP project.
*
Expand Down
2 changes: 2 additions & 0 deletions src/Discord/Exceptions/BufferTimedOutException.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is a part of the DiscordPHP project.
*
Expand Down
2 changes: 2 additions & 0 deletions src/Discord/Exceptions/DCANotFoundException.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is a part of the DiscordPHP project.
*
Expand Down
2 changes: 2 additions & 0 deletions src/Discord/Exceptions/FFmpegNotFoundException.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is a part of the DiscordPHP project.
*
Expand Down
2 changes: 2 additions & 0 deletions src/Discord/Exceptions/FileNotFoundException.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is a part of the DiscordPHP project.
*
Expand Down
2 changes: 2 additions & 0 deletions src/Discord/Exceptions/IntentException.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is a part of the DiscordPHP project.
*
Expand Down
2 changes: 2 additions & 0 deletions src/Discord/Exceptions/InvalidOverwriteException.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is a part of the DiscordPHP project.
*
Expand Down
2 changes: 2 additions & 0 deletions src/Discord/Exceptions/LibSodiumNotFoundException.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is a part of the DiscordPHP project.
*
Expand Down
2 changes: 2 additions & 0 deletions src/Discord/Exceptions/OpusNotFoundException.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is a part of the DiscordPHP project.
*
Expand Down
2 changes: 2 additions & 0 deletions src/Discord/Exceptions/OutdatedDCAException.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is a part of the DiscordPHP project.
*
Expand Down
2 changes: 2 additions & 0 deletions src/Discord/Exceptions/PartRequestFailedException.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is a part of the DiscordPHP project.
*
Expand Down
2 changes: 2 additions & 0 deletions src/Discord/Factory/Factory.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is a part of the DiscordPHP project.
*
Expand Down
2 changes: 2 additions & 0 deletions src/Discord/Helpers/BigInt.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is a part of the DiscordPHP project.
*
Expand Down
8 changes: 5 additions & 3 deletions src/Discord/Helpers/Buffer.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is a part of the DiscordPHP project.
*
Expand Down Expand Up @@ -51,7 +53,7 @@ class Buffer extends EventEmitter implements WritableStreamInterface
* @var LoopInterface
*/
private $loop;

public function __construct(LoopInterface $loop = null)
{
$this->loop = $loop;
Expand Down Expand Up @@ -136,11 +138,11 @@ public function read(int $length, ?string $format = null, ?int $timeout = -1): P
return $deferred->promise()->then(function ($d) use ($format) {
if ($format !== null) {
$unpacked = unpack($format, $d);

if ($unpacked === false) {
throw new \RuntimeException('Error unpacking buffer.');
}

return reset($unpacked);
}

Expand Down
2 changes: 2 additions & 0 deletions src/Discord/Helpers/CacheConfig.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is a part of the DiscordPHP project.
*
Expand Down
2 changes: 2 additions & 0 deletions src/Discord/Helpers/CacheWrapper.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is a part of the DiscordPHP project.
*
Expand Down
5 changes: 3 additions & 2 deletions src/Discord/Helpers/Collection.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is a part of the DiscordPHP project.
*
Expand All @@ -19,6 +21,7 @@
*/
class Collection implements CollectionInterface
{
use CollectionTrait;
/**
* The collection discriminator.
*
Expand All @@ -39,6 +42,4 @@ class Collection implements CollectionInterface
* @var string
*/
protected $class;

use CollectionTrait;
}
2 changes: 2 additions & 0 deletions src/Discord/Helpers/CollectionInterface.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is a part of the DiscordPHP project.
*
Expand Down
2 changes: 2 additions & 0 deletions src/Discord/Helpers/CollectionTrait.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is a part of the DiscordPHP project.
*
Expand Down
2 changes: 2 additions & 0 deletions src/Discord/Helpers/LegacyCacheWrapper.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is a part of the DiscordPHP project.
*
Expand Down
3 changes: 3 additions & 0 deletions src/Discord/Helpers/Multipart.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is a part of the DiscordPHP project.
*
Expand All @@ -10,6 +12,7 @@
*/

namespace Discord\Helpers;

use Stringable;

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Discord/Helpers/RegisteredCommand.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is a part of the DiscordPHP project.
*
Expand Down
Loading