Skip to content

Commit a6bc80c

Browse files
committed
[FrameworkBundle] Add @return TestContainer to KernelTestCase::getContainer()
1 parent 3fb7af0 commit a6bc80c

File tree

2 files changed

+82
-37
lines changed

2 files changed

+82
-37
lines changed

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

+80-37
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,17 @@ index 1750d55ee2..c18494167a 100644
1616
+
1717
]
1818
},
19+
diff --git a/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php b/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php
20+
index d68ae4c8b3..8e980a9e70 100644
21+
--- a/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php
22+
+++ b/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php
23+
@@ -88,5 +88,5 @@ abstract class KernelTestCase extends TestCase
24+
* @return TestContainer
25+
*/
26+
- protected static function getContainer(): ContainerInterface
27+
+ protected static function getContainer(): TestContainer
28+
{
29+
if (!static::$booted) {
1930
diff --git a/src/Symfony/Component/BrowserKit/AbstractBrowser.php b/src/Symfony/Component/BrowserKit/AbstractBrowser.php
2031
index 697e34cb77..9a1e4c5618 100644
2132
--- a/src/Symfony/Component/BrowserKit/AbstractBrowser.php
@@ -32,7 +43,7 @@ index 697e34cb77..9a1e4c5618 100644
3243
*/
3344
- abstract protected function doRequest(object $request);
3445
+ abstract protected function doRequest(object $request): object;
35-
46+
3647
/**
3748
@@ -460,5 +460,5 @@ abstract class AbstractBrowser
3849
* @return object
@@ -110,21 +121,21 @@ index b94a4378f5..db502e12a7 100644
110121
*/
111122
- public function load(mixed $resource, string $type = null);
112123
+ public function load(mixed $resource, string $type = null): mixed;
113-
124+
114125
/**
115126
@@ -35,5 +35,5 @@ interface LoaderInterface
116127
* @return bool
117128
*/
118129
- public function supports(mixed $resource, string $type = null);
119130
+ public function supports(mixed $resource, string $type = null): bool;
120-
131+
121132
/**
122133
@@ -42,5 +42,5 @@ interface LoaderInterface
123134
* @return LoaderResolverInterface
124135
*/
125136
- public function getResolver();
126137
+ public function getResolver(): LoaderResolverInterface;
127-
138+
128139
/**
129140
diff --git a/src/Symfony/Component/Config/ResourceCheckerInterface.php b/src/Symfony/Component/Config/ResourceCheckerInterface.php
130141
index 6b1c6c5fbe..bb80ed461e 100644
@@ -135,7 +146,7 @@ index 6b1c6c5fbe..bb80ed461e 100644
135146
*/
136147
- public function supports(ResourceInterface $metadata);
137148
+ public function supports(ResourceInterface $metadata): bool;
138-
149+
139150
/**
140151
@@ -42,4 +42,4 @@ interface ResourceCheckerInterface
141152
* @return bool
@@ -233,21 +244,21 @@ index 024da1884e..943790e875 100644
233244
*/
234245
- public function getParameterOption(string|array $values, string|bool|int|float|array|null $default = false, bool $onlyParams = false);
235246
+ public function getParameterOption(string|array $values, string|bool|int|float|array|null $default = false, bool $onlyParams = false): mixed;
236-
247+
237248
/**
238249
@@ -84,5 +84,5 @@ interface InputInterface
239250
* @throws InvalidArgumentException When argument given doesn't exist
240251
*/
241252
- public function getArgument(string $name);
242253
+ public function getArgument(string $name): mixed;
243-
254+
244255
/**
245256
@@ -112,5 +112,5 @@ interface InputInterface
246257
* @throws InvalidArgumentException When option given doesn't exist
247258
*/
248259
- public function getOption(string $name);
249260
+ public function getOption(string $name): mixed;
250-
261+
251262
/**
252263
diff --git a/src/Symfony/Component/DependencyInjection/Compiler/AbstractRecursivePass.php b/src/Symfony/Component/DependencyInjection/Compiler/AbstractRecursivePass.php
253264
index 326d8d4f5f..e62124c7af 100644
@@ -280,7 +291,7 @@ index aa5d6b317e..31ffbca4ef 100644
280291
*/
281292
- public function getParameter(string $name);
282293
+ public function getParameter(string $name): array|bool|string|int|float|null;
283-
294+
284295
public function hasParameter(string $name): bool;
285296
diff --git a/src/Symfony/Component/DependencyInjection/Extension/ConfigurationExtensionInterface.php b/src/Symfony/Component/DependencyInjection/Extension/ConfigurationExtensionInterface.php
286297
index a42967f4da..4e86e16f9d 100644
@@ -326,14 +337,14 @@ index f2373ed5ea..1eec21a938 100644
326337
*/
327338
- public function getNamespace();
328339
+ public function getNamespace(): string;
329-
340+
330341
/**
331342
@@ -40,5 +40,5 @@ interface ExtensionInterface
332343
* @return string|false
333344
*/
334345
- public function getXsdValidationBasePath();
335346
+ public function getXsdValidationBasePath(): string|false;
336-
347+
337348
/**
338349
@@ -49,4 +49,4 @@ interface ExtensionInterface
339350
* @return string
@@ -398,7 +409,7 @@ index 3dbe0a8420..b4179c785c 100644
398409
*/
399410
- abstract protected function loadResourceForBlockName(string $cacheKey, FormView $view, string $blockName);
400411
+ abstract protected function loadResourceForBlockName(string $cacheKey, FormView $view, string $blockName): bool;
401-
412+
402413
/**
403414
diff --git a/src/Symfony/Component/Form/AbstractType.php b/src/Symfony/Component/Form/AbstractType.php
404415
index 3325b8bc27..1cc22a1dab 100644
@@ -427,7 +438,7 @@ index 8495905e17..1e53be60be 100644
427438
*/
428439
- public function transform(mixed $value);
429440
+ public function transform(mixed $value): mixed;
430-
441+
431442
/**
432443
@@ -89,4 +89,4 @@ interface DataTransformerInterface
433444
* @throws TransformationFailedException when the transformation fails
@@ -454,21 +465,21 @@ index 61e2c5f80d..4d6b335474 100644
454465
*/
455466
- public function guessType(string $class, string $property);
456467
+ public function guessType(string $class, string $property): ?Guess\TypeGuess;
457-
468+
458469
/**
459470
@@ -29,5 +29,5 @@ interface FormTypeGuesserInterface
460471
* @return Guess\ValueGuess|null
461472
*/
462473
- public function guessRequired(string $class, string $property);
463474
+ public function guessRequired(string $class, string $property): ?Guess\ValueGuess;
464-
475+
465476
/**
466477
@@ -36,5 +36,5 @@ interface FormTypeGuesserInterface
467478
* @return Guess\ValueGuess|null
468479
*/
469480
- public function guessMaxLength(string $class, string $property);
470481
+ public function guessMaxLength(string $class, string $property): ?Guess\ValueGuess;
471-
482+
472483
/**
473484
@@ -50,4 +50,4 @@ interface FormTypeGuesserInterface
474485
* @return Guess\ValueGuess|null
@@ -485,7 +496,7 @@ index 2b9066a511..1c9e9f5a26 100644
485496
*/
486497
- public function getBlockPrefix();
487498
+ public function getBlockPrefix(): string;
488-
499+
489500
/**
490501
@@ -84,4 +84,4 @@ interface FormTypeInterface
491502
* @return string|null
@@ -572,24 +583,24 @@ index 19ff0db181..f0f4a5829f 100644
572583
*/
573584
- public function getLogs(Request $request = null);
574585
+ public function getLogs(Request $request = null): array;
575-
586+
576587
/**
577588
@@ -37,5 +37,5 @@ interface DebugLoggerInterface
578589
* @return int
579590
*/
580591
- public function countErrors(Request $request = null);
581592
+ public function countErrors(Request $request = null): int;
582-
593+
583594
/**
584595
diff --git a/src/Symfony/Component/Messenger/Envelope.php b/src/Symfony/Component/Messenger/Envelope.php
585596
index bb1194ad1b..bd7fc440ff 100644
586597
--- a/src/Symfony/Component/Messenger/Envelope.php
587598
+++ b/src/Symfony/Component/Messenger/Envelope.php
588599
@@ -13,4 +13,5 @@ namespace Symfony\Component\Messenger;
589-
600+
590601
use Symfony\Component\Messenger\Stamp\StampInterface;
591602
+use Symfony\Component\Messenger\Stamp\StampInterface as TStamp;
592-
603+
593604
/**
594605
@@ -101,5 +102,5 @@ final class Envelope
595606
* @return TStamp|null
@@ -646,35 +657,35 @@ index fbb37d9f94..522e0487a9 100644
646657
*/
647658
- public function getLength();
648659
+ public function getLength(): int;
649-
660+
650661
/**
651662
@@ -43,5 +43,5 @@ interface PropertyPathInterface extends \Traversable
652663
* @return self|null
653664
*/
654665
- public function getParent();
655666
+ public function getParent(): ?\Symfony\Component\PropertyAccess\PropertyPathInterface;
656-
667+
657668
/**
658669
@@ -50,5 +50,5 @@ interface PropertyPathInterface extends \Traversable
659670
* @return list<string>
660671
*/
661672
- public function getElements();
662673
+ public function getElements(): array;
663-
674+
664675
/**
665676
@@ -61,5 +61,5 @@ interface PropertyPathInterface extends \Traversable
666677
* @throws Exception\OutOfBoundsException If the offset is invalid
667678
*/
668679
- public function getElement(int $index);
669680
+ public function getElement(int $index): string;
670-
681+
671682
/**
672683
@@ -72,5 +72,5 @@ interface PropertyPathInterface extends \Traversable
673684
* @throws Exception\OutOfBoundsException If the offset is invalid
674685
*/
675686
- public function isProperty(int $index);
676687
+ public function isProperty(int $index): bool;
677-
688+
678689
/**
679690
@@ -83,4 +83,4 @@ interface PropertyPathInterface extends \Traversable
680691
* @throws Exception\OutOfBoundsException If the offset is invalid
@@ -691,7 +702,7 @@ index f9ee787130..61f8b6d5be 100644
691702
*/
692703
- public function isReadable(string $class, string $property, array $context = []);
693704
+ public function isReadable(string $class, string $property, array $context = []): ?bool;
694-
705+
695706
/**
696707
@@ -31,4 +31,4 @@ interface PropertyAccessExtractorInterface
697708
* @return bool|null
@@ -760,7 +771,7 @@ index eda4730004..00cfc5b9c7 100644
760771
*/
761772
- public function loadTokenBySeries(string $series);
762773
+ public function loadTokenBySeries(string $series): PersistentTokenInterface;
763-
774+
764775
/**
765776
diff --git a/src/Symfony/Component/Security/Core/Authorization/Voter/VoterInterface.php b/src/Symfony/Component/Security/Core/Authorization/Voter/VoterInterface.php
766777
index 7e401c3ff3..6b446ff376 100644
@@ -792,14 +803,14 @@ index ec90d413fa..9f1401aa91 100644
792803
*/
793804
- public function refreshUser(UserInterface $user);
794805
+ public function refreshUser(UserInterface $user): UserInterface;
795-
806+
796807
/**
797808
@@ -52,5 +52,5 @@ interface UserProviderInterface
798809
* @return bool
799810
*/
800811
- public function supportsClass(string $class);
801812
+ public function supportsClass(string $class): bool;
802-
813+
803814
/**
804815
diff --git a/src/Symfony/Component/Security/Http/EntryPoint/AuthenticationEntryPointInterface.php b/src/Symfony/Component/Security/Http/EntryPoint/AuthenticationEntryPointInterface.php
805816
index 91271d14a3..100c2fb549 100644
@@ -841,7 +852,7 @@ index 84a84ad1f3..6f66b6d32a 100644
841852
*/
842853
- public function decode(string $data, string $format, array $context = []);
843854
+ public function decode(string $data, string $format, array $context = []): mixed;
844-
855+
845856
/**
846857
@@ -44,4 +44,4 @@ interface DecoderInterface
847858
* @return bool
@@ -904,14 +915,14 @@ index 3e1e7edc8e..e025b2bc4a 100644
904915
*/
905916
- abstract protected function extractAttributes(object $object, string $format = null, array $context = []);
906917
+ abstract protected function extractAttributes(object $object, string $format = null, array $context = []): array;
907-
918+
908919
/**
909920
@@ -346,10 +346,10 @@ abstract class AbstractObjectNormalizer extends AbstractNormalizer
910921
* @return mixed
911922
*/
912923
- abstract protected function getAttributeValue(object $object, string $attribute, string $format = null, array $context = []);
913924
+ abstract protected function getAttributeValue(object $object, string $attribute, string $format = null, array $context = []): mixed;
914-
925+
915926
/**
916927
* {@inheritdoc}
917928
*/
@@ -935,7 +946,7 @@ index 5e94400b80..726d89cbb1 100644
935946
*/
936947
- public function denormalize(mixed $data, string $type, string $format = null, array $context = []);
937948
+ public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed;
938-
949+
939950
/**
940951
@@ -56,4 +56,4 @@ interface DenormalizerInterface
941952
* @return bool
@@ -952,7 +963,7 @@ index 30eeafb47b..a7a60ad2f2 100644
952963
*/
953964
- public function normalize(mixed $object, string $format = null, array $context = []);
954965
+ public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null;
955-
966+
956967
/**
957968
@@ -47,4 +47,4 @@ interface NormalizerInterface
958969
* @return bool
@@ -969,7 +980,7 @@ index 5dade65db5..db0d0a00ea 100644
969980
*/
970981
- public function getName();
971982
+ public function getName(): string;
972-
983+
973984
/**
974985
diff --git a/src/Symfony/Component/Translation/Extractor/AbstractFileExtractor.php b/src/Symfony/Component/Translation/Extractor/AbstractFileExtractor.php
975986
index 4c088b94f9..86107a636d 100644
@@ -980,7 +991,7 @@ index 4c088b94f9..86107a636d 100644
980991
*/
981992
- abstract protected function canBeExtracted(string $file);
982993
+ abstract protected function canBeExtracted(string $file): bool;
983-
994+
984995
/**
985996
* @return iterable
986997
*/
@@ -1019,3 +1030,35 @@ index d6dcdf178f..0ab8d9c10e 100644
10191030
+ public function getTargets(): string|array
10201031
{
10211032
return self::PROPERTY_CONSTRAINT;
1033+
diff --git a/src/Symfony/Component/Workflow/Event/Event.php b/src/Symfony/Component/Workflow/Event/Event.php
1034+
index cd7fab7896..b340eba38e 100644
1035+
--- a/src/Symfony/Component/Workflow/Event/Event.php
1036+
+++ b/src/Symfony/Component/Workflow/Event/Event.php
1037+
@@ -42,5 +42,5 @@ class Event extends BaseEvent
1038+
* @return Marking
1039+
*/
1040+
- public function getMarking()
1041+
+ public function getMarking(): Marking
1042+
{
1043+
return $this->marking;
1044+
@@ -50,5 +50,5 @@ class Event extends BaseEvent
1045+
* @return object
1046+
*/
1047+
- public function getSubject()
1048+
+ public function getSubject(): object
1049+
{
1050+
return $this->subject;
1051+
@@ -58,5 +58,5 @@ class Event extends BaseEvent
1052+
* @return Transition|null
1053+
*/
1054+
- public function getTransition()
1055+
+ public function getTransition(): ?Transition
1056+
{
1057+
return $this->transition;
1058+
@@ -71,5 +71,5 @@ class Event extends BaseEvent
1059+
* @return string
1060+
*/
1061+
- public function getWorkflowName()
1062+
+ public function getWorkflowName(): string
1063+
{
1064+
return $this->workflow->getName();

src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php

+2
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ protected static function bootKernel(array $options = []): KernelInterface
8484
* used by other services.
8585
*
8686
* Using this method is the best way to get a container from your test code.
87+
*
88+
* @return TestContainer
8789
*/
8890
protected static function getContainer(): ContainerInterface
8991
{

0 commit comments

Comments
 (0)