Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 2b6ffb9

Browse files
committedJan 4, 2018
Force PHPCS to require trailing comma on arrays
1 parent 299e02e commit 2b6ffb9

21 files changed

+54
-53
lines changed
 

‎example/protocol/CommitOffset.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ protected function syncGroup()
5959
[
6060
'topic_name' => 'test',
6161
'partitions' => [
62-
0
62+
0,
6363
],
6464
],
6565
],
@@ -104,9 +104,9 @@ public function run()
104104
'partition' => 0,
105105
'offset' => 45,
106106
'metadata' => '',
107-
]
108-
]
109-
]
107+
],
108+
],
109+
],
110110
],
111111
];
112112

‎example/protocol/DescribeGroups.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ protected function syncGroup()
5959
[
6060
'topic_name' => 'test',
6161
'partitions' => [
62-
0
62+
0,
6363
],
6464
],
6565
],
@@ -92,7 +92,7 @@ public function run()
9292
$this->joinGroup();
9393
$this->syncGroup();
9494
$data = [
95-
'test'
95+
'test',
9696
];
9797

9898
\Kafka\Protocol::init('0.9.1.0');

‎example/protocol/Fetch.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
'partition_id' => 0,
1414
'offset' => 45,
1515
'max_bytes' => 1024,
16-
]
16+
],
1717
],
1818
],
1919
],

‎example/protocol/FetchOffset.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
'data' => [
77
[
88
'topic_name' => 'test',
9-
'partitions' => [0]
10-
]
9+
'partitions' => [0],
10+
],
1111
],
1212
];
1313

‎example/protocol/Heartbeat.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ protected function syncGroup()
5959
[
6060
'topic_name' => 'test',
6161
'partitions' => [
62-
0
62+
0,
6363
],
6464
],
6565
],

‎example/protocol/LeaveGroup.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ protected function syncGroup()
5959
[
6060
'topic_name' => 'test',
6161
'partitions' => [
62-
0
62+
0,
6363
],
6464
],
6565
],

‎example/protocol/ListGroup.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ protected function syncGroup()
5959
[
6060
'topic_name' => 'test',
6161
'partitions' => [
62-
0
62+
0,
6363
],
6464
],
6565
],

‎example/protocol/MetaData.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
require '../../vendor/autoload.php';
33

44
$data = [
5-
'test'
5+
'test',
66
];
77

88
\Kafka\Protocol::init('1.0.0');

‎example/protocol/SyncGroup.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function run()
5959
[
6060
'topic_name' => 'test',
6161
'partitions' => [
62-
0
62+
0,
6363
],
6464
],
6565
],

‎phpcs.xml.dist

+1
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,6 @@
4545
<rule ref="SlevomatCodingStandard.Classes.UnusedPrivateElements" />
4646
<rule ref="SlevomatCodingStandard.Namespaces.UseFromSameNamespace" />
4747
<rule ref="SlevomatCodingStandard.Exceptions.DeadCatch" />
48+
<rule ref="SlevomatCodingStandard.Arrays.TrailingArrayComma" />
4849
</ruleset>
4950

‎src/Broker.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -221,12 +221,12 @@ private function judgeConnectionConfig() : ?SaslMechanism
221221

222222
$plainConnections = [
223223
Config::SECURITY_PROTOCOL_PLAINTEXT,
224-
Config::SECURITY_PROTOCOL_SASL_PLAINTEXT
224+
Config::SECURITY_PROTOCOL_SASL_PLAINTEXT,
225225
];
226226

227227
$saslConnections = [
228228
Config::SECURITY_PROTOCOL_SASL_SSL,
229-
Config::SECURITY_PROTOCOL_SASL_PLAINTEXT
229+
Config::SECURITY_PROTOCOL_SASL_PLAINTEXT,
230230
];
231231

232232
$securityProtocol = $this->config->getSecurityProtocol();

‎src/Config.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@ abstract class Config
4343
self::SECURITY_PROTOCOL_PLAINTEXT,
4444
self::SECURITY_PROTOCOL_SSL,
4545
self::SECURITY_PROTOCOL_SASL_PLAINTEXT,
46-
self::SECURITY_PROTOCOL_SASL_SSL
46+
self::SECURITY_PROTOCOL_SASL_SSL,
4747
];
4848

4949
private const ALLOW_MECHANISMS = [
5050
self::SASL_MECHANISMS_PLAIN,
5151
self::SASL_MECHANISMS_GSSAPI,
5252
self::SASL_MECHANISMS_SCRAM_SHA_256,
53-
self::SASL_MECHANISMS_SCRAM_SHA_512
53+
self::SASL_MECHANISMS_SCRAM_SHA_512,
5454
];
5555

5656
protected static $options = [];

‎src/Consumer/Assignment.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public function assign($result)
8282
$item = [
8383
'version' => 0,
8484
'member_id' => $member['memberId'],
85-
'assignments' => isset($members[$key]) ? $members[$key] : []
85+
'assignments' => isset($members[$key]) ? $members[$key] : [],
8686
];
8787
$data[] = $item;
8888
}

‎src/Protocol.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ class Protocol
151151
57 => 'The user-specified log directory is not found in the broker config.',
152152
58 => 'SASL Authentication failed.',
153153
59 => 'This exception is raised by the broker if it could not locate the producer metadata associated with the producerId in question',
154-
60 => 'A partition reassignment is in progress'
154+
60 => 'A partition reassignment is in progress',
155155
];
156156

157157
/**

‎tests/Base/BrokerTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,13 @@ public function testData()
9494
$brokers = [
9595
0 => '127.0.0.1:9092',
9696
1 => '127.0.0.1:9192',
97-
2 => '127.0.0.1:9292'
97+
2 => '127.0.0.1:9292',
9898
];
9999
$topics = [
100100
'test' => [
101101
0 => 0,
102102
1 => 2,
103-
]
103+
],
104104
];
105105
$this->assertEquals($brokers, $broker->getBrokers());
106106
$this->assertEquals($topics, $broker->getTopics());

‎tests/Functional/ProducerTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public function createMessages(int $amount = self::MESSAGES_TO_SEND): array
121121
for ($i = 0; $i < $amount; ++$i) {
122122
$messages[] = [
123123
'topic' => $this->topic,
124-
'value' => 'msg-' . str_pad((string) ($i + 1), 2, '0', STR_PAD_LEFT)
124+
'value' => 'msg-' . str_pad((string) ($i + 1), 2, '0', STR_PAD_LEFT),
125125
];
126126
}
127127

‎tests/Protocol/CommitOffsetTest.php

+17-17
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ public function testEncode(): void
2727
'partition' => 0,
2828
'offset' => 45,
2929
'metadata' => '',
30-
]
31-
]
32-
]
30+
],
31+
],
32+
],
3333
],
3434
];
3535

@@ -50,9 +50,9 @@ public function testEncodeDefault(): void
5050
[
5151
'partition' => 0,
5252
'offset' => 45,
53-
]
54-
]
55-
]
53+
],
54+
],
55+
],
5656
],
5757
];
5858

@@ -69,7 +69,7 @@ public function testEncodeDefault(): void
6969
public function testEncodeNoData(): void
7070
{
7171
$data = [
72-
'group_id' => 'test'
72+
'group_id' => 'test',
7373
];
7474

7575
$this->commit->encode($data);
@@ -82,7 +82,7 @@ public function testEncodeNoData(): void
8282
public function testEncodeNoGroupId(): void
8383
{
8484
$data = [
85-
'data' => []
85+
'data' => [],
8686
];
8787

8888
$this->commit->encode($data);
@@ -97,7 +97,7 @@ public function testEncodeNoTopicName(): void
9797
$data = [
9898
'group_id' => 'test',
9999
'data' => [
100-
[]
100+
[],
101101
],
102102
];
103103

@@ -115,7 +115,7 @@ public function testEncodeNoPartitions(): void
115115
'data' => [
116116
[
117117
'topic_name' => 'test',
118-
]
118+
],
119119
],
120120
];
121121

@@ -134,9 +134,9 @@ public function testEncodeNoPartition(): void
134134
[
135135
'topic_name' => 'test',
136136
'partitions' => [
137-
[]
138-
]
139-
]
137+
[],
138+
],
139+
],
140140
],
141141
];
142142

@@ -156,10 +156,10 @@ public function testEncodeNoOffset(): void
156156
'topic_name' => 'test',
157157
'partitions' => [
158158
[
159-
'partition' => 0
160-
]
161-
]
162-
]
159+
'partition' => 0,
160+
],
161+
],
162+
],
163163
],
164164
];
165165

‎tests/Protocol/FetchOffsetTest.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ public function testEncode(): void
1919
'data' => [
2020
[
2121
'topic_name' => 'test',
22-
'partitions' => [0]
23-
]
22+
'partitions' => [0],
23+
],
2424
],
2525
];
2626

@@ -46,7 +46,7 @@ public function testEncodeNoData(): void
4646
public function testEncodeNoGroupId(): void
4747
{
4848
$data = [
49-
'data' => []
49+
'data' => [],
5050
];
5151

5252
$this->offset->encode($data);
@@ -61,7 +61,7 @@ public function testEncodeNoTopicName(): void
6161
$data = [
6262
'group_id' => 'test',
6363
'data' => [
64-
[]
64+
[],
6565
],
6666
];
6767

@@ -79,7 +79,7 @@ public function testEncodeNoPartitions(): void
7979
'data' => [
8080
[
8181
'topic_name' => 'test',
82-
]
82+
],
8383
],
8484
];
8585

‎tests/Protocol/FetchTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function testEncode(): void
2626
'partition_id' => 0,
2727
'offset' => 45,
2828
'max_bytes' => 128,
29-
]
29+
],
3030
],
3131
],
3232
],
@@ -59,7 +59,7 @@ public function testEncodeNoOffset(): void
5959
'partitions' => [
6060
[
6161
'partition_id' => 0,
62-
]
62+
],
6363
],
6464
],
6565
],

‎tests/Protocol/ProduceTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function testEncodeForMessageKey(): void
5757
[
5858
'partition_id' => 0,
5959
'messages' => [
60-
['key' => 'testkey', 'value' => 'test...']
60+
['key' => 'testkey', 'value' => 'test...'],
6161
],
6262
],
6363
],
@@ -81,7 +81,7 @@ public function testEncodeForMessage(): void
8181
'partitions' => [
8282
[
8383
'partition_id' => 0,
84-
'messages' => 'test...'
84+
'messages' => 'test...',
8585
],
8686
],
8787
],

‎tests/Protocol/SyncGroupTest.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function testEncodeNoData(): void
6969
$data = [
7070
'group_id' => 'test',
7171
'generation_id' => '1',
72-
'member_id' => 'kafka-php-bd5d5bb2-2a1f-43d4-b831-b1510d81ac5c'
72+
'member_id' => 'kafka-php-bd5d5bb2-2a1f-43d4-b831-b1510d81ac5c',
7373
];
7474

7575
$this->sync->encode($data);
@@ -107,7 +107,7 @@ public function testEncodeNoDataMemberId(): void
107107
'member_id' => 'kafka-php-bd5d5bb2-2a1f-43d4-b831-b1510d81ac5c',
108108
'data' => [
109109
[
110-
'version' => 0
110+
'version' => 0,
111111
],
112112
],
113113
];
@@ -152,7 +152,7 @@ public function testEncodeNoTopicName(): void
152152
'member_id' => 'kafka-php-bd5d5bb2-2a1f-43d4-b831-b1510d81ac5c',
153153
'assignments' => [
154154
[],
155-
]
155+
],
156156
],
157157
],
158158
];
@@ -178,7 +178,7 @@ public function testEncodeNoPartitions(): void
178178
[
179179
'topic_name' => 'test',
180180
],
181-
]
181+
],
182182
],
183183
],
184184
];

0 commit comments

Comments
 (0)
Please sign in to comment.