Skip to content

Commit 700485f

Browse files
authored
Fix remaining implicit marking of parameters as nullable (PHP 8.4) (#566)
1 parent 0a0a968 commit 700485f

9 files changed

+10
-10
lines changed

src/Attachment.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ public function setConfig(Config $config): Attachment {
462462
* @return mixed
463463
* @throws MaskNotFoundException
464464
*/
465-
public function mask(string $mask = null): mixed {
465+
public function mask(?string $mask = null): mixed {
466466
$mask = $mask !== null ? $mask : $this->mask;
467467
if (class_exists($mask)) {
468468
return new $mask($this);

src/Decoder/Decoder.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function __construct(
5454
* @param string|null $encoding
5555
* @return mixed
5656
*/
57-
public function decode(array|string|null $value, string $encoding = null): mixed {
57+
public function decode(array|string|null $value, ?string $encoding = null): mixed {
5858
return $value;
5959
}
6060

src/Decoder/DecoderInterface.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function __construct(array $options = [], string $fallback_encoding = 'UT
3333
* @param string|null $encoding
3434
* @return string|array|null
3535
*/
36-
public function decode(array|string|null $value, string $encoding = null): mixed;
36+
public function decode(array|string|null $value, ?string $encoding = null): mixed;
3737

3838
public function mimeHeaderDecode(string $text): array;
3939

src/Decoder/HeaderDecoder.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
*/
2222
class HeaderDecoder extends Decoder {
2323

24-
public function decode(array|string|null $value, string $encoding = null): mixed {
24+
public function decode(array|string|null $value, ?string $encoding = null): mixed {
2525
if (is_array($value)) {
2626
return $this->decodeHeaderArray($value);
2727
}

src/Decoder/MessageDecoder.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
*/
2424
class MessageDecoder extends Decoder {
2525

26-
public function decode(array|string|null $value, string $encoding = null): mixed {
26+
public function decode(array|string|null $value, ?string $encoding = null): mixed {
2727
if(is_array($value)) {
2828
return array_map(function($item){
2929
return $this->decode($item);

tests/fixtures/FixtureTestCase.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ final public function __construct(?string $name = null, array $data = [], $dataN
8484
* @throws ResponseException
8585
* @throws RuntimeException
8686
*/
87-
final public function getFixture(string $template, Config $config = null) : Message {
87+
final public function getFixture(string $template, ?Config $config = null) : Message {
8888
$filename = implode(DIRECTORY_SEPARATOR, [__DIR__, "..", "messages", $template]);
8989
$message = Message::fromFile($filename, $config);
9090
self::assertInstanceOf(Message::class, $message);

tests/live/LegacyTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ final protected function appendMessageTemplate(Folder $folder, string $template)
236236
* @throws ResponseException
237237
* @throws RuntimeException
238238
*/
239-
final protected function deleteFolder(Folder $folder = null): bool {
239+
final protected function deleteFolder(?Folder $folder = null): bool {
240240
$response = $folder?->delete(false);
241241
if (is_array($response)) {
242242
$valid_response = false;
@@ -423,7 +423,7 @@ public function testQueryWhereCriteria(): void {
423423
* @throws ResponseException
424424
* @throws RuntimeException
425425
*/
426-
protected function assertWhereSearchCriteria(Folder $folder, string $criteria, Carbon|string $value = null, bool $date = false): void {
426+
protected function assertWhereSearchCriteria(Folder $folder, string $criteria, Carbon|string|null $value = null, bool $date = false): void {
427427
$query = $folder->query()->where($criteria, $value);
428428
self::assertInstanceOf(WhereQuery::class, $query);
429429

tests/live/LiveMailboxTestCase.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ final protected function appendMessageTemplate(Folder $folder, string $template)
200200
* @throws ResponseException
201201
* @throws RuntimeException
202202
*/
203-
final protected function deleteFolder(Folder $folder = null): bool {
203+
final protected function deleteFolder(?Folder $folder = null): bool {
204204
$response = $folder?->delete(false);
205205
if (is_array($response)) {
206206
$valid_response = false;

tests/live/QueryTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ public function testQueryWhereCriteria(): void {
231231
* @throws ResponseException
232232
* @throws RuntimeException
233233
*/
234-
protected function assertWhereSearchCriteria(Folder $folder, string $criteria, Carbon|string $value = null, bool $date = false): void {
234+
protected function assertWhereSearchCriteria(Folder $folder, string $criteria, Carbon|string|null $value = null, bool $date = false): void {
235235
$query = $folder->query()->where($criteria, $value);
236236
self::assertInstanceOf(WhereQuery::class, $query);
237237

0 commit comments

Comments
 (0)