Skip to content

Commit bf4783d

Browse files
committed
Handles PHP8.4 nullable type deprecations
1 parent 92709ef commit bf4783d

7 files changed

+17
-16
lines changed

.php-cs-fixer.php

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
],
3030
'no_trailing_comma_in_singleline' => true,
3131
'no_unused_imports' => true,
32+
'nullable_type_declaration_for_default_null_value' => true,
3233
'ordered_imports' => ['imports_order' => ['class', 'function', 'const'], 'sort_algorithm' => 'alpha'],
3334
'phpdoc_add_missing_param_annotation' => ['only_untyped' => true],
3435
'phpdoc_align' => true,

composer.json

+8-8
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,16 @@
4646
"ext-json": "*"
4747
},
4848
"require-dev": {
49-
"friendsofphp/php-cs-fixer": "^v3.35.1",
50-
"guzzlehttp/guzzle": "^7.8",
51-
"guzzlehttp/psr7": "^1.6 || ^2.6.1",
52-
"phpstan/phpstan": "^1.10.39",
53-
"phpstan/phpstan-phpunit": "^1.3.15",
54-
"phpstan/phpstan-strict-rules": "^1.5.1",
55-
"phpunit/phpunit": "^10.4.1",
49+
"friendsofphp/php-cs-fixer": "^3.52.1",
50+
"guzzlehttp/guzzle": "^7.8.1",
51+
"guzzlehttp/psr7": "^1.6 || ^2.6.2",
52+
"phpstan/phpstan": "^1.10.64",
53+
"phpstan/phpstan-phpunit": "^1.3.16",
54+
"phpstan/phpstan-strict-rules": "^1.5.2",
55+
"phpunit/phpunit": "^10.5.15",
5656
"psr/http-factory": "^1.0.2",
5757
"psr/simple-cache": "^1.0.1",
58-
"symfony/cache": "^v5.0.0 || ^v6.3.5"
58+
"symfony/cache": "^v5.0.0 || ^6.4.4"
5959
},
6060
"suggest": {
6161
"psr/http-client-implementation": "To use the storage functionnality which depends on PSR-18",

src/Domain.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public function label(int $key): ?string
8686
/**
8787
* @return list<int>
8888
*/
89-
public function keys(string $label = null): array
89+
public function keys(?string $label = null): array
9090
{
9191
return $this->registeredName->keys($label);
9292
}
@@ -155,7 +155,7 @@ public function clear(): self
155155
/**
156156
* @throws CannotProcessHost
157157
*/
158-
public function slice(int $offset, int $length = null): self
158+
public function slice(int $offset, ?int $length = null): self
159159
{
160160
return $this->newInstance($this->registeredName->slice($offset, $length));
161161
}

src/DomainName.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function labels(): array;
4949
*
5050
* @return list<int>
5151
*/
52-
public function keys(string $label = null): array;
52+
public function keys(?string $label = null): array;
5353

5454
/**
5555
* The external iterator iterates over the DomainInterface labels
@@ -119,5 +119,5 @@ public function clear(): self;
119119
*
120120
* If $length is null it returns all elements from $offset to the end of the Domain.
121121
*/
122-
public function slice(int $offset, int $length = null): self;
122+
public function slice(int $offset, ?int $length = null): self;
123123
}

src/RegisteredName.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ public function label(int $key): ?string
190190
/**
191191
* @return list<int>
192192
*/
193-
public function keys(string $label = null): array
193+
public function keys(?string $label = null): array
194194
{
195195
if (null === $label) {
196196
return array_keys($this->labels);
@@ -345,7 +345,7 @@ public function clear(): self
345345
/**
346346
* @throws CannotProcessHost
347347
*/
348-
public function slice(int $offset, int $length = null): self
348+
public function slice(int $offset, ?int $length = null): self
349349
{
350350
$nbLabels = count($this->labels);
351351
if ($offset < - $nbLabels || $offset > $nbLabels) {

src/ResolvedDomainTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ public static function toAsciiProvider(): iterable
236236
}
237237

238238
#[DataProvider('withSubDomainWorksProvider')]
239-
public function testItCanHaveItsSubDomainChanged(ResolvedDomain $domain, DomainName|string|null $subdomain, string $expected = null): void
239+
public function testItCanHaveItsSubDomainChanged(ResolvedDomain $domain, DomainName|string|null $subdomain, ?string $expected = null): void
240240
{
241241
$result = $domain->withSubDomain($subdomain);
242242

src/UnableToLoadTopLevelDomainList.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
final class UnableToLoadTopLevelDomainList extends InvalidArgumentException implements CannotProcessHost
1111
{
12-
public static function dueToInvalidTopLevelDomain(string $content, Throwable $exception = null): self
12+
public static function dueToInvalidTopLevelDomain(string $content, ?Throwable $exception = null): self
1313
{
1414
return new self('Invalid Top Level Domain: '.$content, 0, $exception);
1515
}

0 commit comments

Comments
 (0)