8000 minor #43195 [Messenger] Add types to private properties (derrabus) · symfony/symfony@9015fea · GitHub
[go: up one dir, main page]

Skip to content

Commit 9015fea

Browse files
committed
minor #43195 [Messenger] Add types to private properties (derrabus)
This PR was merged into the 6.0 branch. Discussion ---------- [Messenger] Add types to private properties | Q | A | ------------- | --- | Branch? | 6.0 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | N/A | License | MIT | Doc PR | N/A Commits ------- 6450840 [Messenger] Add types to private properties
2 parents fa03145 + 6450840 commit 9015fea

File tree

101 files changed

+264
-292
lines changed

Some content is hidden

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

101 files changed

+264
-292
lines changed

src/Symfony/Component/Messenger/Bridge/AmazonSqs/Transport/AmazonSqsFifoStamp.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515

1616
final class AmazonSqsFifoStamp implements NonSendableStampInterface
1717
{
18-
private $messageGroupId;
19-
private $messageDeduplicationId;
18+
private ?string $messageGroupId;
19+
private ?string $messageDeduplicationId;
2020

2121
public function __construct(string $messageGroupId = null, string $messageDeduplicationId = null)
2222
{

src/Symfony/Component/Messenger/Bridge/AmazonSqs/Transport/AmazonSqsReceivedStamp.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919
class AmazonSqsReceivedStamp implements NonSendableStampInterface
2020
{
21-
private $id;
21+
private string $id;
2222

2323
public function __construct(string $id)
2424
{

src/Symfony/Component/Messenger/Bridge/AmazonSqs/Transport/AmazonSqsReceiver.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
*/
2727
class AmazonSqsReceiver implements ReceiverInterface, MessageCountAwareInterface
2828
{
29-
private $connection;
30-
private $serializer;
29+
private Connection $connection;
30+
private SerializerInterface $serializer;
3131

3232
public function __construct(Connection $connection, SerializerInterface $serializer = null)
3333
{

src/Symfony/Component/Messenger/Bridge/AmazonSqs/Transport/AmazonSqsSender.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
*/
2424
class AmazonSqsSender implements SenderInterface
2525
{
26-
private $connection;
27-
private $serializer;
26+
private Connection $connection;
27+
private SerializerInterface $serializer;
2828

2929
public function __construct(Connection $connection, SerializerInterface $serializer)
3030
{

src/Symfony/Component/Messenger/Bridge/AmazonSqs/Transport/AmazonSqsTransport.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@
2828
*/
2929
class AmazonSqsTransport implements TransportInterface, SetupableTransportInterface, MessageCountAwareInterface, ResetInterface
3030
{
31-
private $serializer;
32-
private $connection;
33-
private $receiver;
34-
private $sender;
31+
private SerializerInterface $serializer;
32+
private Connection $connection;
33+
private ?ReceiverInterface $receiver;
34+
private ?SenderInterface $sender;
3535

3636
public function __construct(Connection $connection, SerializerInterface $serializer = null, ReceiverInterface $receiver = null, SenderInterface $sender = null)
3737
{

src/Symfony/Component/Messenger/Bridge/AmazonSqs/Transport/AmazonSqsTransportFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
*/
2222
class AmazonSqsTransportFactory implements TransportFactoryInterface
2323
{
24-
private $logger;
24+
private ?LoggerInterface $logger;
2525

2626
public function __construct(LoggerInterface $logger = null)
2727
{

src/Symfony/Component/Messenger/Bridge/AmazonSqs/Transport/AmazonSqsXrayTraceHeaderStamp.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
final class AmazonSqsXrayTraceHeaderStamp implements NonSendableStampInterface
1717
{
18-
private $traceId;
18+
private string $traceId;
1919

2020
public function __construct(string $traceId)
2121
{

src/Symfony/Component/Messenger/Bridge/AmazonSqs/Transport/Connection.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,12 @@ class Connection
4949
'debug' => null,
5050
];
5151

52-
private $configuration;
53-
private $client;
54-
55-
/** @var ReceiveMessageResult */
56-
private $currentResponse;
52+
private array $configuration;
53+
private SqsClient $client;
54+
private ?ReceiveMessageResult $currentResponse = null;
5755
/** @var array[] */
58-
private $buffer = [];
59-
/** @var string|null */
60-
private $queueUrl;
56+
private array $buffer = [];
57+
private ?string $queueUrl;
6158

6259
public function __construct(array $configuration, SqsClient $client = null, string $queueUrl = null)
6360
{

src/Symfony/Component/Messenger/Bridge/Amqp/Transport/AmqpReceivedStamp.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
*/
1919
class AmqpReceivedStamp implements NonSendableStampInterface
2020
{
21-
private $amqpEnvelope;
22-
private $queueName;
21+
private \AMQPEnvelope $amqpEnvelope;
22+
private string $queueName;
2323

2424
public function __construct(\AMQPEnvelope $amqpEnvelope, string $queueName)
2525
{

src/Symfony/Component/Messenger/Bridge/Amqp/Transport/AmqpReceiver.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
*/
2828
class AmqpReceiver implements QueueReceiverInterface, MessageCountAwareInterface
2929
{
30-
private $serializer;
31-
private $connection;
30+
private SerializerInterface $serializer;
31+
private Connection $connection;
3232

3333
public function __construct(Connection $connection, SerializerInterface $serializer = null)
3434
{

src/Symfony/Component/Messenger/Bridge/Amqp/Transport/AmqpSender.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
*/
2727
class AmqpSender implements SenderInterface
2828
{
29-
private $serializer;
30-
private $connection;
29+
private SerializerInterface $serializer;
30+
private Connection $connection;
3131

3232
public function __construct(Connection $connection, SerializerInterface $serializer = null)
3333
{

src/Symfony/Component/Messenger/Bridge/Amqp/Transport/AmqpStamp.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919
*/
2020
final class AmqpStamp implements NonSendableStampInterface
2121
{
22-
private $routingKey;
23-
private $flags;
24-
private $attributes;
25-
private $isRetryAttempt = false;
22+
private ?string $routingKey;
23+
private int $flags;
24+
private array $attributes;
25+
private bool $isRetryAttempt = false;
2626

2727
public function __construct(string $routingKey = null, int $flags = \AMQP_NOPARAM, array $attributes = [])
2828
{

src/Symfony/Component/Messenger/Bridge/Amqp/Transport/AmqpTransport.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@
2424
*/
2525
class AmqpTransport implements QueueReceiverInterface, TransportInterface, SetupableTransportInterface, MessageCountAwareInterface
2626
{
27-
private $serializer;
28-
private $connection;
29-
private $receiver;
30-
private $sender;
27+
private SerializerInterface $serializer;
28+
private Connection $connection;
29+
private AmqpReceiver $receiver;
30+
private AmqpSender $sender;
3131

3232
public function __construct(Connection $connection, SerializerInterface $serializer = null)
3333
{

src/Symfony/Component/Messenger/Bridge/Amqp/Transport/Connection.php

Lines changed: 15 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -74,32 +74,21 @@ class Connection
7474
'arguments',
7575
];
7676

77-
private $connectionOptions;
78-
private $exchangeOptions;
79-
private $queuesOptions;
80-
private $amqpFactory;
81-
private $autoSetupExchange;
82-
private $autoSetupDelayExchange;
77+
private array $connectionOptions;
78+
private array $exchangeOptions;
79+
private array $queuesOptions;
80+
private AmqpFactory $amqpFactory;
81+
private mixed $autoSetupExchange;
82+
private mixed $autoSetupDelayExchange;
83+
private \AMQPChannel $amqpChannel;
84+
private \AMQPExchange $amqpExchange;
8385

8486
/**
85-
* @var \AMQPChannel|null
87+
* @var \AMQPQueue[]
8688
*/
87-
private $amqpChannel;
89+
private array $amqpQueues = [];
8890

89-
/**
90-
* @var \AMQPExchange|null
91-
*/
92-
private $amqpExchange;
93-
94-
/**
95-
* @var \AMQPQueue[]|null
96-
*/
97-
private $amqpQueues = [];
98-
99-
/**
100-
* @var \AMQPExchange|null
101-
*/
102-
private $amqpDelayExchange;
91+
private \AMQPExchange $amqpDelayExchange;
10392

10493
public function __construct(array $connectionOptions, array $exchangeOptions, array $queuesOptions, AmqpFactory $amqpFactory = null)
10594
{
@@ -367,7 +356,7 @@ private function setupDelay(int $delay, ?string $routingKey, bool $isRetryAttemp
367356

368357
private function getDelayExchange(): \AMQPExchange
369358
{
370-
if (null === $this->amqpDelayExchange) {
359+
if (!isset($this->amqpDelayExchange)) {
371360
$this->amqpDelayExchange = $this->amqpFactory->createExchange($this->channel());
372361
$this->amqpDelayExchange->setName($this->connectionOptions['delay']['exchange_name']);
373362
$this->amqpDelayExchange->setType(\AMQP_EX_TYPE_DIRECT);
@@ -483,7 +472,7 @@ public function getQueueNames(): array
483472

484473
public function channel(): \AMQPChannel
485474
{
486-
if (null === $this->amqpChannel) {
475+
if (!isset($this->amqpChannel)) {
487476
$connection = $this->amqpFactory->createConnection($this->connectionOptions);
488477
$connectMethod = 'true' === ($this->connectionOptions['persistent'] ?? 'false') ? 'pconnect' : 'connect';
489478

@@ -531,7 +520,7 @@ public function queue(string $queueName): \AMQPQueue
531520

532521
public function exchange(): \AMQPExchange
533522
{
534-
if (null === $this->amqpExchange) {
523+
if (!isset($this->amqpExchange)) {
535524
$this->amqpExchange = $this->amqpFactory->createExchange($this->channel());
536525
$this->amqpExchange->setName($this->exchangeOptions['name']);
537526
$this->amqpExchange->setType($this->exchangeOptions['type'] ?? \AMQP_EX_TYPE_FANOUT);
@@ -548,10 +537,8 @@ public function exchange(): \AMQPExchange
548537
private function clearWhenDisconnected(): void
549538
{
550539
if (!$this->channel()->isConnected()) {
551-
$this->amqpChannel = null;
540+
unset($this->amqpChannel, $this->amqpExchange, $this->amqpDelayExchange);
552541
$this->amqpQueues = [];
553-
$this->amqpExchange = null;
554-
$this->amqpDelayExchange = null;
555542
}
556543
}
557544

src/Symfony/Component/Messenger/Bridge/Beanstalkd/Transport/BeanstalkdReceivedStamp.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
*/
1919
class BeanstalkdReceivedStamp implements NonSendableStampInterface
2020
{
21-
private $id;
22-
private $tube;
21+
private string $id;
22+
private string $tube;
2323

2424
public function __construct(string $id, string $tube)
2525
{

src/Symfony/Component/Messenger/Bridge/Beanstalkd/Transport/BeanstalkdReceiver.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
*/
2525
class BeanstalkdReceiver implements ReceiverInterface, MessageCountAwareInterface
2626
{
27-
private $connection;
28-
private $serializer;
27+
private Connection $connection;
28+
private SerializerInterface $serializer;
2929

3030
public function __construct(Connection $connection, SerializerInterface $serializer = null)
3131
{

src/Symfony/Component/Messenger/Bridge/Beanstalkd/Transport/BeanstalkdSender.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
*/
2323
class BeanstalkdSender implements SenderInterface
2424
{
25-
private $connection;
26-
private $serializer;
25+
private Connection $connection;
26+
private SerializerInterface $serializer;
2727

2828
public function __construct(Connection $connection, SerializerInterface $serializer = null)
2929
{

src/Symfony/Component/Messenger/Bridge/Beanstalkd/Transport/BeanstalkdTransport.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222
*/
2323
class BeanstalkdTransport implements TransportInterface, MessageCountAwareInterface
2424
{
25-
private $connection;
26-
private $serializer;
27-
private $receiver;
28-
private $sender;
25+
private Connection $connection;
26+
private SerializerInterface $serializer;
27+
private BeanstalkdReceiver $receiver;
28+
private BeanstalkdSender $sender;
2929

3030
public function __construct(Connection $connection, SerializerInterface $serializer = null)
3131
{

src/Symfony/Component/Messenger/Bridge/Beanstalkd/Transport/Connection.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ class Connection
4040
* * timeout: message reservation timeout (in seconds)
4141
* * ttr: the message time to run before it is put back in the ready queue (in seconds)
4242
*/
43-
private $configuration;
44-
private $client;
45-
private $tube;
46-
private $timeout;
47-
private $ttr;
43+
private array $configuration;
44+
private PheanstalkInterface $client;
45+
private string $tube;
46+
private int $timeout;
47+
private int $ttr;
4848

4949
public function __construct(array $configuration, PheanstalkInterface $client)
5050
{

src/Symfony/Component/Messenger/Bridge/Doctrine/Transport/DoctrineReceivedStamp.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919
class DoctrineReceivedStamp implements NonSendableStampInterface
2020
{
21-
private $id;
21+
private string $id;
2222

2323
public function __construct(string $id)
2424
{

src/Symfony/Component/Messenger/Bridge/Doctrine/Transport/DoctrineReceiver.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030
class DoctrineReceiver implements ReceiverInterface, MessageCountAwareInterface, ListableReceiverInterface
3131
{
3232
private const MAX_RETRIES = 3;
33-
private $retryingSafetyCounter = 0;
34-
private $connection;
35-
private $serializer;
33+
private int $retryingSafetyCounter = 0;
34+
private Connection $connection;
35+
private SerializerInterface $serializer;
3636

3737
public function __construct(Connection $connection, SerializerInterface $serializer = null)
3838
{

src/Symfony/Component/Messenger/Bridge/Doctrine/Transport/DoctrineSender.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
*/
2626
class DoctrineSender implements SenderInterface
2727
{
28-
private $connection;
29-
private $serializer;
28+
private Connection $connection;
29+
private SerializerInterface $serializer;
3030

3131
public function __construct(Connection $connection, SerializerInterface $serializer = null)
3232
{

src/Symfony/Component/Messenger/Bridge/Doctrine/Transport/DoctrineTransport.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@
2626
*/
2727
class DoctrineTransport implements TransportInterface, SetupableTransportInterface, MessageCountAwareInterface, ListableReceiverInterface
2828
{
29-
private $connection;
30-
private $serializer;
31-
private $receiver;
32-
private $sender;
29+
private Connection $connection;
30+
private SerializerInterface $serializer;
31+
private DoctrineReceiver $receiver;
32+
private DoctrineSender $sender;
3333

3434
public function __construct(Connection $connection, SerializerInterface $serializer)
3535
{

src/Symfony/Component/Messenger/Bridge/Doctrine/Transport/DoctrineTransportFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
*/
2424
class DoctrineTransportFactory implements TransportFactoryInterface
2525
{
26-
private $registry;
26+
private ConnectionRegistry $registry;
2727

2828
public function __construct(ConnectionRegistry $registry)
2929
{

src/Symfony/Component/Messenger/Bridge/Doctrine/Transport/PostgreSqlConnection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ final class PostgreSqlConnection extends Connection
3434
'get_notify_timeout' => 0,
3535
];
3636

37-
private $listening = false;
37+
private bool $listening = false;
3838

3939
public function __sleep(): array
4040
{

0 commit comments

Comments
 (0)
0