Skip to content

Commit 4a88f20

Browse files
authored
Improve code style (#685)
* use php-cs-fixer to migrate code to php 7.4 * Apply php-cs-fixer changes Co-authored-by: mihaileu <mihaileu@users.noreply.github.com>
1 parent 597efd4 commit 4a88f20

Some content is hidden

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

42 files changed

+580
-580
lines changed

.php-cs-fixer.dist.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
$config
3838
->setRiskyAllowed(true)
3939
->setRules([
40+
'@PHP74Migration' => true,
4041
'@PSR12' => true,
4142
])
4243
->setFinder($finder)

Command/BaseConsumerCommand.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ protected function execute(InputInterface $input, OutputInterface $output)
8181
throw new \BadFunctionCallException("Function 'pcntl_signal' is referenced in the php.ini 'disable_functions' and can't be called.");
8282
}
8383

84-
pcntl_signal(SIGTERM, array(&$this, 'stopConsumer'));
85-
pcntl_signal(SIGINT, array(&$this, 'stopConsumer'));
86-
pcntl_signal(SIGHUP, array(&$this, 'restartConsumer'));
84+
pcntl_signal(SIGTERM, [&$this, 'stopConsumer']);
85+
pcntl_signal(SIGINT, [&$this, 'stopConsumer']);
86+
pcntl_signal(SIGHUP, [&$this, 'restartConsumer']);
8787
}
8888

8989
if (defined('AMQP_DEBUG') === false) {

Command/BatchConsumerCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
6767
throw new \BadFunctionCallException("Function 'pcntl_signal' is referenced in the php.ini 'disable_functions' and can't be called.");
6868
}
6969

70-
pcntl_signal(SIGTERM, array(&$this, 'stopConsumer'));
71-
pcntl_signal(SIGINT, array(&$this, 'stopConsumer'));
70+
pcntl_signal(SIGTERM, [&$this, 'stopConsumer']);
71+
pcntl_signal(SIGINT, [&$this, 'stopConsumer']);
7272
}
7373

7474
if (defined('AMQP_DEBUG') === false) {

Command/SetupFabricCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
2828

2929
$partsHolder = $this->getContainer()->get('old_sound_rabbit_mq.parts_holder');
3030

31-
foreach (array('base_amqp', 'binding') as $key) {
31+
foreach (['base_amqp', 'binding'] as $key) {
3232
foreach ($partsHolder->getParts('old_sound_rabbit_mq.' . $key) as $baseAmqp) {
3333
if ($baseAmqp instanceof DynamicConsumer) {
3434
continue;

Command/StdInProducerCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
5858
throw new \InvalidArgumentException(sprintf(
5959
'Invalid payload format "%s", expecting one of: %s.',
6060
$format,
61-
implode(', ', array(self::FORMAT_PHP, self::FORMAT_RAW))
61+
implode(', ', [self::FORMAT_PHP, self::FORMAT_RAW])
6262
));
6363
}
6464

DataCollector/MessageDataCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class MessageDataCollector extends DataCollector
1818
public function __construct($channels)
1919
{
2020
$this->channels = $channels;
21-
$this->data = array();
21+
$this->data = [];
2222
}
2323

2424
public function collect(Request $request, Response $response, \Throwable $exception = null)

DependencyInjection/Compiler/InjectEventDispatcherPass.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ public function process(ContainerBuilder $container)
3030
$definition = $container->getDefinition($id);
3131
$definition->addMethodCall(
3232
'setEventDispatcher',
33-
array(
34-
new Reference(self::EVENT_DISPATCHER_SERVICE_ID, ContainerInterface::IGNORE_ON_INVALID_REFERENCE)
35-
)
33+
[
34+
new Reference(self::EVENT_DISPATCHER_SERVICE_ID, ContainerInterface::IGNORE_ON_INVALID_REFERENCE),
35+
]
3636
);
3737
}
3838
}

DependencyInjection/Compiler/RegisterPartsPass.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public function process(ContainerBuilder $container)
1818

1919
$definition = $container->getDefinition('old_sound_rabbit_mq.parts_holder');
2020

21-
$tags = array(
21+
$tags = [
2222
'old_sound_rabbit_mq.base_amqp',
2323
'old_sound_rabbit_mq.binding',
2424
'old_sound_rabbit_mq.producer',
@@ -28,11 +28,11 @@ public function process(ContainerBuilder $container)
2828
'old_sound_rabbit_mq.batch_consumer',
2929
'old_sound_rabbit_mq.rpc_client',
3030
'old_sound_rabbit_mq.rpc_server',
31-
);
31+
];
3232

3333
foreach ($tags as $tag) {
3434
foreach ($container->findTaggedServiceIds($tag) as $id => $attributes) {
35-
$definition->addMethodCall('addPart', array($tag, new Reference($id)));
35+
$definition->addMethodCall('addPart', [$tag, new Reference($id)]);
3636
}
3737
}
3838
}

DependencyInjection/Configuration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ protected function addQueueNodeConfiguration(ArrayNodeDefinition $node)
459459
->scalarNode('ticket')->defaultNull()->end()
460460
->arrayNode('routing_keys')
461461
->prototype('scalar')->end()
462-
->defaultValue(array())
462+
->defaultValue([])
463463
->end()
464464
->end()
465465
;

0 commit comments

Comments
 (0)