Skip to content

Commit 5887a4b

Browse files
committed
Merge branch '7.0' into 7.1
* 7.0: minor [CS] Fix more nullable types [Testing] Update nullable types
2 parents 6ac1b81 + d0f8f2b commit 5887a4b

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
@@ -408,7 +408,7 @@ or by using the second argument of the constructor::
408408

409409
class ExpressionLanguage extends BaseExpressionLanguage
410410
{
411-
public function __construct(CacheItemPoolInterface $cache = null, array $providers = [])
411+
public function __construct(?CacheItemPoolInterface $cache = null, array $providers = [])
412412
{
413413
// prepends the default provider to let users override it
414414
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
}
@@ -756,7 +756,7 @@ When serializing, you can set a callback to format a specific object property::
756756
$encoder = new JsonEncoder();
757757

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

@@ -1613,7 +1613,7 @@ having unique identifiers::
16131613
$classMetadataFactory = new ClassMetadataFactory(new AttributeLoader());
16141614

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

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
@@ -1814,7 +1814,7 @@ If you want to extend the behavior of a base HTTP client, you can use
18141814
class MyExtendedHttpClient implements HttpClientInterface
18151815
{
18161816
public function __construct(
1817-
private HttpClientInterface $decoratedClient = null
1817+
private ?HttpClientInterface $decoratedClient = null
18181818
) {
18191819
$this->decoratedClient ??= HttpClient::create();
18201820
}
@@ -1830,7 +1830,7 @@ If you want to extend the behavior of a base HTTP client, you can use
18301830
return $response;
18311831
}
18321832

1833-
public function stream($responses, float $timeout = null): ResponseStreamInterface
1833+
public function stream($responses, ?float $timeout = null): ResponseStreamInterface
18341834
{
18351835
return $this->decoratedClient->stream($responses, $timeout);
18361836
}

messenger.rst

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

2567-
public function __invoke(MyMessage $message, Acknowledger $ack = null): mixed
2567+
public function __invoke(MyMessage $message, ?Acknowledger $ack = null): mixed
25682568
{
25692569
return $this->handle($message, $ack);
25702570
}

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
@@ -795,7 +795,7 @@ and its ``asChatMessage()`` method::
795795
) {
796796
}
797797

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

profiler.rst

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

282282
class RequestCollector extends AbstractDataCollector
283283
{
284-
public function collect(Request $request, Response $response, \Throwable $exception = null): void
284+
public function collect(Request $request, Response $response, ?\Throwable $exception = null): void
285285
{
286286
$this->data = [
287287
'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)