Skip to content

Commit 815a0cf

Browse files
minor #51778 [Console][Form][FrameworkBundle][HttpKernel][PropertyInfo][Validator][WebProfilerBundle] Remove optional before required param (HypeMC)
This PR was merged into the 6.4 branch. Discussion ---------- [Console][Form][FrameworkBundle][HttpKernel][PropertyInfo][Validator][WebProfilerBundle] Remove optional before required param | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | - | License | MIT I'm guessing this trick was used to make arguments nullable for PHP prior to 7.1, but since Symfony now requires at least PHP 8.1 it shouldn't be necessary any more. As far as I can tell there's no breaking change: https://3v4l.org/USkgi . There are still four places that this is used, but I believe those to be intentional test cases: https://github.com/symfony/symfony/blob/38506585012540306b4a7166a4812d35ad6b8a3c/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/autowiring_classes.php#L179-L184 https://github.com/symfony/symfony/blob/38506585012540306b4a7166a4812d35ad6b8a3c/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/MultipleArgumentsOptionalScalarNotReallyOptional.php#L8-L13 https://github.com/symfony/symfony/blob/38506585012540306b4a7166a4812d35ad6b8a3c/src/Symfony/Component/VarDumper/Tests/Caster/ReflectionCasterTest.php#L653-L655 https://github.com/symfony/symfony/blob/38506585012540306b4a7166a4812d35ad6b8a3c/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/RegisterControllerArgumentLocatorsPassTest.php#L589-L598 Commits ------- 426c4e012a [FrameworkBundle][WebProfilerBundle][Console][Form][HttpKernel][PropertyInfo][Validator] Remove optional before required param
2 parents 2a760e8 + 0f857a1 commit 815a0cf

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Context/ExecutionContext.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public function __construct(ValidatorInterface $validator, mixed $root, Translat
121121
$this->cachedObjectsRefs = new \SplObjectStorage();
122122
}
123123

124-
public function setNode(mixed $value, ?object $object, MetadataInterface $metadata = null, string $propertyPath): void
124+
public function setNode(mixed $value, ?object $object, ?MetadataInterface $metadata, string $propertyPath): void
125125
{
126126
$this->value = $value;
127127
$this->object = $object;

Context/ExecutionContextInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public function getObject(): ?object;
126126
*
127127
* @return void
128128
*/
129-
public function setNode(mixed $value, ?object $object, MetadataInterface $metadata = null, string $propertyPath);
129+
public function setNode(mixed $value, ?object $object, ?MetadataInterface $metadata, string $propertyPath);
130130

131131
/**
132132
* Warning: Should not be called by user code, to be used by the validator engine only.

0 commit comments

Comments
 (0)