Skip to content

Commit 14fa9a6

Browse files
committed
Running php-cs-fixer
Running php-cs-fixer to fix CS drift
1 parent 866d454 commit 14fa9a6

8 files changed

+21
-46
lines changed

ConnectionConfig.php

+11-21
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,6 @@ public function __construct($config = null)
104104
$this->addSupportedScheme('amqps');
105105
}
106106

107-
/**
108-
* @param string[] $extensions
109-
*/
110107
public function addSupportedScheme(string $schema): self
111108
{
112109
$this->supportedSchemes[] = $schema;
@@ -117,7 +114,6 @@ public function addSupportedScheme(string $schema): self
117114

118115
/**
119116
* @param string $name
120-
* @param mixed $value
121117
*
122118
* @return self
123119
*/
@@ -153,18 +149,18 @@ public function parse()
153149

154150
$config = array_replace($this->defaultConfig, $config);
155151
$config['host'] = (string) $config['host'];
156-
$config['port'] = (int) ($config['port']);
152+
$config['port'] = (int) $config['port'];
157153
$config['user'] = (string) $config['user'];
158154
$config['pass'] = (string) $config['pass'];
159-
$config['read_timeout'] = max((float) ($config['read_timeout']), 0);
160-
$config['write_timeout'] = max((float) ($config['write_timeout']), 0);
161-
$config['connection_timeout'] = max((float) ($config['connection_timeout']), 0);
162-
$config['heartbeat'] = max((float) ($config['heartbeat']), 0);
155+
$config['read_timeout'] = max((float) $config['read_timeout'], 0);
156+
$config['write_timeout'] = max((float) $config['write_timeout'], 0);
157+
$config['connection_timeout'] = max((float) $config['connection_timeout'], 0);
158+
$config['heartbeat'] = max((float) $config['heartbeat'], 0);
163159
$config['persisted'] = !empty($config['persisted']);
164160
$config['lazy'] = !empty($config['lazy']);
165161
$config['qos_global'] = !empty($config['qos_global']);
166-
$config['qos_prefetch_count'] = max((int) ($config['qos_prefetch_count']), 0);
167-
$config['qos_prefetch_size'] = max((int) ($config['qos_prefetch_size']), 0);
162+
$config['qos_prefetch_count'] = max((int) $config['qos_prefetch_count'], 0);
163+
$config['qos_prefetch_size'] = max((int) $config['qos_prefetch_size'], 0);
168164
$config['ssl_on'] = !empty($config['ssl_on']);
169165
$config['ssl_verify'] = !empty($config['ssl_verify']);
170166
$config['ssl_cacert'] = (string) $config['ssl_cacert'];
@@ -346,10 +342,8 @@ public function getSslPassPhrase()
346342
}
347343

348344
/**
349-
* @param string $name
350-
* @param mixed $default
351-
*
352-
* @return mixed
345+
* @param string $name
346+
* @param mixed|null $default
353347
*/
354348
public function getOption($name, $default = null)
355349
{
@@ -383,11 +377,7 @@ private function parseDsn($dsn)
383377

384378
$supportedSchemes = $this->supportedSchemes;
385379
if (false == in_array($dsn->getSchemeProtocol(), $supportedSchemes, true)) {
386-
throw new \LogicException(sprintf(
387-
'The given scheme protocol "%s" is not supported. It must be one of "%s".',
388-
$dsn->getSchemeProtocol(),
389-
implode('", "', $supportedSchemes)
390-
));
380+
throw new \LogicException(sprintf('The given scheme protocol "%s" is not supported. It must be one of "%s".', $dsn->getSchemeProtocol(), implode('", "', $supportedSchemes)));
391381
}
392382

393383
$sslOn = false;
@@ -406,7 +396,7 @@ private function parseDsn($dsn)
406396
'user' => $dsn->getUser(),
407397
'pass' => $dsn->getPassword(),
408398
'vhost' => null !== ($path = $dsn->getPath()) ?
409-
(0 === strpos($path, '/') ? substr($path, 1) : $path)
399+
(str_starts_with($path, '/') ? substr($path, 1) : $path)
410400
: null,
411401
'read_timeout' => $dsn->getFloat('read_timeout'),
412402
'write_timeout' => $dsn->getFloat('write_timeout'),

DelayStrategyAware.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66

77
interface DelayStrategyAware
88
{
9-
public function setDelayStrategy(DelayStrategy $delayStrategy = null): self;
9+
public function setDelayStrategy(?DelayStrategy $delayStrategy = null): self;
1010
}

DelayStrategyAwareTrait.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ trait DelayStrategyAwareTrait
1111
*/
1212
protected $delayStrategy;
1313

14-
public function setDelayStrategy(DelayStrategy $delayStrategy = null): DelayStrategyAware
14+
public function setDelayStrategy(?DelayStrategy $delayStrategy = null): DelayStrategyAware
1515
{
1616
$this->delayStrategy = $delayStrategy;
1717

RabbitMqDelayPluginDelayStrategy.php

+1-4
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,7 @@ public function delayMessage(AmqpContext $context, AmqpDestination $dest, AmqpMe
3939
$context->declareTopic($delayTopic);
4040
$context->bind(new AmqpBind($dest, $delayTopic, $delayMessage->getRoutingKey()));
4141
} else {
42-
throw new InvalidDestinationException(sprintf('The destination must be an instance of %s but got %s.',
43-
AmqpTopic::class.'|'.AmqpQueue::class,
44-
get_class($dest)
45-
));
42+
throw new InvalidDestinationException(sprintf('The destination must be an instance of %s but got %s.', AmqpTopic::class.'|'.AmqpQueue::class, $dest::class));
4643
}
4744

4845
$producer = $context->createProducer();

RabbitMqDlxDelayStrategy.php

+1-7
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@
1313

1414
class RabbitMqDlxDelayStrategy implements DelayStrategy
1515
{
16-
/**
17-
* {@inheritdoc}
18-
*/
1916
public function delayMessage(AmqpContext $context, AmqpDestination $dest, AmqpMessage $message, int $delay): void
2017
{
2118
$properties = $message->getProperties();
@@ -44,10 +41,7 @@ public function delayMessage(AmqpContext $context, AmqpDestination $dest, AmqpMe
4441
$delayQueue->setArgument('x-dead-letter-exchange', '');
4542
$delayQueue->setArgument('x-dead-letter-routing-key', $dest->getQueueName());
4643
} else {
47-
throw new InvalidDestinationException(sprintf('The destination must be an instance of %s but got %s.',
48-
AmqpTopic::class.'|'.AmqpQueue::class,
49-
get_class($dest)
50-
));
44+
throw new InvalidDestinationException(sprintf('The destination must be an instance of %s but got %s.', AmqpTopic::class.'|'.AmqpQueue::class, $dest::class));
5145
}
5246

5347
$context->declareQueue($delayQueue);

SignalSocketHelper.php

+3-6
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function beforeSocket(): void
2828
return;
2929
}
3030

31-
$signals = [SIGTERM, SIGQUIT, SIGINT];
31+
$signals = [\SIGTERM, \SIGQUIT, \SIGINT];
3232

3333
if ($this->handlers) {
3434
throw new \LogicException('The handlers property should be empty but it is not. The afterSocket method might not have been called.');
@@ -60,22 +60,19 @@ public function afterSocket(): void
6060
return;
6161
}
6262

63-
$signals = [SIGTERM, SIGQUIT, SIGINT];
63+
$signals = [\SIGTERM, \SIGQUIT, \SIGINT];
6464

6565
$this->wasThereSignal = null;
6666

6767
foreach ($signals as $signal) {
68-
$handler = isset($this->handlers[$signal]) ? $this->handlers[$signal] : SIG_DFL;
68+
$handler = isset($this->handlers[$signal]) ? $this->handlers[$signal] : \SIG_DFL;
6969

7070
pcntl_signal($signal, $handler);
7171
}
7272

7373
$this->handlers = [];
7474
}
7575

76-
/**
77-
* @return bool
78-
*/
7976
public function wasThereSignal(): bool
8077
{
8178
return (bool) $this->wasThereSignal;

Tests/ConnectionConfigTest.php

-3
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,6 @@ public function testShouldGetSchemeExtensions()
122122

123123
/**
124124
* @dataProvider provideConfigs
125-
*
126-
* @param mixed $config
127-
* @param mixed $expectedConfig
128125
*/
129126
public function testShouldParseConfigurationAsExpected($config, $expectedConfig)
130127
{

Tests/RabbitMqDelayPluginDelayStrategyTest.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ public function send(Destination $destination, Message $message): void
192192
{
193193
}
194194

195-
public function setDeliveryDelay(int $deliveryDelay = null): Producer
195+
public function setDeliveryDelay(?int $deliveryDelay = null): Producer
196196
{
197197
throw new \BadMethodCallException('This should not be called directly');
198198
}
@@ -202,7 +202,7 @@ public function getDeliveryDelay(): ?int
202202
throw new \BadMethodCallException('This should not be called directly');
203203
}
204204

205-
public function setPriority(int $priority = null): Producer
205+
public function setPriority(?int $priority = null): Producer
206206
{
207207
throw new \BadMethodCallException('This should not be called directly');
208208
}
@@ -212,7 +212,7 @@ public function getPriority(): ?int
212212
throw new \BadMethodCallException('This should not be called directly');
213213
}
214214

215-
public function setTimeToLive(int $timeToLive = null): Producer
215+
public function setTimeToLive(?int $timeToLive = null): Producer
216216
{
217217
throw new \BadMethodCallException('This should not be called directly');
218218
}

0 commit comments

Comments
 (0)