Skip to content

Commit 31d3865

Browse files
Narrow existing return types on private/internal/final/test methods
1 parent 63bcd41 commit 31d3865

File tree

4 files changed

+9
-36
lines changed

4 files changed

+9
-36
lines changed

Message/ChatMessage.php

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,7 @@ public static function fromNotification(Notification $notification): self
3737
return $message;
3838
}
3939

40-
/**
41-
* @return $this
42-
*/
43-
public function subject(string $subject): self
40+
public function subject(string $subject): static
4441
{
4542
$this->subject = $subject;
4643

@@ -57,10 +54,7 @@ public function getRecipientId(): ?string
5754
return $this->options ? $this->options->getRecipientId() : null;
5855
}
5956

60-
/**
61-
* @return $this
62-
*/
63-
public function options(MessageOptionsInterface $options): self
57+
public function options(MessageOptionsInterface $options): static
6458
{
6559
$this->options = $options;
6660

@@ -72,10 +66,7 @@ public function getOptions(): ?MessageOptionsInterface
7266
return $this->options;
7367
}
7468

75-
/**
76-
* @return $this
77-
*/
78-
public function transport(?string $transport): self
69+
public function transport(?string $transport): static
7970
{
8071
$this->transport = $transport;
8172

Message/EmailMessage.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,7 @@ public function getEnvelope(): ?Envelope
7272
return $this->envelope;
7373
}
7474

75-
/**
76-
* @return $this
77-
*/
78-
public function envelope(Envelope $envelope): self
75+
public function envelope(Envelope $envelope): static
7976
{
8077
$this->envelope = $envelope;
8178

@@ -97,10 +94,7 @@ public function getOptions(): ?MessageOptionsInterface
9794
return null;
9895
}
9996

100-
/**
101-
* @return $this
102-
*/
103-
public function transport(?string $transport): self
97+
public function transport(?string $transport): static
10498
{
10599
if (!$this->message instanceof Email) {
106100
throw new LogicException('Cannot set a Transport on a RawMessage instance.');

Message/SmsMessage.php

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,7 @@ public static function fromNotification(Notification $notification, SmsRecipient
3939
return new self($recipient->getPhone(), $notification->getSubject());
4040
}
4141

42-
/**
43-
* @return $this
44-
*/
45-
public function phone(string $phone): self
42+
public function phone(string $phone): static
4643
{
4744
if ('' === $phone) {
4845
throw new InvalidArgumentException(sprintf('"%s" needs a phone number, it cannot be empty.', static::class));
@@ -63,10 +60,7 @@ public function getRecipientId(): string
6360
return $this->phone;
6461
}
6562

66-
/**
67-
* @return $this
68-
*/
69-
public function subject(string $subject): self
63+
public function subject(string $subject): static
7064
{
7165
$this->subject = $subject;
7266

@@ -78,10 +72,7 @@ public function getSubject(): string
7872
return $this->subject;
7973
}
8074

81-
/**
82-
* @return $this
83-
*/
84-
public function transport(?string $transport): self
75+
public function transport(?string $transport): static
8576
{
8677
$this->transport = $transport;
8778

Transport/NullTransportFactory.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@
1818
*/
1919
final class NullTransportFactory extends AbstractTransportFactory
2020
{
21-
/**
22-
* @return NullTransport
23-
*/
24-
public function create(Dsn $dsn): TransportInterface
21+
public function create(Dsn $dsn): NullTransport
2522
{
2623
if ('null' === $dsn->getScheme()) {
2724
return new NullTransport($this->dispatcher);

0 commit comments

Comments
 (0)