Skip to content

Commit ec159c7

Browse files
committed
Merge branch '4.1' into 4.2
* 4.1: fixed tests fixed CS fixed CS fixed CS fixed short array CS in comments fixed CS in ExpressionLanguage fixtures fixed CS in generated files fixed CS on generated container files fixed CS on Form PHP templates fixed CS on YAML fixtures fixed fixtures switched array() to []
2 parents 7736168 + 04f038c commit ec159c7

14 files changed

+103
-103
lines changed

Command/DebugCommand.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,24 +74,24 @@ protected function execute(InputInterface $input, OutputInterface $output)
7474
if (!isset($mapping[$bus])) {
7575
throw new RuntimeException(sprintf('Bus "%s" does not exist. Known buses are %s.', $bus, implode(', ', array_keys($this->mapping))));
7676
}
77-
$mapping = array($bus => $mapping[$bus]);
77+
$mapping = [$bus => $mapping[$bus]];
7878
}
7979

8080
foreach ($mapping as $bus => $handlersByMessage) {
8181
$io->section($bus);
8282

83-
$tableRows = array();
83+
$tableRows = [];
8484
foreach ($handlersByMessage as $message => $handlers) {
85-
$tableRows[] = array(sprintf('<fg=cyan>%s</fg=cyan>', $message));
85+
$tableRows[] = [sprintf('<fg=cyan>%s</fg=cyan>', $message)];
8686
foreach ($handlers as $handler) {
87-
$tableRows[] = array(sprintf(' handled by <info>%s</>', $handler));
87+
$tableRows[] = [sprintf(' handled by <info>%s</>', $handler)];
8888
}
8989
}
9090

9191
if ($tableRows) {
9292
$io->text('The following messages can be dispatched:');
9393
$io->newLine();
94-
$io->table(array(), $tableRows);
94+
$io->table([], $tableRows);
9595
} else {
9696
$io->warning(sprintf('No handled message found in bus "%s".', $bus));
9797
}

MessageBus.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class MessageBus implements MessageBusInterface
2828
/**
2929
* @param MiddlewareInterface[]|iterable $middlewareHandlers
3030
*/
31-
public function __construct(iterable $middlewareHandlers = array())
31+
public function __construct(iterable $middlewareHandlers = [])
3232
{
3333
if ($middlewareHandlers instanceof \IteratorAggregate) {
3434
$this->middlewareAggregate = $middlewareHandlers;

Tests/Command/DebugCommandTest.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,20 @@ protected function tearDown()
3939
public function testOutput()
4040
{
4141
$command = new DebugCommand(
42-
array(
43-
'command_bus' => array(
44-
DummyCommand::class => array(DummyCommandHandler::class),
45-
MultipleBusesMessage::class => array(MultipleBusesMessageHandler::class),
46-
),
47-
'query_bus' => array(
48-
DummyQuery::class => array(DummyQueryHandler::class),
49-
MultipleBusesMessage::class => array(MultipleBusesMessageHandler::class),
50-
),
51-
)
42+
[
43+
'command_bus' => [
44+
DummyCommand::class => [DummyCommandHandler::class],
45+
MultipleBusesMessage::class => [MultipleBusesMessageHandler::class],
46+
],
47+
'query_bus' => [
48+
DummyQuery::class => [DummyQueryHandler::class],
49+
MultipleBusesMessage::class => [MultipleBusesMessageHandler::class],
50+
],
51+
]
5252
);
5353

5454
$tester = new CommandTester($command);
55-
$tester->execute(array(), array('decorated' => false));
55+
$tester->execute([], ['decorated' => false]);
5656

5757
$this->assertSame(<<<TXT
5858
@@ -88,7 +88,7 @@ public function testOutput()
8888
, $tester->getDisplay(true)
8989
);
9090

91-
$tester->execute(array('bus' => 'query_bus'), array('decorated' => false));
91+
$tester->execute(['bus' => 'query_bus'], ['decorated' => false]);
9292

9393
$this->assertSame(<<<TXT
9494
@@ -115,10 +115,10 @@ public function testOutput()
115115

116116
public function testOutputWithoutMessages()
117117
{
118-
$command = new DebugCommand(array('command_bus' => array(), 'query_bus' => array()));
118+
$command = new DebugCommand(['command_bus' => [], 'query_bus' => []]);
119119

120120
$tester = new CommandTester($command);
121-
$tester->execute(array(), array('decorated' => false));
121+
$tester->execute([], ['decorated' => false]);
122122

123123
$this->assertSame(<<<TXT
124124
@@ -147,9 +147,9 @@ public function testOutputWithoutMessages()
147147
*/
148148
public function testExceptionOnUnknownBusArgument()
149149
{
150-
$command = new DebugCommand(array('command_bus' => array(), 'query_bus' => array()));
150+
$command = new DebugCommand(['command_bus' => [], 'query_bus' => []]);
151151

152152
$tester = new CommandTester($command);
153-
$tester->execute(array('bus' => 'unknown_bus'), array('decorated' => false));
153+
$tester->execute(['bus' => 'unknown_bus'], ['decorated' => false]);
154154
}
155155
}

Tests/Transport/AmqpExt/AmqpExtIntegrationTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ protected function setUp()
4141
public function testItSendsAndReceivesMessages()
4242
{
4343
$serializer = new Serializer(
44-
new SerializerComponent\Serializer(array(new ObjectNormalizer()), array('json' => new JsonEncoder()))
44+
new SerializerComponent\Serializer([new ObjectNormalizer()], ['json' => new JsonEncoder()])
4545
);
4646

4747
$connection = Connection::fromDsn(getenv('MESSENGER_AMQP_DSN'));
@@ -67,7 +67,7 @@ public function testItSendsAndReceivesMessages()
6767
public function testItReceivesSignals()
6868
{
6969
$serializer = new Serializer(
70-
new SerializerComponent\Serializer(array(new ObjectNormalizer()), array('json' => new JsonEncoder()))
70+
new SerializerComponent\Serializer([new ObjectNormalizer()], ['json' => new JsonEncoder()])
7171
);
7272

7373
$connection = Connection::fromDsn(getenv('MESSENGER_AMQP_DSN'));
@@ -79,10 +79,10 @@ public function testItReceivesSignals()
7979

8080
$amqpReadTimeout = 30;
8181
$dsn = getenv('MESSENGER_AMQP_DSN').'?read_timeout='.$amqpReadTimeout;
82-
$process = new PhpProcess(file_get_contents(__DIR__.'/Fixtures/long_receiver.php'), null, array(
82+
$process = new PhpProcess(file_get_contents(__DIR__.'/Fixtures/long_receiver.php'), null, [
8383
'COMPONENT_ROOT' => __DIR__.'/../../../',
8484
'DSN' => $dsn,
85-
));
85+
]);
8686

8787
$process->start();
8888

@@ -116,10 +116,10 @@ public function testItReceivesSignals()
116116
public function testItSupportsTimeoutAndTicksNullMessagesToTheHandler()
117117
{
118118
$serializer = new Serializer(
119-
new SerializerComponent\Serializer(array(new ObjectNormalizer()), array('json' => new JsonEncoder()))
119+
new SerializerComponent\Serializer([new ObjectNormalizer()], ['json' => new JsonEncoder()])
120120
);
121121

122-
$connection = Connection::fromDsn(getenv('MESSENGER_AMQP_DSN'), array('read_timeout' => '1'));
122+
$connection = Connection::fromDsn(getenv('MESSENGER_AMQP_DSN'), ['read_timeout' => '1']);
123123
$connection->setup();
124124
$connection->queue()->purge();
125125

Tests/Transport/AmqpExt/AmqpReceiverTest.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ class AmqpReceiverTest extends TestCase
3030
public function testItSendTheDecodedMessageToTheHandlerAndAcknowledgeIt()
3131
{
3232
$serializer = new Serializer(
33-
new SerializerComponent\Serializer(array(new ObjectNormalizer()), array('json' => new JsonEncoder()))
33+
new SerializerComponent\Serializer([new ObjectNormalizer()], ['json' => new JsonEncoder()])
3434
);
3535

3636
$envelope = $this->getMockBuilder(\AMQPEnvelope::class)->getMock();
3737
$envelope->method('getBody')->willReturn('{"message": "Hi"}');
38-
$envelope->method('getHeaders')->willReturn(array(
38+
$envelope->method('getHeaders')->willReturn([
3939
'type' => DummyMessage::class,
40-
));
40+
]);
4141

4242
$connection = $this->getMockBuilder(Connection::class)->disableOriginalConstructor()->getMock();
4343
$connection->method('get')->willReturn($envelope);
@@ -57,14 +57,14 @@ public function testItSendTheDecodedMessageToTheHandlerAndAcknowledgeIt()
5757
public function testItNonAcknowledgeTheMessageIfAnExceptionHappened()
5858
{
5959
$serializer = new Serializer(
60-
new SerializerComponent\Serializer(array(new ObjectNormalizer()), array('json' => new JsonEncoder()))
60+
new SerializerComponent\Serializer([new ObjectNormalizer()], ['json' => new JsonEncoder()])
6161
);
6262

6363
$envelope = $this->getMockBuilder(\AMQPEnvelope::class)->getMock();
6464
$envelope->method('getBody')->willReturn('{"message": "Hi"}');
65-
$envelope->method('getHeaders')->willReturn(array(
65+
$envelope->method('getHeaders')->willReturn([
6666
'type' => DummyMessage::class,
67-
));
67+
]);
6868

6969
$connection = $this->getMockBuilder(Connection::class)->disableOriginalConstructor()->getMock();
7070
$connection->method('get')->willReturn($envelope);
@@ -83,14 +83,14 @@ public function testItNonAcknowledgeTheMessageIfAnExceptionHappened()
8383
public function testItRejectsTheMessageIfTheExceptionIsARejectMessageExceptionInterface()
8484
{
8585
$serializer = new Serializer(
86-
new SerializerComponent\Serializer(array(new ObjectNormalizer()), array('json' => new JsonEncoder()))
86+
new SerializerComponent\Serializer([new ObjectNormalizer()], ['json' => new JsonEncoder()])
8787
);
8888

8989
$envelope = $this->getMockBuilder(\AMQPEnvelope::class)->getMock();
9090
$envelope->method('getBody')->willReturn('{"message": "Hi"}');
91-
$envelope->method('getHeaders')->willReturn(array(
91+
$envelope->method('getHeaders')->willReturn([
9292
'type' => DummyMessage::class,
93-
));
93+
]);
9494

9595
$connection = $this->getMockBuilder(Connection::class)->disableOriginalConstructor()->getMock();
9696
$connection->method('get')->willReturn($envelope);

Tests/Transport/AmqpExt/ConnectionTest.php

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -32,56 +32,56 @@ public function testItCannotBeConstructedWithAWrongDsn()
3232
public function testItGetsParametersFromTheDsn()
3333
{
3434
$this->assertEquals(
35-
new Connection(array(
35+
new Connection([
3636
'host' => 'localhost',
3737
'port' => 5672,
3838
'vhost' => '/',
39-
), array(
39+
], [
4040
'name' => 'messages',
41-
), array(
41+
], [
4242
'name' => 'messages',
43-
)),
43+
]),
4444
Connection::fromDsn('amqp://localhost/%2f/messages')
4545
);
4646
}
4747

4848
public function testOverrideOptionsViaQueryParameters()
4949
{
5050
$this->assertEquals(
51-
new Connection(array(
51+
new Connection([
5252
'host' => 'redis',
5353
'port' => 1234,
5454
'vhost' => '/',
5555
'login' => 'guest',
5656
'password' => 'password',
57-
), array(
57+
], [
5858
'name' => 'exchangeName',
59-
), array(
59+
], [
6060
'name' => 'queue',
61-
)),
61+
]),
6262
Connection::fromDsn('amqp://guest:password@redis:1234/%2f/queue?exchange[name]=exchangeName')
6363
);
6464
}
6565

6666
public function testOptionsAreTakenIntoAccountAndOverwrittenByDsn()
6767
{
6868
$this->assertEquals(
69-
new Connection(array(
69+
new Connection([
7070
'host' => 'redis',
7171
'port' => 1234,
7272
'vhost' => '/',
7373
'login' => 'guest',
7474
'password' => 'password',
7575
'persistent' => 'true',
76-
), array(
76+
], [
7777
'name' => 'exchangeName',
78-
), array(
78+
], [
7979
'name' => 'queueName',
80-
)),
81-
Connection::fromDsn('amqp://guest:password@redis:1234/%2f/queue?exchange[name]=exchangeName&queue[name]=queueName', array(
80+
]),
81+
Connection::fromDsn('amqp://guest:password@redis:1234/%2f/queue?exchange[name]=exchangeName&queue[name]=queueName', [
8282
'persistent' => 'true',
83-
'exchange' => array('name' => 'toBeOverwritten'),
84-
))
83+
'exchange' => ['name' => 'toBeOverwritten'],
84+
])
8585
);
8686
}
8787

@@ -94,27 +94,27 @@ public function testSetsParametersOnTheQueueAndExchange()
9494
$amqpExchange = $this->getMockBuilder(\AMQPExchange::class)->disableOriginalConstructor()->getMock()
9595
);
9696

97-
$amqpQueue->expects($this->once())->method('setArguments')->with(array(
97+
$amqpQueue->expects($this->once())->method('setArguments')->with([
9898
'x-dead-letter-exchange' => 'dead-exchange',
9999
'x-message-ttl' => '1200',
100-
));
100+
]);
101101

102-
$amqpExchange->expects($this->once())->method('setArguments')->with(array(
102+
$amqpExchange->expects($this->once())->method('setArguments')->with([
103103
'alternate-exchange' => 'alternate',
104-
));
104+
]);
105105

106-
$connection = Connection::fromDsn('amqp://localhost/%2f/messages?queue[arguments][x-dead-letter-exchange]=dead-exchange', array(
107-
'queue' => array(
108-
'arguments' => array(
106+
$connection = Connection::fromDsn('amqp://localhost/%2f/messages?queue[arguments][x-dead-letter-exchange]=dead-exchange', [
107+
'queue' => [
108+
'arguments' => [
109109
'x-message-ttl' => '1200',
110-
),
111-
),
112-
'exchange' => array(
113-
'arguments' => array(
110+
],
111+
],
112+
'exchange' => [
113+
'arguments' => [
114114
'alternate-exchange' => 'alternate',
115-
),
116-
),
117-
), true, $factory);
115+
],
116+
],
117+
], true, $factory);
118118
$connection->publish('body');
119119
}
120120

@@ -129,7 +129,7 @@ public function testItUsesANormalConnectionByDefault()
129129

130130
$amqpConnection->expects($this->once())->method('connect');
131131

132-
$connection = Connection::fromDsn('amqp://localhost/%2f/messages', array(), false, $factory);
132+
$connection = Connection::fromDsn('amqp://localhost/%2f/messages', [], false, $factory);
133133
$connection->publish('body');
134134
}
135135

@@ -144,7 +144,7 @@ public function testItAllowsToUseAPersistentConnection()
144144

145145
$amqpConnection->expects($this->once())->method('pconnect');
146146

147-
$connection = Connection::fromDsn('amqp://localhost/%2f/messages?persistent=true', array(), false, $factory);
147+
$connection = Connection::fromDsn('amqp://localhost/%2f/messages?persistent=true', [], false, $factory);
148148
$connection->publish('body');
149149
}
150150

@@ -162,7 +162,7 @@ public function testItSetupsTheConnectionWhenDebug()
162162
$amqpQueue->expects($this->once())->method('declareQueue');
163163
$amqpQueue->expects($this->once())->method('bind')->with('exchange_name', 'my_key');
164164

165-
$connection = Connection::fromDsn('amqp://localhost/%2f/messages?queue[routing_key]=my_key', array(), true, $factory);
165+
$connection = Connection::fromDsn('amqp://localhost/%2f/messages?queue[routing_key]=my_key', [], true, $factory);
166166
$connection->publish('body');
167167
}
168168

@@ -180,13 +180,13 @@ public function testItCanDisableTheSetup()
180180
$amqpQueue->expects($this->never())->method('declareQueue');
181181
$amqpQueue->expects($this->never())->method('bind');
182182

183-
$connection = Connection::fromDsn('amqp://localhost/%2f/messages?queue[routing_key]=my_key', array('auto-setup' => 'false'), true, $factory);
183+
$connection = Connection::fromDsn('amqp://localhost/%2f/messages?queue[routing_key]=my_key', ['auto-setup' => 'false'], true, $factory);
184184
$connection->publish('body');
185185

186-
$connection = Connection::fromDsn('amqp://localhost/%2f/messages?queue[routing_key]=my_key', array('auto-setup' => false), true, $factory);
186+
$connection = Connection::fromDsn('amqp://localhost/%2f/messages?queue[routing_key]=my_key', ['auto-setup' => false], true, $factory);
187187
$connection->publish('body');
188188

189-
$connection = Connection::fromDsn('amqp://localhost/%2f/messages?queue[routing_key]=my_key&auto-setup=false', array(), true, $factory);
189+
$connection = Connection::fromDsn('amqp://localhost/%2f/messages?queue[routing_key]=my_key&auto-setup=false', [], true, $factory);
190190
$connection->publish('body');
191191
}
192192
}

Tests/Transport/AmqpExt/Fixtures/long_receiver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
2424

2525
$serializer = new Serializer(
26-
new SerializerComponent\Serializer(array(new ObjectNormalizer()), array('json' => new JsonEncoder()))
26+
new SerializerComponent\Serializer([new ObjectNormalizer()], ['json' => new JsonEncoder()])
2727
);
2828

2929
$connection = Connection::fromDsn(getenv('DSN'));

0 commit comments

Comments
 (0)