Skip to content

Commit 846d11f

Browse files
committed
remove unnecessary code and fix style
1 parent bf37655 commit 846d11f

File tree

6 files changed

+26
-36
lines changed

6 files changed

+26
-36
lines changed

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
"orchestra/testbench": "^v7.18.0",
1616
"squizlabs/php_codesniffer": "^3.7",
1717
"mockery/mockery": "^1.5.1",
18-
"dg/bypass-finals": "dev-master"
18+
"dg/bypass-finals": "dev-master",
19+
"rector/rector": "^0.15.3"
1920
},
2021
"autoload": {
2122
"psr-4": {

src/Connectors/RabbitMQConnector.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
namespace iamfarhad\LaravelRabbitMQ\Connectors;
44

5-
use iamfarhad\LaravelRabbitMQ\RabbitQueue;
6-
use Illuminate\Contracts\Events\Dispatcher;
7-
use Illuminate\Contracts\Queue\Queue;
85
use Illuminate\Queue\Connectors\ConnectorInterface;
9-
use Illuminate\Queue\Events\WorkerStopping;
10-
use PhpAmqpLib\Connection\AMQPConnectionConfig;
116
use PhpAmqpLib\Connection\AMQPConnectionFactory;
7+
use PhpAmqpLib\Connection\AMQPConnectionConfig;
8+
use Illuminate\Contracts\Events\Dispatcher;
9+
use Illuminate\Queue\Events\WorkerStopping;
10+
use iamfarhad\LaravelRabbitMQ\RabbitQueue;
11+
use Illuminate\Contracts\Queue\Queue;
1212

1313
class RabbitMQConnector implements ConnectorInterface
1414
{

src/Console/ConsumeCommand.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22

33
namespace iamfarhad\LaravelRabbitMQ\Console;
44

5+
use Symfony\Component\Console\Attribute\AsCommand;
56
use Illuminate\Queue\Console\WorkCommand;
67
use Illuminate\Support\Str;
7-
use iamfarhad\LaravelRabbitMQ\Consumer;
8-
use Symfony\Component\Console\Attribute\AsCommand;
98

109
#[AsCommand(name: 'rabbitmq:consume')]
1110
final class ConsumeCommand extends WorkCommand

src/Jobs/RabbitMQJob.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,13 @@
22

33
namespace iamfarhad\LaravelRabbitMQ\Jobs;
44

5-
use Illuminate\Container\Container;
6-
use Illuminate\Contracts\Container\BindingResolutionException;
75
use Illuminate\Contracts\Queue\Job as JobContract;
6+
use iamfarhad\LaravelRabbitMQ\RabbitQueue;
7+
use Illuminate\Container\Container;
8+
use PhpAmqpLib\Message\AMQPMessage;
89
use Illuminate\Queue\Jobs\Job;
910
use Illuminate\Support\Arr;
1011
use JsonException;
11-
use PhpAmqpLib\Exception\AMQPProtocolChannelException;
12-
use PhpAmqpLib\Message\AMQPMessage;
13-
use PhpAmqpLib\Wire\AMQPTable;
14-
use iamfarhad\LaravelRabbitMQ\RabbitQueue;
1512

1613
final class RabbitMQJob extends Job implements JobContract
1714
{
@@ -131,9 +128,6 @@ public function getRabbitMQMessage(): AMQPMessage
131128

132129
private function getRabbitMQMessageHeaders(): ?array
133130
{
134-
/*
135-
* @var AMQPTable|null $headers
136-
*/
137131
if (! $headers = Arr::get($this->amqpMessage->get_properties(), 'application_headers')) {
138132
return null;
139133
}

src/LaravelRabbitQueueServiceProvider.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
use iamfarhad\LaravelRabbitMQ\Connectors\RabbitMQConnector;
66
use iamfarhad\LaravelRabbitMQ\Console\ConsumeCommand;
77
use Illuminate\Contracts\Debug\ExceptionHandler;
8-
use Illuminate\Queue\QueueManager;
98
use Illuminate\Support\ServiceProvider;
109

1110
final class LaravelRabbitQueueServiceProvider extends ServiceProvider
@@ -20,7 +19,7 @@ public function register(): void
2019
if ($this->app->runningInConsole()) {
2120
$this->app->singleton(
2221
'rabbitmq.consumer',
23-
function (): \iamfarhad\LaravelRabbitMQ\Consumer {
22+
function (): Consumer {
2423
$isDownForMaintenance = fn(): bool => $this->app->isDownForMaintenance();
2524

2625
return new Consumer(
@@ -34,7 +33,7 @@ function (): \iamfarhad\LaravelRabbitMQ\Consumer {
3433

3534
$this->app->singleton(
3635
ConsumeCommand::class,
37-
static fn($app): \iamfarhad\LaravelRabbitMQ\Console\ConsumeCommand => new ConsumeCommand(
36+
static fn($app): ConsumeCommand => new ConsumeCommand(
3837
$app['rabbitmq.consumer'],
3938
$app['cache.store']
4039
)
@@ -50,11 +49,8 @@ function (): \iamfarhad\LaravelRabbitMQ\Consumer {
5049

5150
public function boot(): void
5251
{
53-
/*
54-
* @var QueueManager $queue
55-
*/
5652
$queue = $this->app['queue'];
5753

58-
$queue->addConnector('rabbitmq', fn(): \iamfarhad\LaravelRabbitMQ\Connectors\RabbitMQConnector => new RabbitMQConnector($this->app['events']));
54+
$queue->addConnector('rabbitmq', fn(): RabbitMQConnector => new RabbitMQConnector($this->app['events']));
5955
}
6056
}

src/RabbitQueue.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,29 @@
22

33
namespace iamfarhad\LaravelRabbitMQ;
44

5-
use ErrorException;
6-
use Exception;
7-
use iamfarhad\LaravelRabbitMQ\Connectors\RabbitMQConnector;
8-
use iamfarhad\LaravelRabbitMQ\Jobs\RabbitMQJob;
9-
use Illuminate\Queue\Queue;
10-
use Illuminate\Contracts\Queue\Queue as QueueContract;
11-
use Illuminate\Support\Arr;
12-
use Illuminate\Support\Str;
13-
use JsonException;
14-
use PhpAmqpLib\Channel\AMQPChannel;
15-
use PhpAmqpLib\Connection\AbstractConnection;
16-
use PhpAmqpLib\Exception\AMQPChannelClosedException;
175
use PhpAmqpLib\Exception\AMQPConnectionClosedException;
6+
use Illuminate\Contracts\Queue\Queue as QueueContract;
187
use PhpAmqpLib\Exception\AMQPProtocolChannelException;
8+
use PhpAmqpLib\Exception\AMQPChannelClosedException;
9+
use iamfarhad\LaravelRabbitMQ\Jobs\RabbitMQJob;
1910
use PhpAmqpLib\Exception\AMQPRuntimeException;
11+
use PhpAmqpLib\Connection\AbstractConnection;
2012
use PhpAmqpLib\Exchange\AMQPExchangeType;
13+
use PhpAmqpLib\Channel\AMQPChannel;
2114
use PhpAmqpLib\Message\AMQPMessage;
2215
use PhpAmqpLib\Wire\AMQPTable;
16+
use Illuminate\Queue\Queue;
17+
use Illuminate\Support\Arr;
18+
use Illuminate\Support\Str;
19+
use ErrorException;
20+
use JsonException;
21+
use Exception;
2322
use Throwable;
2423

2524
class RabbitQueue extends Queue implements QueueContract
2625
{
2726
private AMQPChannel $amqpChannel;
27+
2828
private RabbitMQJob $rabbitMQJob;
2929

3030
public function __construct(

0 commit comments

Comments
 (0)