Skip to content

Commit 393c7fa

Browse files
committed
Refactor TextifyMessage class to use 'self' instead of 'static' for return types and update phpstan baseline configuration
1 parent 0443dd2 commit 393c7fa

File tree

3 files changed

+25
-15
lines changed

3 files changed

+25
-15
lines changed

phpstan-baseline.neon

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,3 @@ parameters:
2525
message: "#Call to method account\\(\\) on an unknown class Vonage\\\\Client#"
2626
count: 1
2727
path: src/Providers/Global/NexmoProvider.php
28-
# env() calls in config files are fine
29-
-
30-
message: "#Called 'env' outside of the config directory which returns null when the config is cached, use 'config'#"
31-
count: 63
32-
path: config/textify.php

phpstan.neon.dist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,5 @@ parameters:
1010
tmpDir: build/phpstan
1111
checkOctaneCompatibility: true
1212
checkModelProperties: true
13+
ignoreErrors:
14+
- "#Called 'env' outside of the config directory which returns null when the config is cached, use 'config'#"

src/Notifications/TextifyMessage.php

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,46 +26,59 @@ public function __construct(
2626
* @param string|null $from The sender ID (optional)
2727
* @param string|null $driver The SMS provider to use (optional)
2828
* @param array $metadata Additional metadata (optional)
29+
* @return self
2930
*/
3031
public static function create(
3132
string $message,
3233
?string $from = null,
3334
?string $driver = null,
3435
array $metadata = []
35-
): static {
36-
return new static($message, $from, $driver, $metadata);
36+
): self {
37+
return new self($message, $from, $driver, $metadata);
3738
}
3839

3940
/**
4041
* Set the SMS message content
42+
*
43+
* @param string $message
44+
* @return self
4145
*/
42-
public function message(string $message): static
46+
public function message(string $message): self
4347
{
44-
return new static($message, $this->from, $this->driver, $this->metadata);
48+
return new self($message, $this->from, $this->driver, $this->metadata);
4549
}
4650

4751
/**
4852
* Set the sender ID
53+
*
54+
* @param string $from
55+
* @return self
4956
*/
50-
public function from(string $from): static
57+
public function from(string $from): self
5158
{
52-
return new static($this->message, $from, $this->driver, $this->metadata);
59+
return new self($this->message, $from, $this->driver, $this->metadata);
5360
}
5461

5562
/**
5663
* Set the SMS provider/driver
64+
*
65+
* @param string $driver
66+
* @return self
5767
*/
58-
public function driver(string $driver): static
68+
public function driver(string $driver): self
5969
{
60-
return new static($this->message, $this->from, $driver, $this->metadata);
70+
return new self($this->message, $this->from, $driver, $this->metadata);
6171
}
6272

6373
/**
6474
* Set metadata
75+
*
76+
* @param array $metadata
77+
* @return self
6578
*/
66-
public function metadata(array $metadata): static
79+
public function metadata(array $metadata): self
6780
{
68-
return new static($this->message, $this->from, $this->driver, $metadata);
81+
return new self($this->message, $this->from, $this->driver, $metadata);
6982
}
7083

7184
/**

0 commit comments

Comments
 (0)