8000 minor #51778 [Console][Form][FrameworkBundle][HttpKernel][PropertyInf… · symfony/symfony@67e53fb · GitHub
[go: up one dir, main page]

Skip to content

Commit 67e53fb

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 ------- 426c4e0 [FrameworkBundle][WebProfilerBundle][Console][Form][HttpKernel][PropertyInfo][Validator] Remove optional before required param
2 parents d65c4af + 426c4e0 commit 67e53fb

File tree

10 files changed

+12
-12
lines changed

10 files changed

+12
-12
lines changed

.github/expected-missing-return-types.diff

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13166,8 +13166,8 @@ diff --git a/src/Symfony/Component/Validator/Context/ExecutionContextInterface.p
1316613166
@@ -127,5 +127,5 @@ interface ExecutionContextInterface
1316713167
* @return void
1316813168
*/
13169-
- public function setNode(mixed $value, ?object $object, MetadataInterface $metadata = null, string $propertyPath);
13170-
+ public function setNode(mixed $value, ?object $object, MetadataInterface $metadata = null, string $propertyPath): void;
13169+
- public function setNode(mixed $value, ?object $object, ?MetadataInterface $metadata, string $propertyPath);
13170+
+ public function setNode(mixed $value, ?object $object, ?MetadataInterface $metadata, string $propertyPath): void;
1317113171

1317213172
/**
1317313173
@@ -136,5 +136,5 @@ interface ExecutionContextInterface

src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/AutowiringTypes/AutowiredServices.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class AutowiredServices
2121
private EventDispatcherInterface $dispatcher;
2222
private CacheItemPoolInterface $cachePool;
2323

24-
public function __construct(Reader $annotationReader = null, EventDispatcherInterface $dispatcher, CacheItemPoolInterface $cachePool)
24+
public function __construct(?Reader $annotationReader, EventDispatcherInterface $dispatcher, CacheItemPoolInterface $cachePool)
2525
{
2626
$this->annotationReader = $annotationReader;
2727
$this->dispatcher = $dispatcher;

src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class ProfilerController
4040
private ?ContentSecurityPolicyHandler $cspHandler;
4141
private ?string $baseDir;
4242

43-
public function __construct(UrlGeneratorInterface $generator, Profiler $profiler = null, Environment $twig, array $templates, ContentSecurityPolicyHandler $cspHandler = null, string $baseDir = null)
43+
public function __construct(UrlGeneratorInterface $generator, ?Profiler $profiler, Environment $twig, array $templates, ContentSecurityPolicyHandler $cspHandler = null, string $baseDir = null)
4444
{
4545
$this->generator = $generator;
4646
$this->profiler = $profiler;

src/Symfony/Bundle/WebProfilerBundle/Controller/RouterController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class RouterController
4040
*/
4141
private iterable $expressionLanguageProviders;
4242

43-
public function __construct(Profiler $profiler = null, Environment $twig, UrlMatcherInterface $matcher = null, RouteCollection $routes = null, iterable $expressionLanguageProviders = [])
43+
public function __construct(?Profiler $profiler, Environment $twig, UrlMatcherInterface $matcher = null, RouteCollection $routes = null, iterable $expressionLanguageProviders = [])
4444
{
4545
$this->profiler = $profiler;
4646
$this->twig = $twig;

src/Symfony/Component/Console/Tests/CI/GithubActionReporterTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function testIsGithubActionEnvironment()
3434
/**
3535
* @dataProvider annotationsFormatProvider
3636
*/
37-
public function testAnnotationsFormat(string $type, string $message, string $file = null, int $line = null, int $col = null, string $expected)
37+
public function testAnnotationsFormat(string $type, string $message, ?string $file, ?int $line, ?int $col, string $expected)
3838
{
3939
$reporter = new GithubActionReporter($buffer = new BufferedOutput());
4040

src/Symfony/Component/Form/Extension/DataCollector/FormDataCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ private function &recursiveBuildPreliminaryFormTree(FormInterface $form, array &
259259
return $output;
260260
}
261261

262-
private function &recursiveBuildFinalFormTree(FormInterface $form = null, FormView $view, array &$outputByHash): array
262+
private function &recursiveBuildFinalFormTree(?FormInterface $form, FormView $view, array &$outputByHash): array
263263
{
264264
$viewHash = spl_object_hash($view);
265265
$formHash = null;

src/Symfony/Component/HttpKernel/Fragment/AbstractSurrogateFragmentRenderer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ abstract class AbstractSurrogateFragmentRenderer extends RoutableFragmentRendere
3434
*
3535
* @param FragmentRendererInterface $inlineStrategy The inline strategy to use when the surrogate is not supported
3636
*/
37-
public function __construct(SurrogateInterface $surrogate = null, FragmentRendererInterface $inlineStrategy, UriSigner $signer = null)
37+
public function __construct(?SurrogateInterface $surrogate, FragmentRendererInterface $inlineStrategy, UriSigner $signer = null)
3838
{
3939
$this->surrogate = $surrogate;
4040
$this->inlineStrategy = $inlineStrategy;

src/Symfony/Component/PropertyInfo/Tests/Extractor/PhpDocExtractorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ protected function setUp(): void
3636
/**
3737
* @dataProvider typesProvider
3838
*/
39-
public function testExtract($property, array $type = null, $shortDescription, $longDescription)
39+
public function testExtract($property, ?array $type, $shortDescription, $longDescription)
4040
{
4141
$this->assertEquals($type, $this->extractor->getTypes('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy', $property));
4242
$this->assertSame($shortDescription, $this->extractor->getShortDescription('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy', $property));
@@ -131,7 +131,7 @@ public static function typesProvider()
131131
/**
132132
* @dataProvider provideCollectionTypes
133133
*/
134-
public function testExtractCollection($property, array $type = null, $shortDescription, $longDescription)
134+
public function testExtractCollection($property, ?array $type, $shortDescription, $longDescription)
135135
{
136136
$this->testExtract($property, $type, $shortDescription, $longDescription);
137137
}

src/Symfony/Component/Validator/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;

src/Symfony/Component/Validator/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)
0