-
-
Notifications
You must be signed in to change notification settings - Fork 251
Create OptionsResolver normalizers #1455
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
base: master
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -60,6 +60,7 @@ | |||||
| use Ratchet\Client\Connector; | ||||||
| use Ratchet\Client\WebSocket; | ||||||
| use Ratchet\RFC6455\Messaging\Message; | ||||||
| use React\Dns\Config\Config as DnsConfig; | ||||||
| use React\EventLoop\Loop; | ||||||
| use React\EventLoop\LoopInterface; | ||||||
| use React\EventLoop\TimerInterface; | ||||||
|
|
@@ -95,6 +96,29 @@ | |||||
| * @property PrivateChannelRepository $private_channels | ||||||
| * @property SoundRepository $sounds | ||||||
| * @property UserRepository $users | ||||||
| * | ||||||
| * @property array $options | ||||||
| * @property string $options['token'] | ||||||
| * @property LoggerInterface $options['logger'] | ||||||
| * @property LoopInterface $options['loop'] | ||||||
| * @property array|bool $options['loadAllMembers'] | ||||||
| * @property array $options['disabledEvents'] | ||||||
| * @property bool $options['storeMessages'] | ||||||
| * @property array|bool $options['retrieveBans'] | ||||||
| * @property int|null $options['large_threshold'] | ||||||
| * @property array|null $options['shard'] | ||||||
| * @property int|null $options['shard_id'] | ||||||
| * @property int|null $options['num_shards'] | ||||||
| * @property int|null $options['shardId'] | ||||||
| * @property int|null $options['shardCount'] | ||||||
| * @property array|null $options['presence'] | ||||||
| * @property int $options['intents'] | ||||||
| * @property array $options['socket_options'] | ||||||
| * @property DnsConfig|string $options['dnsConfig'] | ||||||
| * @property string[] $options['cache'] | ||||||
| * @property string $options['collection'] | ||||||
| * @property bool $options['useTransportCompression'] | ||||||
| * @property bool $options['usePayloadCompression'] | ||||||
| */ | ||||||
| class Discord | ||||||
| { | ||||||
|
|
@@ -1711,7 +1735,19 @@ protected function resolveOptions(array $options = []): array | |||||
| ]) | ||||||
| ->setAllowedTypes('token', 'string') | ||||||
| ->setAllowedTypes('logger', ['null', LoggerInterface::class]) | ||||||
| ->setNormalizer('logger', function ($options, $value) { | ||||||
| if (null === $options['logger']) { | ||||||
|
||||||
| if (null === $options['logger']) { | |
| if (null === $value) { |
Outdated
Copilot
AI
Jan 10, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 'loop' option needs a default value in the setDefaults() configuration. Currently, 'loop' is defined but has no default, which means if a user doesn't provide it, the option will be undefined and fail the LoopInterface type check before reaching the normalizer. Add 'loop' => null, to the setDefaults array around line 1717, and update setAllowedTypes on line 1749 to include 'null' as an allowed type: ->setAllowedTypes('loop', ['null', LoopInterface::class]).
Copilot
AI
Jan 10, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 'dnsConfig' option needs a default value in the setDefaults() configuration. Currently, 'dnsConfig' is defined but has no default, which means if a user doesn't provide it, the option will be undefined and the normalizer's null check won't be reached. Add 'dnsConfig' => null, to the setDefaults array around line 1717, and update setAllowedTypes on line 1790 to include 'null' as an allowed type: ->setAllowedTypes('dnsConfig', ['null', 'string', DnsConfig::class]).
Uh oh!
There was an error while loading. Please reload this page.