Skip to content

Commit 299d6f2

Browse files
committed
[Notifier] Add types to private properties
Signed-off-by: Alexander M. Turek <me@derrabus.de>
1 parent 818da98 commit 299d6f2

31 files changed

+76
-73
lines changed

Channel/BrowserChannel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*/
2121
final class BrowserChannel implements ChannelInterface
2222
{
23-
private $stack;
23+
private RequestStack $stack;
2424

2525
public function __construct(RequestStack $stack)
2626
{

Channel/ChannelPolicy.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919
final class ChannelPolicy implements ChannelPolicyInterface
2020
{
21-
private $policy;
21+
private array $policy;
2222

2323
public function __construct(array $policy)
2424
{

Channel/EmailChannel.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Symfony\Component\Mailer\Messenger\SendEmailMessage;
1616
use Symfony\Component\Mailer\Transport\TransportInterface;
1717
use Symfony\Component\Messenger\MessageBusInterface;
18+
use Symfony\Component\Mime\Address;
1819
use Symfony\Component\Mime\Email;
1920
use Symfony\Component\Notifier\Exception\LogicException;
2021
use Symfony\Component\Notifier\Message\EmailMessage;
@@ -28,10 +29,10 @@
2829
*/
2930
class EmailChannel implements ChannelInterface
3031
{
31-
private $transport;
32-
private $bus;
33-
private $from;
34-
private $envelope;
32+
private ?TransportInterface $transport;
33+
private ?MessageBusInterface $bus;
34+
private string|Address|null $from;
35+
private ?Envelope $envelope;
3536

3637
public function __construct(TransportInterface $transport = null, MessageBusInterface $bus = null, string $from = null, Envelope $envelope = null)
3738
{
@@ -41,7 +42,7 @@ public function __construct(TransportInterface $transport = null, MessageBusInte
4142

4243
$this->transport = $transport;
4344
$this->bus = $bus;
44-
$this->from = $from ?: ($envelope ? $envelope->getSender() : null);
45+
$this->from = $from ?: $envelope?->getSender();
4546
$this->envelope = $envelope;
4647
}
4748

Chatter.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323
*/
2424
final class Chatter implements ChatterInterface
2525
{
26-
private $transport;
27-
private $bus;
28-
private $dispatcher;
26+
private TransportInterface $transport;
27+
private ?MessageBusInterface $bus;
28+
private ?EventDispatcherInterface $dispatcher;
2929

3030
public function __construct(TransportInterface $transport, MessageBusInterface $bus = null, EventDispatcherInterface $dispatcher = null)
3131
{

DataCollector/NotificationDataCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
*/
2323
final class NotificationDataCollector extends DataCollector
2424
{
25-
private $logger;
25+
private NotificationLoggerListener $logger;
2626

2727
public function __construct(NotificationLoggerListener $logger)
2828
{

Event/FailedMessageEvent.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
*/
2020
final class FailedMessageEvent extends Event
2121
{
22-
private $message;
23-
private $error;
22+
private MessageInterface $message;
23+
private \Throwable $error;
2424

2525
public function __construct(MessageInterface $message, \Throwable $error)
2626
{

Event/MessageEvent.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
*/
2020
final class MessageEvent extends Event
2121
{
22-
private $message;
23-
private $queued;
22+
private MessageInterface $message;
23+
private bool $queued;
2424

2525
public function __construct(MessageInterface $message, bool $queued = false)
2626
{

Event/NotificationEvents.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
*/
1919
class NotificationEvents
2020
{
21-
private $events = [];
22-
private $transports = [];
21+
private array $events = [];
22+
private array $transports = [];
2323

2424
public function add(MessageEvent $event): void
2525
{

Event/SentMessageEvent.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
*/
2020
final class SentMessageEvent extends Event
2121
{
22-
private $message;
22+
private SentMessage $message;
2323

2424
public function __construct(SentMessage $message)
2525
{

EventListener/NotificationLoggerListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
*/
2222
class NotificationLoggerListener implements EventSubscriberInterface, ResetInterface
2323
{
24-
private $events;
24+
private NotificationEvents $events;
2525

2626
public function __construct()
2727
{

0 commit comments

Comments
 (0)