Skip to content

Commit 3872e44

Browse files
committed
Turned return type annotations of private methods into php return types.
1 parent 3498259 commit 3872e44

File tree

107 files changed

+205
-537
lines changed

Some content is hidden

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

107 files changed

+205
-537
lines changed

src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -443,11 +443,9 @@ abstract protected function getMappingResourceExtension();
443443
/**
444444
* Search for a manager that is declared as 'auto_mapping' = true.
445445
*
446-
* @return string|null The name of the manager. If no one manager is found, returns null
447-
*
448446
* @throws \LogicException
449447
*/
450-
private function validateAutoMapping(array $managerConfigs)
448+
private function validateAutoMapping(array $managerConfigs): ?string
451449
{
452450
$autoMappedManager = null;
453451
foreach ($managerConfigs as $name => $manager) {

src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPass.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,8 @@ private function getEventManagerDef(ContainerBuilder $container, string $name)
127127
*
128128
* @see https://bugs.php.net/bug.php?id=53710
129129
* @see https://bugs.php.net/bug.php?id=60926
130-
*
131-
* @return array
132130
*/
133-
private function findAndSortTags(string $tagName, ContainerBuilder $container)
131+
private function findAndSortTags(string $tagName, ContainerBuilder $container): array
134132
{
135133
$sortedTags = [];
136134

src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterMappingsPass.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -191,12 +191,10 @@ protected function getDriver(ContainerBuilder $container)
191191
/**
192192
* Get the service name from the pattern and the configured manager name.
193193
*
194-
* @return string a service definition name
195-
*
196194
* @throws InvalidArgumentException if none of the managerParameters has a
197195
* non-empty value
198196
*/
199-
private function getConfigurationServiceName(ContainerBuilder $container)
197+
private function getConfigurationServiceName(ContainerBuilder $container): string
200198
{
201199
return sprintf($this->configurationPattern, $this->getManagerName($container));
202200
}
@@ -207,11 +205,9 @@ private function getConfigurationServiceName(ContainerBuilder $container)
207205
* The default implementation loops over the managerParameters and returns
208206
* the first non-empty parameter.
209207
*
210-
* @return string The name of the active manager
211-
*
212208
* @throws InvalidArgumentException if none of the managerParameters is found in the container
213209
*/
214-
private function getManagerName(ContainerBuilder $container)
210+
private function getManagerName(ContainerBuilder $container): string
215211
{
216212
foreach ($this->managerParameters as $param) {
217213
if ($container->hasParameter($param)) {

src/Symfony/Bridge/Doctrine/Form/Type/EntityType.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,8 @@ public function getQueryBuilderPartsForCachingHash($queryBuilder)
8686

8787
/**
8888
* Converts a query parameter to an array.
89-
*
90-
* @return array The array representation of the parameter
9189
*/
92-
private function parameterToArray(Parameter $parameter)
90+
private function parameterToArray(Parameter $parameter): array
9391
{
9492
return [$parameter->getName(), $parameter->getType(), $parameter->getValue()];
9593
}

src/Symfony/Bridge/Doctrine/Test/TestRepositoryFactory.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,7 @@ public function setRepository(EntityManagerInterface $entityManager, $entityName
4747
$this->repositoryList[$repositoryHash] = $repository;
4848
}
4949

50-
/**
51-
* @return ObjectRepository
52-
*/
53-
private function createRepository(EntityManagerInterface $entityManager, string $entityName)
50+
private function createRepository(EntityManagerInterface $entityManager, string $entityName): ObjectRepository
5451
{
5552
/* @var $metadata ClassMetadata */
5653
$metadata = $entityManager->getClassMetadata($entityName);

src/Symfony/Bridge/Monolog/Handler/ConsoleHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ protected function getDefaultFormatter()
172172
*
173173
* @return bool Whether the handler is enabled and verbosity is not set to quiet
174174
*/
175-
private function updateLevel()
175+
private function updateLevel(): bool
176176
{
177177
if (null === $this->output) {
178178
return false;

src/Symfony/Bridge/Monolog/Logger.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,8 @@ public function removeDebugLogger()
9797

9898
/**
9999
* Returns a DebugLoggerInterface instance if one is registered with this logger.
100-
*
101-
* @return DebugLoggerInterface|null A DebugLoggerInterface instance or null if none is registered
102100
*/
103-
private function getDebugLogger()
101+
private function getDebugLogger(): ?DebugLoggerInterface
104102
{
105103
foreach ($this->processors as $processor) {
106104
if ($processor instanceof DebugLoggerInterface) {
@@ -113,5 +111,7 @@ private function getDebugLogger()
113111
return $handler;
114112
}
115113
}
114+
115+
return null;
116116
}
117117
}

src/Symfony/Bridge/Twig/NodeVisitor/TranslationDefaultDomainNodeVisitor.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,7 @@ public function getPriority()
113113
return -10;
114114
}
115115

116-
/**
117-
* @return bool
118-
*/
119-
private function isNamedArguments(Node $arguments)
116+
private function isNamedArguments(Node $arguments): bool
120117
{
121118
foreach ($arguments as $name => $node) {
122119
if (!\is_int($name)) {

src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,7 @@ public function testLintFileCompileTimeException()
6666
$this->assertRegExp('/ERROR in \S+ \(line /', trim($tester->getDisplay()));
6767
}
6868

69-
/**
70-
* @return CommandTester
71-
*/
72-
private function createCommandTester()
69+
private function createCommandTester(): CommandTester
7370
{
7471
$command = new LintCommand(new Environment(new FilesystemLoader()));
7572

@@ -80,10 +77,7 @@ private function createCommandTester()
8077
return new CommandTester($command);
8178
}
8279

83-
/**
84-
* @return string Path to the new file
85-
*/
86-
private function createFile($content)
80+
private function createFile($content): string
8781
{
8882
$filename = tempnam(sys_get_temp_dir(), 'sf-');
8983
file_put_contents($filename, $content);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ protected function doWarmUp($cacheDir, ArrayAdapter $arrayAdapter)
7474
*
7575
* @return XmlFileLoader[]|YamlFileLoader[]
7676
*/
77-
private function extractSupportedLoaders(array $loaders)
77+
private function extractSupportedLoaders(array $loaders): array
7878
{
7979
$supportedLoaders = [];
8080

0 commit comments

Comments
 (0)