Skip to content

Commit 3881773

Browse files
Merge branch '5.1'
* 5.1: Enable "native_constant_invocation" CS rule Make AbstractPhpFileCacheWarmer public Fix CS Add a warning comment on ldap empty password Bump Symfony version to 4.4.14 Update VERSION for 4.4.13 Update CHANGELOG for 4.4.13 [PhpunitBridge] Fix deprecation type detection
2 parents 5526e45 + b6343c8 commit 3881773

File tree

7 files changed

+33
-33
lines changed

7 files changed

+33
-33
lines changed

Tests/Transport/AmqpReceiverTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function testItThrowsATransportExceptionIfItCannotRejectMessage()
6767
$connection = $this->getMockBuilder(Connection::class)->disableOriginalConstructor()->getMock();
6868
$connection->method('getQueueNames')->willReturn(['queueName']);
6969
$connection->method('get')->with('queueName')->willReturn($amqpEnvelope);
70-
$connection->method('nack')->with($amqpEnvelope, 'queueName', AMQP_NOPARAM)->willThrowException(new \AMQPException());
70+
$connection->method('nack')->with($amqpEnvelope, 'queueName', \AMQP_NOPARAM)->willThrowException(new \AMQPException());
7171

7272
$receiver = new AmqpReceiver($connection, $serializer);
7373
$receiver->reject(new Envelope(new \stdClass(), [new AmqpReceivedStamp($amqpEnvelope, 'queueName')]));

Tests/Transport/AmqpSenderTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public function testContentTypeHeaderIsMovedToAttribute()
7979

8080
$connection = $this->getMockBuilder(Connection::class)->disableOriginalConstructor()->getMock();
8181
unset($encoded['headers']['Content-Type']);
82-
$stamp = new AmqpStamp(null, AMQP_NOPARAM, ['content_type' => 'application/json']);
82+
$stamp = new AmqpStamp(null, \AMQP_NOPARAM, ['content_type' => 'application/json']);
8383
$connection->expects($this->once())->method('publish')->with($encoded['body'], $encoded['headers'], 0, $stamp);
8484

8585
$sender = new AmqpSender($connection, $serializer);
@@ -88,7 +88,7 @@ public function testContentTypeHeaderIsMovedToAttribute()
8888

8989
public function testContentTypeHeaderDoesNotOverwriteAttribute()
9090
{
91-
$envelope = (new Envelope(new DummyMessage('Oy')))->with($stamp = new AmqpStamp('rk', AMQP_NOPARAM, ['content_type' => 'custom']));
91+
$envelope = (new Envelope(new DummyMessage('Oy')))->with($stamp = new AmqpStamp('rk', \AMQP_NOPARAM, ['content_type' => 'custom']));
9292
$encoded = ['body' => '...', 'headers' => ['type' => DummyMessage::class, 'Content-Type' => 'application/json']];
9393

9494
$serializer = $this->getMockBuilder(SerializerInterface::class)->getMock();

Tests/Transport/AmqpStampTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ public function testRoutingKeyOnly()
2323
{
2424
$stamp = new AmqpStamp('routing_key');
2525
$this->assertSame('routing_key', $stamp->getRoutingKey());
26-
$this->assertSame(AMQP_NOPARAM, $stamp->getFlags());
26+
$this->assertSame(\AMQP_NOPARAM, $stamp->getFlags());
2727
$this->assertSame([], $stamp->getAttributes());
2828
}
2929

3030
public function testFlagsAndAttributes()
3131
{
32-
$stamp = new AmqpStamp(null, AMQP_DURABLE, ['delivery_mode' => 'unknown']);
32+
$stamp = new AmqpStamp(null, \AMQP_DURABLE, ['delivery_mode' => 'unknown']);
3333
$this->assertNull($stamp->getRoutingKey());
34-
$this->assertSame(AMQP_DURABLE, $stamp->getFlags());
34+
$this->assertSame(\AMQP_DURABLE, $stamp->getFlags());
3535
$this->assertSame(['delivery_mode' => 'unknown'], $stamp->getAttributes());
3636
}
3737

@@ -49,7 +49,7 @@ public function testCreateFromAmqpEnvelope()
4949
$this->assertSame($amqpEnvelope->getDeliveryMode(), $stamp->getAttributes()['delivery_mode']);
5050
$this->assertSame($amqpEnvelope->getPriority(), $stamp->getAttributes()['priority']);
5151
$this->assertSame($amqpEnvelope->getAppId(), $stamp->getAttributes()['app_id']);
52-
$this->assertSame(AMQP_NOPARAM, $stamp->getFlags());
52+
$this->assertSame(\AMQP_NOPARAM, $stamp->getFlags());
5353
}
5454

5555
public function testCreateFromAmqpEnvelopeWithPreviousStamp()
@@ -60,14 +60,14 @@ public function testCreateFromAmqpEnvelopeWithPreviousStamp()
6060
$amqpEnvelope->method('getPriority')->willReturn(5);
6161
$amqpEnvelope->method('getAppId')->willReturn('appid');
6262

63-
$previousStamp = new AmqpStamp('otherroutingkey', AMQP_MANDATORY, ['priority' => 8]);
63+
$previousStamp = new AmqpStamp('otherroutingkey', \AMQP_MANDATORY, ['priority' => 8]);
6464

6565
$stamp = AmqpStamp::createFromAmqpEnvelope($amqpEnvelope, $previousStamp);
6666

6767
$this->assertSame('otherroutingkey', $stamp->getRoutingKey());
6868
$this->assertSame($amqpEnvelope->getDeliveryMode(), $stamp->getAttributes()['delivery_mode']);
6969
$this->assertSame(8, $stamp->getAttributes()['priority']);
7070
$this->assertSame($amqpEnvelope->getAppId(), $stamp->getAttributes()['app_id']);
71-
$this->assertSame(AMQP_MANDATORY, $stamp->getFlags());
71+
$this->assertSame(\AMQP_MANDATORY, $stamp->getFlags());
7272
}
7373
}

Tests/Transport/ConnectionTest.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ public function testItSetupsTheConnectionWithDefaults()
268268
);
269269

270270
$amqpExchange->expects($this->once())->method('declareExchange');
271-
$amqpExchange->expects($this->once())->method('publish')->with('body', null, AMQP_NOPARAM, ['headers' => [], 'delivery_mode' => 2, 'timestamp' => time()]);
271+
$amqpExchange->expects($this->once())->method('publish')->with('body', null, \AMQP_NOPARAM, ['headers' => [], 'delivery_mode' => 2, 'timestamp' => time()]);
272272
$amqpQueue->expects($this->once())->method('declareQueue');
273273
$amqpQueue->expects($this->once())->method('bind')->with(self::DEFAULT_EXCHANGE_NAME, null);
274274

@@ -291,7 +291,7 @@ public function testItSetupsTheConnection()
291291
$factory->method('createQueue')->will($this->onConsecutiveCalls($amqpQueue0, $amqpQueue1));
292292

293293
$amqpExchange->expects($this->once())->method('declareExchange');
294-
$amqpExchange->expects($this->once())->method('publish')->with('body', 'routing_key', AMQP_NOPARAM, ['headers' => [], 'delivery_mode' => 2, 'timestamp' => time()]);
294+
$amqpExchange->expects($this->once())->method('publish')->with('body', 'routing_key', \AMQP_NOPARAM, ['headers' => [], 'delivery_mode' => 2, 'timestamp' => time()]);
295295
$amqpQueue0->expects($this->once())->method('declareQueue');
296296
$amqpQueue0->expects($this->exactly(2))->method('bind')->withConsecutive(
297297
[self::DEFAULT_EXCHANGE_NAME, 'binding_key0'],
@@ -328,7 +328,7 @@ public function testBindingArguments()
328328
$factory->method('createQueue')->willReturn($amqpQueue);
329329

330330
$amqpExchange->expects($this->once())->method('declareExchange');
331-
$amqpExchange->expects($this->once())->method('publish')->with('body', null, AMQP_NOPARAM, ['headers' => [], 'delivery_mode' => 2, 'timestamp' => time()]);
331+
$amqpExchange->expects($this->once())->method('publish')->with('body', null, \AMQP_NOPARAM, ['headers' => [], 'delivery_mode' => 2, 'timestamp' => time()]);
332332
$amqpQueue->expects($this->once())->method('declareQueue');
333333
$amqpQueue->expects($this->exactly(1))->method('bind')->withConsecutive(
334334
[self::DEFAULT_EXCHANGE_NAME, null, ['x-match' => 'all']]
@@ -441,7 +441,7 @@ public function testItDelaysTheMessage()
441441
$delayQueue->expects($this->once())->method('declareQueue');
442442
$delayQueue->expects($this->once())->method('bind')->with('delays', 'delay_messages__5000');
443443

444-
$delayExchange->expects($this->once())->method('publish')->with('{}', 'delay_messages__5000', AMQP_NOPARAM, ['headers' => ['x-some-headers' => 'foo'], 'delivery_mode' => 2, 'timestamp' => time()]);
444+
$delayExchange->expects($this->once())->method('publish')->with('{}', 'delay_messages__5000', \AMQP_NOPARAM, ['headers' => ['x-some-headers' => 'foo'], 'delivery_mode' => 2, 'timestamp' => time()]);
445445

446446
$connection = Connection::fromDsn('amqp://localhost', [], $factory);
447447
$connection->publish('{}', ['x-some-headers' => 'foo'], 5000);
@@ -483,7 +483,7 @@ public function testItDelaysTheMessageWithADifferentRoutingKeyAndTTLs()
483483
$delayQueue->expects($this->once())->method('declareQueue');
484484
$delayQueue->expects($this->once())->method('bind')->with('delays', 'delay_messages__120000');
485485

486-
$delayExchange->expects($this->once())->method('publish')->with('{}', 'delay_messages__120000', AMQP_NOPARAM, ['headers' => [], 'delivery_mode' => 2, 'timestamp' => time()]);
486+
$delayExchange->expects($this->once())->method('publish')->with('{}', 'delay_messages__120000', \AMQP_NOPARAM, ['headers' => [], 'delivery_mode' => 2, 'timestamp' => time()]);
487487
$connection->publish('{}', [], 120000);
488488
}
489489

@@ -515,10 +515,10 @@ public function testAmqpStampHeadersAreUsed()
515515
$amqpExchange = $this->createMock(\AMQPExchange::class)
516516
);
517517

518-
$amqpExchange->expects($this->once())->method('publish')->with('body', null, AMQP_NOPARAM, ['headers' => ['Foo' => 'X', 'Bar' => 'Y'], 'delivery_mode' => 2, 'timestamp' => time()]);
518+
$amqpExchange->expects($this->once())->method('publish')->with('body', null, \AMQP_NOPARAM, ['headers' => ['Foo' => 'X', 'Bar' => 'Y'], 'delivery_mode' => 2, 'timestamp' => time()]);
519519

520520
$connection = Connection::fromDsn('amqp://localhost', [], $factory);
521-
$connection->publish('body', ['Foo' => 'X'], 0, new AmqpStamp(null, AMQP_NOPARAM, ['headers' => ['Bar' => 'Y']]));
521+
$connection->publish('body', ['Foo' => 'X'], 0, new AmqpStamp(null, \AMQP_NOPARAM, ['headers' => ['Bar' => 'Y']]));
522522
}
523523

524524
public function testAmqpStampDelireryModeIsUsed()
@@ -530,10 +530,10 @@ public function testAmqpStampDelireryModeIsUsed()
530530
$amqpExchange = $this->createMock(\AMQPExchange::class)
531531
);
532532

533-
$amqpExchange->expects($this->once())->method('publish')->with('body', null, AMQP_NOPARAM, ['headers' => [], 'delivery_mode' => 1, 'timestamp' => time()]);
533+
$amqpExchange->expects($this->once())->method('publish')->with('body', null, \AMQP_NOPARAM, ['headers' => [], 'delivery_mode' => 1, 'timestamp' => time()]);
534534

535535
$connection = Connection::fromDsn('amqp://localhost', [], $factory);
536-
$connection->publish('body', [], 0, new AmqpStamp(null, AMQP_NOPARAM, ['delivery_mode' => 1]));
536+
$connection->publish('body', [], 0, new AmqpStamp(null, \AMQP_NOPARAM, ['delivery_mode' => 1]));
537537
}
538538

539539
public function testItCanPublishWithTheDefaultRoutingKey()
@@ -602,7 +602,7 @@ public function testItDelaysTheMessageWithTheInitialSuppliedRoutingKeyAsArgument
602602
$delayQueue->expects($this->once())->method('declareQueue');
603603
$delayQueue->expects($this->once())->method('bind')->with('delays', 'delay_messages_routing_key_120000');
604604

605-
$delayExchange->expects($this->once())->method('publish')->with('{}', 'delay_messages_routing_key_120000', AMQP_NOPARAM, ['headers' => [], 'delivery_mode' => 2, 'timestamp' => time()]);
605+
$delayExchange->expects($this->once())->method('publish')->with('{}', 'delay_messages_routing_key_120000', \AMQP_NOPARAM, ['headers' => [], 'delivery_mode' => 2, 'timestamp' => time()]);
606606
$connection->publish('{}', [], 120000, new AmqpStamp('routing_key'));
607607
}
608608

@@ -618,12 +618,12 @@ public function testItCanPublishWithCustomFlagsAndAttributes()
618618
$amqpExchange->expects($this->once())->method('publish')->with(
619619
'body',
620620
'routing_key',
621-
AMQP_IMMEDIATE,
621+
\AMQP_IMMEDIATE,
622622
['delivery_mode' => 2, 'headers' => ['type' => DummyMessage::class], 'timestamp' => time()]
623623
);
624624

625625
$connection = Connection::fromDsn('amqp://localhost', [], $factory);
626-
$connection->publish('body', ['type' => DummyMessage::class], 0, new AmqpStamp('routing_key', AMQP_IMMEDIATE, ['delivery_mode' => 2]));
626+
$connection->publish('body', ['type' => DummyMessage::class], 0, new AmqpStamp('routing_key', \AMQP_IMMEDIATE, ['delivery_mode' => 2]));
627627
}
628628
}
629629

Transport/AmqpReceiver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public function getMessageCount(): int
120120
private function rejectAmqpEnvelope(\AMQPEnvelope $amqpEnvelope, string $queueName): void
121121
{
122122
try {
123-
$this->connection->nack($amqpEnvelope, $queueName, AMQP_NOPARAM);
123+
$this->connection->nack($amqpEnvelope, $queueName, \AMQP_NOPARAM);
124124
} catch (\AMQPException $exception) {
125125
throw new TransportException($exception->getMessage(), 0, $exception);
126126
}

Transport/AmqpStamp.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ final class AmqpStamp implements NonSendableStampInterface
2323
private $flags;
2424
private $attributes;
2525

26-
public function __construct(string $routingKey = null, int $flags = AMQP_NOPARAM, array $attributes = [])
26+
public function __construct(string $routingKey = null, int $flags = \AMQP_NOPARAM, array $attributes = [])
2727
{
2828
$this->routingKey = $routingKey;
2929
$this->flags = $flags;
@@ -62,14 +62,14 @@ public static function createFromAmqpEnvelope(\AMQPEnvelope $amqpEnvelope, self
6262
$attr['type'] = $attr['type'] ?? $amqpEnvelope->getType();
6363
$attr['reply_to'] = $attr['reply_to'] ?? $amqpEnvelope->getReplyTo();
6464

65-
return new self($previousStamp->routingKey ?? $amqpEnvelope->getRoutingKey(), $previousStamp->flags ?? AMQP_NOPARAM, $attr);
65+
return new self($previousStamp->routingKey ?? $amqpEnvelope->getRoutingKey(), $previousStamp->flags ?? \AMQP_NOPARAM, $attr);
6666
}
6767

6868
public static function createWithAttributes(array $attributes, self $previousStamp = null): self
6969
{
7070
return new self(
7171
$previousStamp->routingKey ?? null,
72-
$previousStamp->flags ?? AMQP_NOPARAM,
72+
$previousStamp->flags ?? \AMQP_NOPARAM,
7373
array_merge($previousStamp->attributes ?? [], $attributes)
7474
);
7575
}

Transport/Connection.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ private function publishOnExchange(\AMQPExchange $exchange, string $body, string
322322
$exchange->publish(
323323
$body,
324324
$routingKey,
325-
$amqpStamp ? $amqpStamp->getFlags() : AMQP_NOPARAM,
325+
$amqpStamp ? $amqpStamp->getFlags() : \AMQP_NOPARAM,
326326
$attributes
327327
);
328328
}
@@ -343,8 +343,8 @@ private function getDelayExchange(): \AMQPExchange
343343
if (null === $this->amqpDelayExchange) {
344344
$this->amqpDelayExchange = $this->amqpFactory->createExchange($this->channel());
345345
$this->amqpDelayExchange->setName($this->connectionOptions['delay']['exchange_name']);
346-
$this->amqpDelayExchange->setType(AMQP_EX_TYPE_DIRECT);
347-
$this->amqpDelayExchange->setFlags(AMQP_DURABLE);
346+
$this->amqpDelayExchange->setType(\AMQP_EX_TYPE_DIRECT);
347+
$this->amqpDelayExchange->setFlags(\AMQP_DURABLE);
348348
}
349349

350350
return $this->amqpDelayExchange;
@@ -367,7 +367,7 @@ private function createDelayQueue(int $delay, ?string $routingKey): \AMQPQueue
367367
[$delay, $this->exchangeOptions['name'], $routingKey ?? ''],
368368
$this->connectionOptions['delay']['queue_name_pattern']
369369
));
370-
$queue->setFlags(AMQP_DURABLE);
370+
$queue->setFlags(\AMQP_DURABLE);
371371
$queue->setArguments([
372372
'x-message-ttl' => $delay,
373373
// delete the delay queue 10 seconds after the message expires
@@ -427,7 +427,7 @@ public function ack(\AMQPEnvelope $message, string $queueName): bool
427427
return $this->queue($queueName)->ack($message->getDeliveryTag());
428428
}
429429

430-
public function nack(\AMQPEnvelope $message, string $queueName, int $flags = AMQP_NOPARAM): bool
430+
public function nack(\AMQPEnvelope $message, string $queueName, int $flags = \AMQP_NOPARAM): bool
431431
{
432432
return $this->queue($queueName)->nack($message->getDeliveryTag(), $flags);
433433
}
@@ -490,7 +490,7 @@ public function queue(string $queueName): \AMQPQueue
490490

491491
$amqpQueue = $this->amqpFactory->createQueue($this->channel());
492492
$amqpQueue->setName($queueName);
493-
$amqpQueue->setFlags($queueConfig['flags'] ?? AMQP_DURABLE);
493+
$amqpQueue->setFlags($queueConfig['flags'] ?? \AMQP_DURABLE);
494494

495495
if (isset($queueConfig['arguments'])) {
496496
$amqpQueue->setArguments($queueConfig['arguments']);
@@ -507,8 +507,8 @@ public function exchange(): \AMQPExchange
507507
if (null === $this->amqpExchange) {
508508
$this->amqpExchange = $this->amqpFactory->createExchange($this->channel());
509509
$this->amqpExchange->setName($this->exchangeOptions['name']);
510-
$this->amqpExchange->setType($this->exchangeOptions['type'] ?? AMQP_EX_TYPE_FANOUT);
511-
$this->amqpExchange->setFlags($this->exchangeOptions['flags'] ?? AMQP_DURABLE);
510+
$this->amqpExchange->setType($this->exchangeOptions['type'] ?? \AMQP_EX_TYPE_FANOUT);
511+
$this->amqpExchange->setFlags($this->exchangeOptions['flags'] ?? \AMQP_DURABLE);
512512

513513
if (isset($this->exchangeOptions['arguments'])) {
514514
$this->amqpExchange->setArguments($this->exchangeOptions['arguments']);

0 commit comments

Comments
 (0)