Skip to content

Commit 8c57773

Browse files
committed
[CS] Fix explicit nullable types
1 parent 26f992d commit 8c57773

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

create_framework/separation_of_concerns.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ And move the ``is_leap_year()`` function to its own class too::
120120

121121
class LeapYear
122122
{
123-
public function isLeapYear(int $year = null): bool
123+
public function isLeapYear(?int $year = null): bool
124124
{
125125
if (null === $year) {
126126
$year = date('Y');

create_framework/templating.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ framework does not need to be modified in any way, create a new
146146
use Symfony\Component\HttpFoundation\Response;
147147
use Symfony\Component\Routing;
148148

149-
function is_leap_year(int $year = null): bool
149+
function is_leap_year(?int $year = null): bool
150150
{
151151
if (null === $year) {
152152
$year = (int)date('Y');

reference/dic_tags.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ the :class:`Symfony\\Component\\HttpKernel\\CacheWarmer\\CacheWarmerInterface` i
490490

491491
class MyCustomWarmer implements CacheWarmerInterface
492492
{
493-
public function warmUp(string $cacheDir, string $buildDir = null): array
493+
public function warmUp(string $cacheDir, ?string $buildDir = null): array
494494
{
495495
// ... do some sort of operations to "warm" your cache
496496

reference/forms/types/enum.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ implement ``TranslatableInterface`` to translate or display custom labels::
6666
case Center = 'Center aligned';
6767
case Right = 'Right aligned';
6868

69-
public function trans(TranslatorInterface $translator, string $locale = null): string
69+
public function trans(TranslatorInterface $translator, ?string $locale = null): string
7070
{
7171
// Translate enum from name (Left, Center or Right)
7272
return $translator->trans($this->name, locale: $locale);

validation/custom_constraint.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ You can use ``#[HasNamedArguments]`` to make some constraint options required::
5959
#[HasNamedArguments]
6060
public function __construct(
6161
public string $mode,
62-
array $groups = null,
62+
?array $groups = null,
6363
mixed $payload = null,
6464
) {
6565
parent::__construct([], $groups, $payload);

0 commit comments

Comments
 (0)