diff --git a/components/expression_language.rst b/components/expression_language.rst index 8092ce491ed..1563ebf1aeb 100644 --- a/components/expression_language.rst +++ b/components/expression_language.rst @@ -385,7 +385,7 @@ or by using the second argument of the constructor:: class ExpressionLanguage extends BaseExpressionLanguage { - public function __construct(CacheItemPoolInterface $cache = null, array $providers = []) + public function __construct(?CacheItemPoolInterface $cache = null, array $providers = []) { // prepends the default provider to let users override it array_unshift($providers, new StringExpressionLanguageProvider()); diff --git a/components/serializer.rst b/components/serializer.rst index 0cd71ec1cc7..62f8af323b1 100644 --- a/components/serializer.rst +++ b/components/serializer.rst @@ -118,7 +118,7 @@ exists in your project:: $this->sportsperson = $sportsperson; } - public function setCreatedAt(\DateTimeInterface $createdAt = null): void + public function setCreatedAt(?\DateTimeInterface $createdAt = null): void { $this->createdAt = $createdAt; } @@ -751,7 +751,7 @@ When serializing, you can set a callback to format a specific object property:: $encoder = new JsonEncoder(); // all callback parameters are optional (you can omit the ones you don't use) - $dateCallback = function (object $innerObject, object $outerObject, string $attributeName, string $format = null, array $context = []): string { + $dateCallback = function (object $innerObject, object $outerObject, string $attributeName, ?string $format = null, array $context = []): string { return $innerObject instanceof \DateTime ? $innerObject->format(\DateTime::ISO8601) : ''; }; @@ -1629,7 +1629,7 @@ having unique identifiers:: $classMetadataFactory = new ClassMetadataFactory(new AttributeLoader()); // all callback parameters are optional (you can omit the ones you don't use) - $maxDepthHandler = function (object $innerObject, object $outerObject, string $attributeName, string $format = null, array $context = []): string { + $maxDepthHandler = function (object $innerObject, object $outerObject, string $attributeName, ?string $format = null, array $context = []): string { return '/foos/'.$innerObject->id; }; diff --git a/controller/error_pages.rst b/controller/error_pages.rst index 52dff49731f..001e637c03e 100644 --- a/controller/error_pages.rst +++ b/controller/error_pages.rst @@ -216,7 +216,7 @@ contents, create a new Normalizer that supports the ``FlattenException`` input:: class MyCustomProblemNormalizer implements NormalizerInterface { - public function normalize($exception, string $format = null, array $context = []): array + public function normalize($exception, ?string $format = null, array $context = []): array { return [ 'content' => 'This is my custom problem normalizer.', @@ -227,7 +227,7 @@ contents, create a new Normalizer that supports the ``FlattenException`` input:: ]; } - public function supportsNormalization($data, string $format = null, array $context = []): bool + public function supportsNormalization($data, ?string $format = null, array $context = []): bool { return $data instanceof FlattenException; } diff --git a/form/dynamic_form_modification.rst b/form/dynamic_form_modification.rst index 72acc7eee0d..09be80ebb5a 100644 --- a/form/dynamic_form_modification.rst +++ b/form/dynamic_form_modification.rst @@ -455,7 +455,7 @@ The type would now look like:: ]) ; - $formModifier = function (FormInterface $form, Sport $sport = null): void { + $formModifier = function (FormInterface $form, ?Sport $sport = null): void { $positions = null === $sport ? [] : $sport->getAvailablePositions(); $form->add('position', EntityType::class, [ @@ -487,7 +487,7 @@ The type would now look like:: $formModifier($event->getForm()->getParent(), $sport); } ); - + // by default, action does not appear in the