Skip to content

Commit 7685091

Browse files
committed
Style CI
1 parent 12cfc80 commit 7685091

File tree

10 files changed

+33
-47
lines changed

10 files changed

+33
-47
lines changed

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
},
1717
"require-dev": {
1818
"phpunit/phpunit": "^5.5",
19-
"mockery/mockery": "^0.9.5"
19+
"mockery/mockery": "^0.9.5",
20+
"sllh/php-cs-fixer-styleci-bridge": "^2.1"
2021
},
2122
"autoload": {
2223
"psr-4": {

config/kafka.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88
return [
99

10-
/**
10+
/*
1111
* Driver name
1212
*/
1313
'driver' => 'kafka',
@@ -17,12 +17,12 @@
1717
*/
1818
'queue' => env('KAFKA_QUEUE', 'default'),
1919

20-
/**
20+
/*
2121
* The group of where the consumer in resides.
2222
*/
2323
'consumer_group_id' => env('KAFKA_CONSUMER_GROUP_ID', 'laravel_queue'),
2424

25-
/**
25+
/*
2626
* Address of the Kafka broker
2727
*/
2828
'brokers' => env('KAFKA_BROKERS', 'localhost'),

src/LaravelQueueKafkaServiceProvider.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,18 @@ class LaravelQueueKafkaServiceProvider extends ServiceProvider
1010
{
1111
/**
1212
* Register the service provider.
13-
*
14-
* @return void
1513
*/
1614
public function register()
1715
{
1816
$this->mergeConfigFrom(
19-
__DIR__.'/../config/kafka.php', 'queue.connections.kafka'
17+
__DIR__ . '/../config/kafka.php', 'queue.connections.kafka'
2018
);
2119

2220
$this->registerDependencies();
2321
}
2422

2523
/**
2624
* Register the application's event listeners.
27-
*
28-
* @return void
2925
*/
3026
public function boot()
3127
{

src/Queue/Jobs/KafkaJob.php

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,16 @@ class KafkaJob extends Job implements JobContract
2828

2929
/**
3030
* KafkaJob constructor.
31-
* @param KafkaQueue $connection
32-
* @param Message $message
31+
*
32+
* @param KafkaQueue $connection
33+
* @param Message $message
3334
* @param $queue
3435
*/
3536
public function __construct(
3637
KafkaQueue $connection,
3738
Message $message,
3839
$queue
39-
){
40+
) {
4041
$this->connection = $connection;
4142
$this->queue = $queue;
4243
$this->message = $message;
@@ -46,8 +47,6 @@ public function __construct(
4647
* Fire the job.
4748
*
4849
* @throws Exception
49-
*
50-
* @return void
5150
*/
5251
public function fire()
5352
{
@@ -93,8 +92,6 @@ public function getRawBody()
9392

9493
/**
9594
* Delete the job from the queue.
96-
*
97-
* @return void
9895
*/
9996
public function delete()
10097
{
@@ -108,8 +105,6 @@ public function delete()
108105
* @param int $delay
109106
*
110107
* @throws Exception
111-
*
112-
* @return void
113108
*/
114109
public function release($delay = 0)
115110
{
@@ -142,8 +137,6 @@ public function release($delay = 0)
142137
* Sets the count of attempts at processing this job.
143138
*
144139
* @param int $count
145-
*
146-
* @return void
147140
*/
148141
private function setAttempts($count)
149142
{
@@ -164,8 +157,6 @@ public function getJobId()
164157
* Sets the job identifier.
165158
*
166159
* @param string $id
167-
*
168-
* @return void
169160
*/
170161
public function setJobId($id)
171162
{

src/Queue/KafkaQueue.php

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ class KafkaQueue extends Queue implements QueueContract
3333
private $consumer;
3434

3535
/**
36-
* @param \RdKafka\Producer $producer
36+
* @param \RdKafka\Producer $producer
3737
* @param \RdKafka\KafkaConsumer $consumer
38-
* @param array $config
38+
* @param array $config
3939
*/
4040
public function __construct(\RdKafka\Producer $producer, \RdKafka\KafkaConsumer $consumer, $config)
4141
{
@@ -64,7 +64,7 @@ public function size($queue = null)
6464
* Push a new job onto the queue.
6565
*
6666
* @param string $job
67-
* @param mixed $data
67+
* @param mixed $data
6868
* @param string $queue
6969
*
7070
* @return bool
@@ -79,7 +79,7 @@ public function push($job, $data = '', $queue = null)
7979
*
8080
* @param string $payload
8181
* @param string $queue
82-
* @param array $options
82+
* @param array $options
8383
*
8484
* @return mixed
8585
*/
@@ -102,9 +102,9 @@ public function pushRaw($payload, $queue = null, array $options = [])
102102
* Push a new job onto the queue after a delay.
103103
*
104104
* @param \DateTime|int $delay
105-
* @param string $job
106-
* @param mixed $data
107-
* @param string $queue
105+
* @param string $job
106+
* @param mixed $data
107+
* @param string $queue
108108
*
109109
* @return mixed
110110
*/
@@ -191,27 +191,29 @@ public function getCorrelationId()
191191
/**
192192
* Create a payload array from the given job and data.
193193
*
194-
* @param string $job
195-
* @param mixed $data
196-
* @param string $queue
194+
* @param string $job
195+
* @param mixed $data
196+
* @param string $queue
197+
*
197198
* @return array
198199
*/
199-
protected function createPayloadArray($job, $data = '', $queue = null){
200-
return array_merge(parent::createPayloadArray($job, $data), [
200+
protected function createPayloadArray($job, $data = '', $queue = null)
201+
{
202+
return array_merge(parent::createPayloadArray($job, $data), [
201203
'id' => $this->getCorrelationId(),
202204
'attempts' => 0,
203205
]);
204206
}
205207

206208
/**
207-
* @param string $action
209+
* @param string $action
208210
* @param Exception $e
209211
*
210212
* @throws Exception
211213
*/
212214
protected function reportConnectionError($action, Exception $e)
213215
{
214-
Log::error('Kafka error while attempting '.$action.': '.$e->getMessage());
216+
Log::error('Kafka error while attempting ' . $action . ': ' . $e->getMessage());
215217

216218
// If it's set to false, throw an error rather than waiting
217219
if ($this->sleepOnError === false) {

tests/KafkaConnectorTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public function test_connect()
1414
'queue' => 'queue_name',
1515
'consumer_group_id' => 'php-pubsub',
1616
'brokers' => 'localhost',
17-
'sleep_on_error' => 5
17+
'sleep_on_error' => 5,
1818
];
1919

2020
$container = Mockery::mock(\Illuminate\Container\Container::class);
@@ -48,7 +48,6 @@ public function test_connect()
4848
->withArgs(['queue.kafka.conf', []])
4949
->andReturn($conf);
5050

51-
5251
$connector = new KafkaConnector($container);
5352
$queue = $connector->connect($config);
5453

tests/KafkaQueueTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ public function setUp()
1919
$this->producer = Mockery::mock(\RdKafka\Producer::class);
2020
$this->consumer = Mockery::mock(\RdKafka\KafkaConsumer::class);
2121

22-
2322
$this->config = [
2423
'queue' => str_random(),
2524
'sleep_error' => true,
@@ -56,7 +55,6 @@ public function test_later()
5655
$delay = 5;
5756
$job = new TestJob();
5857

59-
6058
$this->expectException(\Exception::class);
6159

6260
$this->queue->later($delay, $job);

tests/stubs/Consumer.php

Lines changed: 0 additions & 6 deletions
This file was deleted.

tests/stubs/ConsumerStub.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
3+
class ConsumerStub extends \RdKafka\Consumer
4+
{
5+
}

tests/stubs/ProducerStub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ public function addBrokers($broker_list)
66
{
77
//Do nothing
88
}
9-
}
9+
}

0 commit comments

Comments
 (0)