Skip to content

Commit 8d91db9

Browse files
committed
Merge branch '5.4' into 6.4
* 5.4: minor [CS] Fix more nullable types [Testing] Update nullable types
2 parents a293225 + 3aa6914 commit 8d91db9

18 files changed

+40
-40
lines changed

components/expression_language.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ or by using the second argument of the constructor::
385385

386386
class ExpressionLanguage extends BaseExpressionLanguage
387387
{
388-
public function __construct(CacheItemPoolInterface $cache = null, array $providers = [])
388+
public function __construct(?CacheItemPoolInterface $cache = null, array $providers = [])
389389
{
390390
// prepends the default provider to let users override it
391391
array_unshift($providers, new StringExpressionLanguageProvider());

components/serializer.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ exists in your project::
118118
$this->sportsperson = $sportsperson;
119119
}
120120

121-
public function setCreatedAt(\DateTimeInterface $createdAt = null): void
121+
public function setCreatedAt(?\DateTimeInterface $createdAt = null): void
122122
{
123123
$this->createdAt = $createdAt;
124124
}
@@ -751,7 +751,7 @@ When serializing, you can set a callback to format a specific object property::
751751
$encoder = new JsonEncoder();
752752

753753
// all callback parameters are optional (you can omit the ones you don't use)
754-
$dateCallback = function (object $innerObject, object $outerObject, string $attributeName, string $format = null, array $context = []): string {
754+
$dateCallback = function (object $innerObject, object $outerObject, string $attributeName, ?string $format = null, array $context = []): string {
755755
return $innerObject instanceof \DateTime ? $innerObject->format(\DateTime::ISO8601) : '';
756756
};
757757

@@ -1629,7 +1629,7 @@ having unique identifiers::
16291629
$classMetadataFactory = new ClassMetadataFactory(new AttributeLoader());
16301630

16311631
// all callback parameters are optional (you can omit the ones you don't use)
1632-
$maxDepthHandler = function (object $innerObject, object $outerObject, string $attributeName, string $format = null, array $context = []): string {
1632+
$maxDepthHandler = function (object $innerObject, object $outerObject, string $attributeName, ?string $format = null, array $context = []): string {
16331633
return '/foos/'.$innerObject->id;
16341634
};
16351635

controller/error_pages.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ contents, create a new Normalizer that supports the ``FlattenException`` input::
216216

217217
class MyCustomProblemNormalizer implements NormalizerInterface
218218
{
219-
public function normalize($exception, string $format = null, array $context = []): array
219+
public function normalize($exception, ?string $format = null, array $context = []): array
220220
{
221221
return [
222222
'content' => 'This is my custom problem normalizer.',
@@ -227,7 +227,7 @@ contents, create a new Normalizer that supports the ``FlattenException`` input::
227227
];
228228
}
229229

230-
public function supportsNormalization($data, string $format = null, array $context = []): bool
230+
public function supportsNormalization($data, ?string $format = null, array $context = []): bool
231231
{
232232
return $data instanceof FlattenException;
233233
}

form/dynamic_form_modification.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ The type would now look like::
455455
])
456456
;
457457

458-
$formModifier = function (FormInterface $form, Sport $sport = null): void {
458+
$formModifier = function (FormInterface $form, ?Sport $sport = null): void {
459459
$positions = null === $sport ? [] : $sport->getAvailablePositions();
460460

461461
$form->add('position', EntityType::class, [
@@ -487,7 +487,7 @@ The type would now look like::
487487
$formModifier($event->getForm()->getParent(), $sport);
488488
}
489489
);
490-
490+
491491
// by default, action does not appear in the <form> tag
492492
// you can set this value by passing the controller route
493493
$builder->setAction($options['action']);

http_client.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1804,7 +1804,7 @@ If you want to extend the behavior of a base HTTP client, you can use
18041804
class MyExtendedHttpClient implements HttpClientInterface
18051805
{
18061806
public function __construct(
1807-
private HttpClientInterface $decoratedClient = null
1807+
private ?HttpClientInterface $decoratedClient = null
18081808
) {
18091809
$this->decoratedClient ??= HttpClient::create();
18101810
}
@@ -1820,7 +1820,7 @@ If you want to extend the behavior of a base HTTP client, you can use
18201820
return $response;
18211821
}
18221822

1823-
public function stream($responses, float $timeout = null): ResponseStreamInterface
1823+
public function stream($responses, ?float $timeout = null): ResponseStreamInterface
18241824
{
18251825
return $this->decoratedClient->stream($responses, $timeout);
18261826
}

messenger.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2621,7 +2621,7 @@ provided in order to ease the declaration of these special handlers::
26212621
{
26222622
use BatchHandlerTrait;
26232623

2624-
public function __invoke(MyMessage $message, Acknowledger $ack = null): mixed
2624+
public function __invoke(MyMessage $message, ?Acknowledger $ack = null): mixed
26252625
{
26262626
return $this->handle($message, $ack);
26272627
}

messenger/custom-transport.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Here is a simplified example of a database transport::
5151
*/
5252
public function __construct(
5353
private FakeDatabase $db,
54-
SerializerInterface $serializer = null,
54+
?SerializerInterface $serializer = null,
5555
) {
5656
$this->serializer = $serializer ?? new PhpSerializer();
5757
}

notifier.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -824,7 +824,7 @@ and its ``asChatMessage()`` method::
824824
) {
825825
}
826826

827-
public function asChatMessage(RecipientInterface $recipient, string $transport = null): ?ChatMessage
827+
public function asChatMessage(RecipientInterface $recipient, ?string $transport = null): ?ChatMessage
828828
{
829829
// Add a custom subject and emoji if the message is sent to Slack
830830
if ('slack' === $transport) {

profiler.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ request::
289289

290290
class RequestCollector extends AbstractDataCollector
291291
{
292-
public function collect(Request $request, Response $response, \Throwable $exception = null): void
292+
public function collect(Request $request, Response $response, ?\Throwable $exception = null): void
293293
{
294294
$this->data = [
295295
'method' => $request->getMethod(),

reference/constraints/File.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ type. The ``Author`` class might look as follows::
4040
{
4141
protected File $bioFile;
4242

43-
public function setBioFile(File $file = null): void
43+
public function setBioFile(?File $file = null): void
4444
{
4545
$this->bioFile = $file;
4646
}

0 commit comments

Comments
 (0)