Skip to content

Commit

Permalink
Merge branch '6.4' into 7.0
Browse files Browse the repository at this point in the history
* 6.4:
  [CS] Fix explicit nullable types
  • Loading branch information
OskarStark committed Apr 17, 2024
2 parents 2e623aa + 31a435d commit 0df8d03
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion create_framework/separation_of_concerns.rst
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ And move the ``is_leap_year()`` function to its own class too::

class LeapYear
{
public function isLeapYear(int $year = null): bool
public function isLeapYear(?int $year = null): bool
{
if (null === $year) {
$year = date('Y');
Expand Down
2 changes: 1 addition & 1 deletion create_framework/templating.rst
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ framework does not need to be modified in any way, create a new
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing;

function is_leap_year(int $year = null): bool
function is_leap_year(?int $year = null): bool
{
if (null === $year) {
$year = (int)date('Y');
Expand Down
2 changes: 1 addition & 1 deletion reference/dic_tags.rst
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ the :class:`Symfony\\Component\\HttpKernel\\CacheWarmer\\CacheWarmerInterface` i

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

Expand Down
2 changes: 1 addition & 1 deletion reference/forms/types/enum.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ implement ``TranslatableInterface`` to translate or display custom labels::
case Center = 'Center aligned';
case Right = 'Right aligned';

public function trans(TranslatorInterface $translator, string $locale = null): string
public function trans(TranslatorInterface $translator, ?string $locale = null): string
{
// Translate enum from name (Left, Center or Right)
return $translator->trans($this->name, locale: $locale);
Expand Down
4 changes: 2 additions & 2 deletions serializer/custom_context_builders.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ value is ``0000-00-00``. To do that you'll first have to create your normalizer:
{
use DenormalizerAwareTrait;

public function denormalize($data, string $type, string $format = null, array $context = []): mixed
public function denormalize($data, string $type, ?string $format = null, array $context = []): mixed
{
if ('0000-00-00' === $data) {
return null;
Expand All @@ -40,7 +40,7 @@ value is ``0000-00-00``. To do that you'll first have to create your normalizer:
return $this->denormalizer->denormalize($data, $type, $format, $context);
}

public function supportsDenormalization($data, string $type, string $format = null, array $context = []): bool
public function supportsDenormalization($data, string $type, ?string $format = null, array $context = []): bool
{
return true === ($context['zero_datetime_to_null'] ?? false)
&& is_a($type, \DateTimeInterface::class, true);
Expand Down
2 changes: 1 addition & 1 deletion validation/custom_constraint.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ You can use ``#[HasNamedArguments]`` to make some constraint options required::
#[HasNamedArguments]
public function __construct(
public string $mode,
array $groups = null,
?array $groups = null,
mixed $payload = null,
) {
parent::__construct([], $groups, $payload);
Expand Down

0 comments on commit 0df8d03

Please sign in to comment.