Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 980899e

Browse files
committed
add parameter type declarations to private methods
1 parent 40fe161 commit 980899e

File tree

154 files changed

+329
-723
lines changed

Some content is hidden

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

154 files changed

+329
-723
lines changed

src/Symfony/Bundle/FrameworkBundle/CacheWarmer/TemplateFinder.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,9 @@ public function findAllTemplates()
7070
/**
7171
* Find templates in the given directory.
7272
*
73-
* @param string $dir The folder where to look for templates
74-
*
7573
* @return TemplateReferenceInterface[]
7674
*/
77-
private function findTemplatesInFolder($dir)
75+
private function findTemplatesInFolder(string $dir)
7876
{
7977
$templates = [];
8078

src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
295295
$io->table($headers, $rows);
296296
}
297297

298-
private function formatState($state): string
298+
private function formatState(int $state): string
299299
{
300300
if (self::MESSAGE_MISSING === $state) {
301301
return '<error> missing </error>';

src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ protected function describeEventDispatcherListeners(EventDispatcherInterface $ev
165165
*/
166166
protected function describeCallable($callable, array $options = [])
167167
{
168-
$this->writeData($this->getCallableData($callable, $options), $options);
168+
$this->writeData($this->getCallableData($callable), $options);
169169
}
170170

171171
/**
@@ -315,7 +315,7 @@ private function getEventDispatcherListenersData(EventDispatcherInterface $event
315315
return $data;
316316
}
317317

318-
private function getCallableData($callable, array $options = []): array
318+
private function getCallableData($callable): array
319319
{
320320
$data = [];
321321

@@ -386,7 +386,7 @@ private function getCallableData($callable, array $options = []): array
386386
throw new \InvalidArgumentException('Callable is not describable.');
387387
}
388388

389-
private function describeValue($value, $omitTags, $showArguments)
389+
private function describeValue($value, bool $omitTags, bool $showArguments)
390390
{
391391
if (\is_array($value)) {
392392
$data = [];

src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ protected function describeCallable($callable, array $options = [])
503503
$this->writeText($this->formatCallable($callable), $options);
504504
}
505505

506-
private function renderEventListenerTable(EventDispatcherInterface $eventDispatcher, $event, array $eventListeners, SymfonyStyle $io)
506+
private function renderEventListenerTable(EventDispatcherInterface $eventDispatcher, string $event, array $eventListeners, SymfonyStyle $io)
507507
{
508508
$tableHeaders = ['Order', 'Callable', 'Priority'];
509509
$tableRows = [];

src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/XmlDescriptor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ private function getContainerAliasDocument(Alias $alias, string $id = null): \DO
449449
return $dom;
450450
}
451451

452-
private function getContainerParameterDocument($parameter, $options = []): \DOMDocument
452+
private function getContainerParameterDocument($parameter, array $options = []): \DOMDocument
453453
{
454454
$dom = new \DOMDocument('1.0', 'UTF-8');
455455
$dom->appendChild($parameterXML = $dom->createElement('parameter'));
@@ -485,7 +485,7 @@ private function getEventDispatcherListenersDocument(EventDispatcherInterface $e
485485
return $dom;
486486
}
487487

488-
private function appendEventListenerDocument(EventDispatcherInterface $eventDispatcher, $event, \DOMElement $element, array $eventListeners)
488+
private function appendEventListenerDocument(EventDispatcherInterface $eventDispatcher, string $event, \DOMElement $element, array $eventListeners)
489489
{
490490
foreach ($eventListeners as $listener) {
491491
$callableXML = $this->getCallableDocument($listener);

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1060,7 +1060,7 @@ private function registerAssetsConfiguration(array $config, ContainerBuilder $co
10601060
/**
10611061
* Returns a definition for an asset package.
10621062
*/
1063-
private function createPackageDefinition($basePath, array $baseUrls, Reference $version)
1063+
private function createPackageDefinition(?string $basePath, array $baseUrls, Reference $version)
10641064
{
10651065
if ($basePath && $baseUrls) {
10661066
throw new \LogicException('An asset package cannot have base URLs and base paths.');
@@ -1076,7 +1076,7 @@ private function createPackageDefinition($basePath, array $baseUrls, Reference $
10761076
return $package;
10771077
}
10781078

1079-
private function createVersion(ContainerBuilder $container, $version, $format, $jsonManifestPath, $name)
1079+
private function createVersion(ContainerBuilder $container, ?string $version, ?string $format, ?string $jsonManifestPath, string $name)
10801080
{
10811081
// Configuration prevents $version and $jsonManifestPath from being set
10821082
if (null !== $version) {
@@ -1331,7 +1331,7 @@ private function registerValidatorMapping(ContainerBuilder $container, array $co
13311331
$this->registerMappingFilesFromConfig($container, $config, $fileRecorder);
13321332
}
13331333

1334-
private function registerMappingFilesFromDir($dir, callable $fileRecorder)
1334+
private function registerMappingFilesFromDir(string $dir, callable $fileRecorder)
13351335
{
13361336
foreach (Finder::create()->followLinks()->files()->in($dir)->name('/\.(xml|ya?ml)$/')->sortByName() as $file) {
13371337
$fileRecorder($file->getExtension(), $file->getRealPath());
@@ -1355,7 +1355,7 @@ private function registerMappingFilesFromConfig(ContainerBuilder $container, arr
13551355
}
13561356
}
13571357

1358-
private function registerAnnotationsConfiguration(array $config, ContainerBuilder $container, $loader)
1358+
private function registerAnnotationsConfiguration(array $config, ContainerBuilder $container, LoaderInterface $loader)
13591359
{
13601360
if (!$this->annotationsConfigEnabled) {
13611361
return;

src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/GuardAuthenticationFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public function create(ContainerBuilder $container, $id, $config, $userProvider,
9292
return [$providerId, $listenerId, $entryPointId];
9393
}
9494

95-
private function determineEntryPoint($defaultEntryPointId, array $config)
95+
private function determineEntryPoint(?string $defaultEntryPointId, array $config)
9696
{
9797
if ($defaultEntryPointId) {
9898
// explode if they've configured the entry_point, but there is already one

src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ private function createRoleHierarchy(array $config, ContainerBuilder $container)
176176
$container->removeDefinition('security.access.simple_role_voter');
177177
}
178178

179-
private function createAuthorization($config, ContainerBuilder $container)
179+
private function createAuthorization(array $config, ContainerBuilder $container)
180180
{
181181
foreach ($config['access_control'] as $access) {
182182
$matcher = $this->createRequestMatcher(
@@ -206,7 +206,7 @@ private function createAuthorization($config, ContainerBuilder $container)
206206
}
207207
}
208208

209-
private function createFirewalls($config, ContainerBuilder $container)
209+
private function createFirewalls(array $config, ContainerBuilder $container)
210210
{
211211
if (!isset($config['firewalls'])) {
212212
return;
@@ -273,7 +273,7 @@ private function createFirewalls($config, ContainerBuilder $container)
273273
}
274274
}
275275

276-
private function createFirewall(ContainerBuilder $container, $id, $firewall, &$authenticationProviders, $providerIds, $configId)
276+
private function createFirewall(ContainerBuilder $container, string $id, array $firewall, array &$authenticationProviders, array $providerIds, string $configId)
277277
{
278278
$config = $container->setDefinition($configId, new ChildDefinition('security.firewall.config'));
279279
$config->replaceArgument(0, $id);
@@ -406,7 +406,7 @@ private function createFirewall(ContainerBuilder $container, $id, $firewall, &$a
406406
// Switch user listener
407407
if (isset($firewall['switch_user'])) {
408408
$listenerKeys[] = 'switch_user';
409-
$listeners[] = new Reference($this->createSwitchUserListener($container, $id, $firewall['switch_user'], $defaultProvider, $firewall['stateless'], $providerIds));
409+
$listeners[] = new Reference($this->createSwitchUserListener($container, $id, $firewall['switch_user'], $defaultProvider, $firewall['stateless']));
410410
}
411411

412412
// Access listener
@@ -439,7 +439,7 @@ private function createFirewall(ContainerBuilder $container, $id, $firewall, &$a
439439
return [$matcher, $listeners, $exceptionListener, null !== $logoutListenerId ? new Reference($logoutListenerId) : null];
440440
}
441441

442-
private function createContextListener($container, $contextKey)
442+
private function createContextListener(ContainerBuilder $container, string $contextKey)
443443
{
444444
if (isset($this->contextListeners[$contextKey])) {
445445
return $this->contextListeners[$contextKey];
@@ -452,7 +452,7 @@ private function createContextListener($container, $contextKey)
452452
return $this->contextListeners[$contextKey] = $listenerId;
453453
}
454454

455-
private function createAuthenticationListeners($container, $id, $firewall, &$authenticationProviders, $defaultProvider = null, array $providerIds, $defaultEntryPoint)
455+
private function createAuthenticationListeners(ContainerBuilder $container, string $id, array $firewall, array &$authenticationProviders, ?string $defaultProvider, array $providerIds, ?string $defaultEntryPoint)
456456
{
457457
$listeners = [];
458458
$hasListeners = false;
@@ -519,11 +519,11 @@ private function createAuthenticationListeners($container, $id, $firewall, &$aut
519519
return [$listeners, $defaultEntryPoint];
520520
}
521521

522-
private function createEncoders($encoders, ContainerBuilder $container)
522+
private function createEncoders(array $encoders, ContainerBuilder $container)
523523
{
524524
$encoderMap = [];
525525
foreach ($encoders as $class => $encoder) {
526-
$encoderMap[$class] = $this->createEncoder($encoder, $container);
526+
$encoderMap[$class] = $this->createEncoder($encoder);
527527
}
528528

529529
$container
@@ -532,7 +532,7 @@ private function createEncoders($encoders, ContainerBuilder $container)
532532
;
533533
}
534534

535-
private function createEncoder($config, ContainerBuilder $container)
535+
private function createEncoder(array $config)
536536
{
537537
// a custom encoder service
538538
if (isset($config['id'])) {
@@ -624,7 +624,7 @@ private function createEncoder($config, ContainerBuilder $container)
624624
}
625625

626626
// Parses user providers and returns an array of their ids
627-
private function createUserProviders($config, ContainerBuilder $container)
627+
private function createUserProviders(array $config, ContainerBuilder $container)
628628
{
629629
$providerIds = [];
630630
foreach ($config['providers'] as $name => $provider) {
@@ -636,7 +636,7 @@ private function createUserProviders($config, ContainerBuilder $container)
636636
}
637637

638638
// Parses a <provider> tag and returns the id for the related user provider service
639-
private function createUserDaoProvider($name, $provider, ContainerBuilder $container)
639+
private function createUserDaoProvider(string $name, array $provider, ContainerBuilder $container)
640640
{
641641
$name = $this->getUserProviderId($name);
642642

@@ -675,12 +675,12 @@ private function createUserDaoProvider($name, $provider, ContainerBuilder $conta
675675
throw new InvalidConfigurationException(sprintf('Unable to create definition for "%s" user provider', $name));
676676
}
677677

678-
private function getUserProviderId($name)
678+
private function getUserProviderId(string $name)
679679
{
680680
return 'security.user.provider.concrete.'.strtolower($name);
681681
}
682682

683-
private function createExceptionListener($container, $config, $id, $defaultEntryPoint, $stateless)
683+
private function createExceptionListener(ContainerBuilder $container, array $config, string $id, ?string $defaultEntryPoint, bool $stateless)
684684
{
685685
$exceptionListenerId = 'security.exception_listener.'.$id;
686686
$listener = $container->setDefinition($exceptionListenerId, new ChildDefinition('security.exception_listener'));
@@ -698,7 +698,7 @@ private function createExceptionListener($container, $config, $id, $defaultEntry
698698
return $exceptionListenerId;
699699
}
700700

701-
private function createSwitchUserListener($container, $id, $config, $defaultProvider, $stateless, $providerIds)
701+
private function createSwitchUserListener(ContainerBuilder $container, string $id, array $config, string $defaultProvider, bool $stateless)
702702
{
703703
$userProvider = isset($config['provider']) ? $this->getUserProviderId($config['provider']) : $defaultProvider;
704704

@@ -718,7 +718,7 @@ private function createSwitchUserListener($container, $id, $config, $defaultProv
718718
return $switchUserListenerId;
719719
}
720720

721-
private function createExpression($container, $expression)
721+
private function createExpression(ContainerBuilder $container, string $expression)
722722
{
723723
if (isset($this->expressions[$id = '.security.expression.'.ContainerBuilder::hash($expression)])) {
724724
return $this->expressions[$id];
@@ -737,7 +737,7 @@ private function createExpression($container, $expression)
737737
return $this->expressions[$id] = new Reference($id);
738738
}
739739

740-
private function createRequestMatcher(ContainerBuilder $container, $path = null, $host = null, int $port = null, $methods = [], array $ips = null, array $attributes = [])
740+
private function createRequestMatcher(ContainerBuilder $container, string $path = null, string $host = null, int $port = null, array $methods = [], array $ips = null, array $attributes = [])
741741
{
742742
if ($methods) {
743743
$methods = array_map('strtoupper', (array) $methods);

src/Symfony/Bundle/TwigBundle/CacheWarmer/TemplateCacheCacheWarmer.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,9 @@ public static function getSubscribedServices()
103103
/**
104104
* Find templates in the given directory.
105105
*
106-
* @param string $namespace The namespace for these templates
107-
* @param string $dir The folder where to look for templates
108-
*
109106
* @return array An array of templates
110107
*/
111-
private function findTemplatesInFolder($namespace, $dir)
108+
private function findTemplatesInFolder(string $namespace, string $dir)
112109
{
113110
if (!is_dir($dir)) {
114111
return [];

src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ private function getBundleTemplatePaths(ContainerBuilder $container, array $conf
197197
return $bundleHierarchy;
198198
}
199199

200-
private function normalizeBundleName($name)
200+
private function normalizeBundleName(string $name)
201201
{
202202
if ('Bundle' === substr($name, -6)) {
203203
$name = substr($name, 0, -6);

0 commit comments

Comments
 (0)