Skip to content

Commit 4164e1e

Browse files
committed
Running php-cs-fixer
Running php-cs-fixer to fix CS drift
1 parent fd03f9d commit 4164e1e

11 files changed

+19
-42
lines changed

JsonSerializer.php

+4-12
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,8 @@ public function toString(RdKafkaMessage $message): string
1414
'headers' => $message->getHeaders(),
1515
]);
1616

17-
if (JSON_ERROR_NONE !== json_last_error()) {
18-
throw new \InvalidArgumentException(sprintf(
19-
'The malformed json given. Error %s and message %s',
20-
json_last_error(),
21-
json_last_error_msg()
22-
));
17+
if (\JSON_ERROR_NONE !== json_last_error()) {
18+
throw new \InvalidArgumentException(sprintf('The malformed json given. Error %s and message %s', json_last_error(), json_last_error_msg()));
2319
}
2420

2521
return $json;
@@ -28,12 +24,8 @@ public function toString(RdKafkaMessage $message): string
2824
public function toMessage(string $string): RdKafkaMessage
2925
{
3026
$data = json_decode($string, true);
31-
if (JSON_ERROR_NONE !== json_last_error()) {
32-
throw new \InvalidArgumentException(sprintf(
33-
'The malformed json given. Error %s and message %s',
34-
json_last_error(),
35-
json_last_error_msg()
36-
));
27+
if (\JSON_ERROR_NONE !== json_last_error()) {
28+
throw new \InvalidArgumentException(sprintf('The malformed json given. Error %s and message %s', json_last_error(), json_last_error_msg()));
3729
}
3830

3931
return new RdKafkaMessage($data['body'], $data['properties'], $data['headers']);

RdKafkaConsumer.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function getOffset(): ?int
7171
return $this->offset;
7272
}
7373

74-
public function setOffset(int $offset = null): void
74+
public function setOffset(?int $offset = null): void
7575
{
7676
if ($this->subscribed) {
7777
throw new \LogicException('The consumer has already subscribed.');

RdKafkaMessage.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public function setRedelivered(bool $redelivered): void
112112
$this->redelivered = $redelivered;
113113
}
114114

115-
public function setCorrelationId(string $correlationId = null): void
115+
public function setCorrelationId(?string $correlationId = null): void
116116
{
117117
$this->setHeader('correlation_id', (string) $correlationId);
118118
}
@@ -122,7 +122,7 @@ public function getCorrelationId(): ?string
122122
return $this->getHeader('correlation_id');
123123
}
124124

125-
public function setMessageId(string $messageId = null): void
125+
public function setMessageId(?string $messageId = null): void
126126
{
127127
$this->setHeader('message_id', (string) $messageId);
128128
}
@@ -139,12 +139,12 @@ public function getTimestamp(): ?int
139139
return null === $value ? null : (int) $value;
140140
}
141141

142-
public function setTimestamp(int $timestamp = null): void
142+
public function setTimestamp(?int $timestamp = null): void
143143
{
144144
$this->setHeader('timestamp', $timestamp);
145145
}
146146

147-
public function setReplyTo(string $replyTo = null): void
147+
public function setReplyTo(?string $replyTo = null): void
148148
{
149149
$this->setHeader('reply_to', $replyTo);
150150
}
@@ -159,7 +159,7 @@ public function getPartition(): ?int
159159
return $this->partition;
160160
}
161161

162-
public function setPartition(int $partition = null): void
162+
public function setPartition(?int $partition = null): void
163163
{
164164
$this->partition = $partition;
165165
}
@@ -169,7 +169,7 @@ public function getKey(): ?string
169169
return $this->key;
170170
}
171171

172-
public function setKey(string $key = null): void
172+
public function setKey(?string $key = null): void
173173
{
174174
$this->key = $key;
175175
}
@@ -179,7 +179,7 @@ public function getKafkaMessage(): ?VendorMessage
179179
return $this->kafkaMessage;
180180
}
181181

182-
public function setKafkaMessage(VendorMessage $message = null): void
182+
public function setKafkaMessage(?VendorMessage $message = null): void
183183
{
184184
$this->kafkaMessage = $message;
185185
}

RdKafkaProducer.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function send(Destination $destination, Message $message): void
7070
/**
7171
* @return RdKafkaProducer
7272
*/
73-
public function setDeliveryDelay(int $deliveryDelay = null): Producer
73+
public function setDeliveryDelay(?int $deliveryDelay = null): Producer
7474
{
7575
if (null === $deliveryDelay) {
7676
return $this;
@@ -87,7 +87,7 @@ public function getDeliveryDelay(): ?int
8787
/**
8888
* @return RdKafkaProducer
8989
*/
90-
public function setPriority(int $priority = null): Producer
90+
public function setPriority(?int $priority = null): Producer
9191
{
9292
if (null === $priority) {
9393
return $this;
@@ -101,7 +101,7 @@ public function getPriority(): ?int
101101
return null;
102102
}
103103

104-
public function setTimeToLive(int $timeToLive = null): Producer
104+
public function setTimeToLive(?int $timeToLive = null): Producer
105105
{
106106
if (null === $timeToLive) {
107107
return $this;

RdKafkaTopic.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function getConf(): ?TopicConf
5050
return $this->conf;
5151
}
5252

53-
public function setConf(TopicConf $conf = null): void
53+
public function setConf(?TopicConf $conf = null): void
5454
{
5555
$this->conf = $conf;
5656
}
@@ -60,7 +60,7 @@ public function getPartition(): ?int
6060
return $this->partition;
6161
}
6262

63-
public function setPartition(int $partition = null): void
63+
public function setPartition(?int $partition = null): void
6464
{
6565
$this->partition = $partition;
6666
}
@@ -70,7 +70,7 @@ public function getKey(): ?string
7070
return $this->key;
7171
}
7272

73-
public function setKey(string $key = null): void
73+
public function setKey(?string $key = null): void
7474
{
7575
$this->key = $key;
7676
}

SerializerAwareTrait.php

-3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ trait SerializerAwareTrait
1111
*/
1212
private $serializer;
1313

14-
/**
15-
* @param Serializer $serializer
16-
*/
1714
public function setSerializer(Serializer $serializer)
1815
{
1916
$this->serializer = $serializer;

Tests/RdKafkaConnectionFactoryConfigTest.php

-3
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@ public function testThrowIfSchemeIsNotSupported()
3333

3434
/**
3535
* @dataProvider provideConfigs
36-
*
37-
* @param mixed $config
38-
* @param mixed $expectedConfig
3936
*/
4037
public function testShouldParseConfigurationAsExpected($config, $expectedConfig)
4138
{

Tests/RdKafkaConnectionFactoryTest.php

-3
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,6 @@ public function testShouldBeExpectedDefaultDsnConfig()
7070

7171
/**
7272
* @dataProvider provideConfigs
73-
*
74-
* @param mixed $config
75-
* @param mixed $expectedConfig
7673
*/
7774
public function testShouldParseConfigurationAsExpected($config, $expectedConfig)
7875
{

Tests/Spec/RdKafkaMessageTest.php

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

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

Tests/Spec/RdKafkaTopicTest.php

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

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

Tests/bootstrap.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
if (false == file_exists($kafkaStubsDir)) {
99
$kafkaStubsDir = __DIR__.'/../../../vendor/kwn/php-rdkafka-stubs';
1010
if (false == file_exists($kafkaStubsDir)) {
11-
throw new \LogicException('The kafka extension is not loaded and stubs could not be found as well');
11+
throw new LogicException('The kafka extension is not loaded and stubs could not be found as well');
1212
}
1313
}
1414

0 commit comments

Comments
 (0)