Skip to content

Commit a4841ab

Browse files
minor #54308 Add more explicit nullable types for default null values (alexandre-daubois)
This PR was merged into the 5.4 branch. Discussion ---------- Add more explicit nullable types for default null values | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | - | License | MIT Continuing to bring deprecation-free support for PHP 8.4 (https://php.watch/versions/8.4/implicitly-marking-parameter-type-nullable-deprecated) If this gets merged, I'll take care of adding missing ones in upper branches if not done during upmerge 🙂 Commits ------- e9d30bac03 Add more explicit nullable types for default null values
2 parents 42b27ad + da00018 commit a4841ab

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

Tests/Fixtures/ChoiceList/DeprecatedChoiceListFactory.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99

1010
class DeprecatedChoiceListFactory implements ChoiceListFactoryInterface
1111
{
12-
public function createListFromChoices(iterable $choices, callable $value = null): ChoiceListInterface
12+
public function createListFromChoices(iterable $choices, ?callable $value = null): ChoiceListInterface
1313
{
1414
}
1515

16-
public function createListFromLoader(ChoiceLoaderInterface $loader, callable $value = null): ChoiceListInterface
16+
public function createListFromLoader(ChoiceLoaderInterface $loader, ?callable $value = null): ChoiceListInterface
1717
{
1818
}
1919

20-
public function createView(ChoiceListInterface $list, $preferredChoices = null, $label = null, callable $index = null, callable $groupBy = null, $attr = null): ChoiceListView
20+
public function createView(ChoiceListInterface $list, $preferredChoices = null, $label = null, ?callable $index = null, ?callable $groupBy = null, $attr = null): ChoiceListView
2121
{
2222
}
2323
}

Tests/Fixtures/CustomArrayObject.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class CustomArrayObject implements \ArrayAccess, \IteratorAggregate, \Countable,
1919
{
2020
private $array;
2121

22-
public function __construct(array $array = null)
22+
public function __construct(?array $array = null)
2323
{
2424
$this->array = $array ?: [];
2525
}

Tests/Fixtures/FixedTranslator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function __construct(array $translations)
2222
$this->translations = $translations;
2323
}
2424

25-
public function trans(string $id, array $parameters = [], string $domain = null, string $locale = null): string
25+
public function trans(string $id, array $parameters = [], ?string $domain = null, ?string $locale = null): string
2626
{
2727
return $this->translations[$id] ?? $id;
2828
}

0 commit comments

Comments
 (0)