@@ -112,7 +112,7 @@ class Connection
112
112
*/
113
113
private $ lastActivityTime = 0 ;
114
114
115
- public function __construct (array $ connectionOptions , array $ exchangeOptions , array $ queuesOptions , AmqpFactory $ amqpFactory = null )
115
+ public function __construct (array $ connectionOptions , array $ exchangeOptions , array $ queuesOptions , ? AmqpFactory $ amqpFactory = null )
116
116
{
117
117
if (!\extension_loaded ('amqp ' )) {
118
118
throw new LogicException (sprintf ('You cannot use the "%s" as the "amqp" extension is not installed. ' , __CLASS__ ));
@@ -176,7 +176,7 @@ public function __construct(array $connectionOptions, array $exchangeOptions, ar
176
176
* * verify: Enable or disable peer verification. If peer verification is enabled then the common name in the
177
177
* server certificate must match the server name. Peer verification is enabled by default.
178
178
*/
179
- public static function fromDsn (string $ dsn , array $ options = [], AmqpFactory $ amqpFactory = null ): self
179
+ public static function fromDsn (string $ dsn , array $ options = [], ? AmqpFactory $ amqpFactory = null ): self
180
180
{
181
181
if (false === $ params = parse_url ($ dsn )) {
182
182
// this is a valid URI that parse_url cannot handle when you want to pass all parameters as options
@@ -298,7 +298,7 @@ private static function hasCaCertConfigured(array $amqpOptions): bool
298
298
/**
299
299
* @throws \AMQPException
300
300
*/
301
- public function publish (string $ body , array $ headers = [], int $ delayInMs = 0 , AmqpStamp $ amqpStamp = null ): void
301
+ public function publish (string $ body , array $ headers = [], int $ delayInMs = 0 , ? AmqpStamp $ amqpStamp = null ): void
302
302
{
303
303
$ this ->clearWhenDisconnected ();
304
304
@@ -334,7 +334,7 @@ public function countMessagesInQueues(): int
334
334
/**
335
335
* @throws \AMQPException
336
336
*/
337
- private function publishWithDelay (string $ body , array $ headers , int $ delay , AmqpStamp $ amqpStamp = null )
337
+ private function publishWithDelay (string $ body , array $ headers , int $ delay , ? AmqpStamp $ amqpStamp = null )
338
338
{
339
339
$ routingKey = $ this ->getRoutingKeyForMessage ($ amqpStamp );
340
340
$ isRetryAttempt = $ amqpStamp ? $ amqpStamp ->isRetryAttempt () : false ;
@@ -350,7 +350,7 @@ private function publishWithDelay(string $body, array $headers, int $delay, Amqp
350
350
);
351
351
}
352
352
353
- private function publishOnExchange (\AMQPExchange $ exchange , string $ body , string $ routingKey = null , array $ headers = [], AmqpStamp $ amqpStamp = null )
353
+ private function publishOnExchange (\AMQPExchange $ exchange , string $ body , ? string $ routingKey = null , array $ headers = [], ? AmqpStamp $ amqpStamp = null )
354
354
{
355
355
$ attributes = $ amqpStamp ? $ amqpStamp ->getAttributes () : [];
356
356
$ attributes ['headers ' ] = array_merge ($ attributes ['headers ' ] ?? [], $ headers );
0 commit comments