8000 Add types to constructors and private/final/internal methods (Batch II) · symfony/symfony@9378eb4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9378eb4

Browse files
derrabusTobion
authored andcommitted
Add types to constructors and private/final/internal methods (Batch II)
1 parent 2b71c6f commit 9378eb4

File tree

79 files changed

+127
-129
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+127
-129
lines changed

src/Symfony/Bundle/FrameworkBundle/Translation/Translator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ protected function initializeCatalogue($locale)
126126
/**
127127
* @internal
128128
*/
129-
protected function doLoadCatalogue($locale): void
129+
protected function doLoadCatalogue(string $locale): void
130130
{
131131
parent::doLoadCatalogue($locale);
132132

src/Symfony/Bundle/FrameworkBundle/composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
"symfony/security-http": "^3.4|^4.0|^5.0",
5151
"symfony/serializer": "^4.3|^5.0",
5252
"symfony/stopwatch": "^3.4|^4.0|^5.0",
53-
"symfony/translation": "^4.3|^5.0",
53+
"symfony/translation": "^4.4|^5.0",
5454
"symfony/templating": "^3.4|^4.0|^5.0",
5555
"symfony/twig-bundle": "^4.4|^5.0",
5656
"symfony/validator": "^4.4|^5.0",
@@ -80,7 +80,7 @@
8080
"symfony/property-info": "<3.4",
8181
"symfony/serializer": "<4.2",
8282
"symfony/stopwatch": "<3.4",
83-
"symfony/translation": "<4.3",
83+
"symfony/translation": "<4.4",
8484
"symfony/twig-bridge": "<4.1.1",
8585
"symfony/twig-bundle": "<4.4",
8686
"symfony/validator": "<4.4",

src/Symfony/Component/Form/ChoiceList/ArrayChoiceList.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ public function getValuesForChoices(array $choices)
182182
*
183183
* @internal
184184
*/
185-
protected function flatten(array $choices, $value, &$choicesByValues, &$keysByValues, &$structuredValues)
185+
protected function flatten(array $choices, callable $value, ?array &$choicesByValues, ?array &$keysByValues, ?array &$structuredValues)
186186
{
187187
if (null === $choicesByValues) {
188188
$choicesByValues = [];

src/Symfony/Component/Form/Command/DebugCommand.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
154154
$helper->describe($io, $object, $options);
155155
}
156156

157-
private function getFqcnTypeClass(InputInterface $input, SymfonyStyle $io, string $shortClassName)
157+
private function getFqcnTypeClass(InputInterface $input, SymfonyStyle $io, string $shortClassName): string
158158
{
159159
$classes = [];
160160
sort($this->namespaces);
@@ -195,7 +195,7 @@ private function getFqcnTypeClass(InputInterface $input, SymfonyStyle $io, strin
195195
return $io->choice(sprintf("The type \"%s\" is ambiguous.\n\nSelect one of the following form types to display its information:", $shortClassName), $classes, $classes[0]);
196196
}
197197

198-
private function getCoreTypes()
198+
private function getCoreTypes(): array
199199
{
200200
$coreExtension = new CoreExtension();
201201
$loadTypesRefMethod = (new \ReflectionObject($coreExtension))->getMethod('loadTypes');
@@ -223,7 +223,7 @@ private function filterTypesByDeprecated(array $types): array
223223
return $typesWithDeprecatedOptions;
224224
}
225225

226-
private function findAlternatives(string $name, array $collection)
226+
private function findAlternatives(string $name, array $collection): array
227227
{
228228
$alternatives = [];
229229
foreach ($collection as $item) {

src/Symfony/Component/Form/Console/Descriptor/Descriptor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ protected function filterOptionsByDeprecated(ResolvedFormTypeInterface $type)
167167
$this->extensionOptions = $filterByDeprecated($this->extensionOptions);
168168
}
169169

170-
private function getParentOptionsResolver(ResolvedFormTypeInterface $type)
170+
private function getParentOptionsResolver(ResolvedFormTypeInterface $type): OptionsResolver
171171
{
172172
$this->parents[$class = \get_class($type->getInnerType())] = [];
173173

src/Symfony/Component/Form/Console/Descriptor/TextDescriptor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ private function buildTableRows(array $headers, array $options): array
155155
return $tableRows;
156156
}
157157

158-
private function normalizeAndSortOptionsColumns(array $options)
158+
private function normalizeAndSortOptionsColumns(array $options): array
159159
{
160160
foreach ($options as $group => $opts) {
161161
$sorted = false;

src/Symfony/Component/Form/DependencyInjection/FormPass.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\Form\DependencyInjection;
1313

14+
use Symfony\Component\DependencyInjection\Argument\ArgumentInterface;
1415
use Symfony\Component\DependencyInjection\Argument\IteratorArgument;
1516
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
1617
use Symfony\Component\DependencyInjection\Compiler\PriorityTaggedServiceTrait;
@@ -60,7 +61,7 @@ public function process(ContainerBuilder $container)
6061
$definition->replaceArgument(2, $this->processFormTypeGuessers($container));
6162
}
6263

63-
private function processFormTypes(ContainerBuilder $container)
64+
private function processFormTypes(ContainerBuilder $container): Reference
6465
{
6566
// Get service locator argument
6667
$servicesMap = [];
@@ -83,7 +84,7 @@ private function processFormTypes(ContainerBuilder $container)
8384
return ServiceLocatorTagPass::register($container, $servicesMap);
8485
}
8586

86-
private function processFormTypeExtensions(ContainerBuilder $container)
87+
private function processFormTypeExtensions(ContainerBuilder $container): array
8788
{
8889
$typeExtensions = [];
8990
$typeExtensionsClasses = [];
@@ -130,7 +131,7 @@ private function processFormTypeExtensions(ContainerBuilder $container)
130131
return $typeExtensions;
131132
}
132133

133-
private function processFormTypeGuessers(ContainerBuilder $container)
134+
private function processFormTypeGuessers(ContainerBuilder $container): ArgumentInterface
134135
{
135136
$guessers = [];
136137
$guessersClasses = [];

src/Symfony/Component/Form/Extension/Core/DataTransformer/DateIntervalToStringTransformer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public function reverseTransform($value)
9494
return $dateInterval;
9595
}
9696

97-
private function isISO8601(string $string)
97+
private function isISO8601(string $string): bool
9898
{
9999
return preg_match('/^P(?=\w*(?:\d|%\w))(?:\d+Y|%[yY]Y)?(?:\d+M|%[mM]M)?(?:(?:\d+D|%[dD]D)|(?:\d+W|%[wW]W))?(?:T(?:\d+H|[hH]H)?(?:\d+M|[iI]M)?(?:\d+S|[sS]S)?)?$/', $string);
100100
}

src/Symfony/Component/Form/Extension/Validator/Constraints/FormValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ private static function getValidationGroups(FormInterface $form)
188188
*
189189
* @param string|GroupSequence|(string|GroupSequence)[]|callable $groups The validation groups
190190
*
191-
* @return (string|GroupSequence)[] The validation groups
191+
* @return GroupSequence|(string|GroupSequence)[] The validation groups
192192
*/
193193
private static function resolveValidationGroups($groups, FormInterface $form)
194194
{

src/Symfony/Component/Form/FormRenderer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ public function humanize($text)
290290
/**
291291
* @internal
292292
*/
293-
public function encodeCurrency(Environment $environment, $text, $widget = '')
293+
public function encodeCurrency(Environment $environment, string $text, string $widget = ''): string
294294
{
295295
if ('UTF-8' === $charset = $environment->getCharset()) {
296296
$text = htmlspecialchars($text, ENT_QUOTES | (\defined('ENT_SUBSTITUTE') ? ENT_SUBSTITUTE : 0), 'UTF-8');

0 commit comments

Comments
 (0)
0