Skip to content

Commit 54b6e01

Browse files
committed
Running php-cs-fixer
Running php-cs-fixer to fix CS drift
1 parent db8605c commit 54b6e01

Some content is hidden

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

41 files changed

+43
-164
lines changed

Diff for: DbalConnectionFactory.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ private function establishConnection(): Connection
9292
return $this->connection;
9393
}
9494

95-
private function parseDsn(string $dsn, array $config = null): array
95+
private function parseDsn(string $dsn, ?array $config = null): array
9696
{
9797
$parsedDsn = Dsn::parseFirst($dsn);
9898

Diff for: DbalContext.php

+1-4
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,6 @@ public function __construct($connection, array $config = [])
5656
}
5757
}
5858

59-
/**
60-
* {@inheritdoc}
61-
*/
6259
public function createMessage(string $body = '', array $properties = [], array $headers = []): Message
6360
{
6461
$message = new DbalMessage();
@@ -201,7 +198,7 @@ public function getDbalConnection(): Connection
201198
if (false == $this->connection) {
202199
$connection = call_user_func($this->connectionFactory);
203200
if (false == $connection instanceof Connection) {
204-
throw new \LogicException(sprintf('The factory must return instance of Doctrine\DBAL\Connection. It returns %s', is_object($connection) ? get_class($connection) : gettype($connection)));
201+
throw new \LogicException(sprintf('The factory must return instance of Doctrine\DBAL\Connection. It returns %s', is_object($connection) ? $connection::class : gettype($connection)));
205202
}
206203

207204
$this->connection = $connection;

Diff for: DbalMessage.php

+9-17
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,6 @@ class DbalMessage implements Message
6767
*/
6868
private $publishedAt;
6969

70-
/**
71-
* @param string $body
72-
* @param array $properties
73-
* @param array $headers
74-
*/
7570
public function __construct(string $body = '', array $properties = [], array $headers = [])
7671
{
7772
$this->body = $body;
@@ -144,7 +139,7 @@ public function setRedelivered(bool $redelivered): void
144139
$this->redelivered = $redelivered;
145140
}
146141

147-
public function setReplyTo(string $replyTo = null): void
142+
public function setReplyTo(?string $replyTo = null): void
148143
{
149144
$this->setHeader('reply_to', $replyTo);
150145
}
@@ -159,7 +154,7 @@ public function getPriority(): ?int
159154
return $this->priority;
160155
}
161156

162-
public function setPriority(int $priority = null): void
157+
public function setPriority(?int $priority = null): void
163158
{
164159
$this->priority = $priority;
165160
}
@@ -172,14 +167,11 @@ public function getDeliveryDelay(): ?int
172167
/**
173168
* Set delay in milliseconds.
174169
*/
175-
public function setDeliveryDelay(int $deliveryDelay = null): void
170+
public function setDeliveryDelay(?int $deliveryDelay = null): void
176171
{
177172
$this->deliveryDelay = $deliveryDelay;
178173
}
179174

180-
/**
181-
* @return int
182-
*/
183175
public function getTimeToLive(): ?int
184176
{
185177
return $this->timeToLive;
@@ -188,12 +180,12 @@ public function getTimeToLive(): ?int
188180
/**
189181
* Set time to live in milliseconds.
190182
*/
191-
public function setTimeToLive(int $timeToLive = null): void
183+
public function setTimeToLive(?int $timeToLive = null): void
192184
{
193185
$this->timeToLive = $timeToLive;
194186
}
195187

196-
public function setCorrelationId(string $correlationId = null): void
188+
public function setCorrelationId(?string $correlationId = null): void
197189
{
198190
$this->setHeader('correlation_id', $correlationId);
199191
}
@@ -203,7 +195,7 @@ public function getCorrelationId(): ?string
203195
return $this->getHeader('correlation_id', null);
204196
}
205197

206-
public function setMessageId(string $messageId = null): void
198+
public function setMessageId(?string $messageId = null): void
207199
{
208200
$this->setHeader('message_id', $messageId);
209201
}
@@ -220,7 +212,7 @@ public function getTimestamp(): ?int
220212
return null === $value ? null : $value;
221213
}
222214

223-
public function setTimestamp(int $timestamp = null): void
215+
public function setTimestamp(?int $timestamp = null): void
224216
{
225217
$this->setHeader('timestamp', $timestamp);
226218
}
@@ -240,7 +232,7 @@ public function getRedeliverAfter(): int
240232
return $this->redeliverAfter;
241233
}
242234

243-
public function setRedeliverAfter(int $redeliverAfter = null): void
235+
public function setRedeliverAfter(?int $redeliverAfter = null): void
244236
{
245237
$this->redeliverAfter = $redeliverAfter;
246238
}
@@ -250,7 +242,7 @@ public function getPublishedAt(): ?int
250242
return $this->publishedAt;
251243
}
252244

253-
public function setPublishedAt(int $publishedAt = null): void
245+
public function setPublishedAt(?int $publishedAt = null): void
254246
{
255247
$this->publishedAt = $publishedAt;
256248
}

Diff for: DbalProducer.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public function send(Destination $destination, Message $message): void
8181
$delay = $message->getDeliveryDelay();
8282
if ($delay) {
8383
if (!is_int($delay)) {
84-
throw new \LogicException(sprintf('Delay must be integer but got: "%s"', is_object($delay) ? get_class($delay) : gettype($delay)));
84+
throw new \LogicException(sprintf('Delay must be integer but got: "%s"', is_object($delay) ? $delay::class : gettype($delay)));
8585
}
8686

8787
if ($delay <= 0) {
@@ -94,7 +94,7 @@ public function send(Destination $destination, Message $message): void
9494
$timeToLive = $message->getTimeToLive();
9595
if ($timeToLive) {
9696
if (!is_int($timeToLive)) {
97-
throw new \LogicException(sprintf('TimeToLive must be integer but got: "%s"', is_object($timeToLive) ? get_class($timeToLive) : gettype($timeToLive)));
97+
throw new \LogicException(sprintf('TimeToLive must be integer but got: "%s"', is_object($timeToLive) ? $timeToLive::class : gettype($timeToLive)));
9898
}
9999

100100
if ($timeToLive <= 0) {
@@ -128,7 +128,7 @@ public function send(Destination $destination, Message $message): void
128128
}
129129
}
130130

131-
public function setDeliveryDelay(int $deliveryDelay = null): Producer
131+
public function setDeliveryDelay(?int $deliveryDelay = null): Producer
132132
{
133133
$this->deliveryDelay = $deliveryDelay;
134134

@@ -140,7 +140,7 @@ public function getDeliveryDelay(): ?int
140140
return $this->deliveryDelay;
141141
}
142142

143-
public function setPriority(int $priority = null): Producer
143+
public function setPriority(?int $priority = null): Producer
144144
{
145145
$this->priority = $priority;
146146

@@ -152,7 +152,7 @@ public function getPriority(): ?int
152152
return $this->priority;
153153
}
154154

155-
public function setTimeToLive(int $timeToLive = null): Producer
155+
public function setTimeToLive(?int $timeToLive = null): Producer
156156
{
157157
$this->timeToLive = $timeToLive;
158158

Diff for: DbalSubscriptionConsumer.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class DbalSubscriptionConsumer implements SubscriptionConsumer
2525
private $subscribers;
2626

2727
/**
28-
* @var \Doctrine\DBAL\Connection
28+
* @var Connection
2929
*/
3030
private $dbal;
3131

@@ -139,7 +139,7 @@ public function consume(int $timeout = 0): void
139139
public function subscribe(Consumer $consumer, callable $callback): void
140140
{
141141
if (false == $consumer instanceof DbalConsumer) {
142-
throw new \InvalidArgumentException(sprintf('The consumer must be instance of "%s" got "%s"', DbalConsumer::class, get_class($consumer)));
142+
throw new \InvalidArgumentException(sprintf('The consumer must be instance of "%s" got "%s"', DbalConsumer::class, $consumer::class));
143143
}
144144

145145
$queueName = $consumer->getQueue()->getQueueName();
@@ -160,7 +160,7 @@ public function subscribe(Consumer $consumer, callable $callback): void
160160
public function unsubscribe(Consumer $consumer): void
161161
{
162162
if (false == $consumer instanceof DbalConsumer) {
163-
throw new \InvalidArgumentException(sprintf('The consumer must be instance of "%s" got "%s"', DbalConsumer::class, get_class($consumer)));
163+
throw new \InvalidArgumentException(sprintf('The consumer must be instance of "%s" got "%s"', DbalConsumer::class, $consumer::class));
164164
}
165165

166166
$queueName = $consumer->getQueue()->getQueueName();

Diff for: JSON.php

+7-20
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@ class JSON
1414
public static function decode($string)
1515
{
1616
if (!is_string($string)) {
17-
throw new \InvalidArgumentException(sprintf(
18-
'Accept only string argument but got: "%s"',
19-
is_object($string) ? get_class($string) : gettype($string)
20-
));
17+
throw new \InvalidArgumentException(sprintf('Accept only string argument but got: "%s"', is_object($string) ? $string::class : gettype($string)));
2118
}
2219

2320
// PHP7 fix - empty string and null cause syntax error
@@ -26,32 +23,22 @@ public static function decode($string)
2623
}
2724

2825
$decoded = json_decode($string, true);
29-
if (JSON_ERROR_NONE !== json_last_error()) {
30-
throw new \InvalidArgumentException(sprintf(
31-
'The malformed json given. Error %s and message %s',
32-
json_last_error(),
33-
json_last_error_msg()
34-
));
26+
if (\JSON_ERROR_NONE !== json_last_error()) {
27+
throw new \InvalidArgumentException(sprintf('The malformed json given. Error %s and message %s', json_last_error(), json_last_error_msg()));
3528
}
3629

3730
return $decoded;
3831
}
3932

4033
/**
41-
* @param mixed $value
42-
*
4334
* @return string
4435
*/
4536
public static function encode($value)
4637
{
47-
$encoded = json_encode($value, JSON_UNESCAPED_UNICODE);
48-
49-
if (JSON_ERROR_NONE !== json_last_error()) {
50-
throw new \InvalidArgumentException(sprintf(
51-
'Could not encode value into json. Error %s and message %s',
52-
json_last_error(),
53-
json_last_error_msg()
54-
));
38+
$encoded = json_encode($value, \JSON_UNESCAPED_UNICODE);
39+
40+
if (\JSON_ERROR_NONE !== json_last_error()) {
41+
throw new \InvalidArgumentException(sprintf('Could not encode value into json. Error %s and message %s', json_last_error(), json_last_error_msg()));
5542
}
5643

5744
return $encoded;

Diff for: Tests/DbalConnectionFactoryConfigTest.php

-3
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@ public function testThrowIfDsnCouldNotBeParsed()
4141

4242
/**
4343
* @dataProvider provideConfigs
44-
*
45-
* @param mixed $config
46-
* @param mixed $expectedConfig
4744
*/
4845
public function testShouldParseConfigurationAsExpected($config, $expectedConfig)
4946
{

Diff for: Tests/DbalConsumerTest.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ public function isRedelivered(): bool
265265
throw new \BadMethodCallException('This should not be called directly');
266266
}
267267

268-
public function setCorrelationId(string $correlationId = null): void
268+
public function setCorrelationId(?string $correlationId = null): void
269269
{
270270
}
271271

@@ -274,7 +274,7 @@ public function getCorrelationId(): ?string
274274
throw new \BadMethodCallException('This should not be called directly');
275275
}
276276

277-
public function setMessageId(string $messageId = null): void
277+
public function setMessageId(?string $messageId = null): void
278278
{
279279
}
280280

@@ -288,11 +288,11 @@ public function getTimestamp(): ?int
288288
throw new \BadMethodCallException('This should not be called directly');
289289
}
290290

291-
public function setTimestamp(int $timestamp = null): void
291+
public function setTimestamp(?int $timestamp = null): void
292292
{
293293
}
294294

295-
public function setReplyTo(string $replyTo = null): void
295+
public function setReplyTo(?string $replyTo = null): void
296296
{
297297
}
298298

Diff for: Tests/Functional/DbalConsumerTest.php

+9-9
Original file line numberDiff line numberDiff line change
@@ -117,15 +117,15 @@ public function testShouldDeleteExpiredMessage()
117117

118118
$this->context->getDbalConnection()->insert(
119119
$this->context->getTableName(), [
120-
'id' => 'id',
121-
'published_at' => '123',
122-
'body' => 'expiredMessage',
123-
'headers' => json_encode([]),
124-
'properties' => json_encode([]),
125-
'queue' => __METHOD__,
126-
'redelivered' => 0,
127-
'time_to_live' => time() - 10000,
128-
]);
120+
'id' => 'id',
121+
'published_at' => '123',
122+
'body' => 'expiredMessage',
123+
'headers' => json_encode([]),
124+
'properties' => json_encode([]),
125+
'queue' => __METHOD__,
126+
'redelivered' => 0,
127+
'time_to_live' => time() - 10000,
128+
]);
129129

130130
$message = $context->createMessage('notExpiredMessage');
131131
$message->setRedelivered(false);

Diff for: Tests/Spec/DbalConnectionFactoryTest.php

-3
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77

88
class DbalConnectionFactoryTest extends ConnectionFactorySpec
99
{
10-
/**
11-
* {@inheritdoc}
12-
*/
1310
protected function createConnectionFactory()
1411
{
1512
return new DbalConnectionFactory();

Diff for: Tests/Spec/DbalMessageTest.php

-3
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77

88
class DbalMessageTest extends MessageSpec
99
{
10-
/**
11-
* {@inheritdoc}
12-
*/
1310
protected function createMessage()
1411
{
1512
return new DbalMessage();

Diff for: Tests/Spec/DbalQueueTest.php

-3
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77

88
class DbalQueueTest extends QueueSpec
99
{
10-
/**
11-
* {@inheritdoc}
12-
*/
1310
protected function createQueue()
1411
{
1512
return new DbalDestination(self::EXPECTED_QUEUE_NAME);

Diff for: Tests/Spec/DbalTopicTest.php

-3
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77

88
class DbalTopicTest extends TopicSpec
99
{
10-
/**
11-
* {@inheritdoc}
12-
*/
1310
protected function createTopic()
1411
{
1512
return new DbalDestination(self::EXPECTED_TOPIC_NAME);

Diff for: Tests/Spec/Mysql/DbalContextTest.php

-3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ class DbalContextTest extends ContextSpec
1111
{
1212
use CreateDbalContextTrait;
1313

14-
/**
15-
* {@inheritdoc}
16-
*/
1714
protected function createContext()
1815
{
1916
return $this->createDbalContext();

Diff for: Tests/Spec/Mysql/DbalProducerTest.php

-3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ class DbalProducerTest extends ProducerSpec
1111
{
1212
use CreateDbalContextTrait;
1313

14-
/**
15-
* {@inheritdoc}
16-
*/
1714
protected function createProducer()
1815
{
1916
return $this->createDbalContext()->createProducer();

Diff for: Tests/Spec/Mysql/DbalRequeueMessageTest.php

-3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ class DbalRequeueMessageTest extends RequeueMessageSpec
1111
{
1212
use CreateDbalContextTrait;
1313

14-
/**
15-
* {@inheritdoc}
16-
*/
1714
protected function createContext()
1815
{
1916
return $this->createDbalContext();

Diff for: Tests/Spec/Mysql/DbalSendAndReceiveDelayedMessageFromQueueTest.php

-3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ class DbalSendAndReceiveDelayedMessageFromQueueTest extends SendAndReceiveDelaye
1111
{
1212
use CreateDbalContextTrait;
1313

14-
/**
15-
* {@inheritdoc}
16-
*/
1714
protected function createContext()
1815
{
1916
return $this->createDbalContext();

0 commit comments

Comments
 (0)