Skip to content

Commit 9ea8dc8

Browse files
minor #32993 Turned return type annotations of private methods into php return types (derrabus)
This PR was merged into the 4.4 branch. Discussion ---------- Turned return type annotations of private methods into php return types | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | N/A | License | MIT | Doc PR | N/A As discussed with @nicolas-grekas in symfony/symfony#30323 (comment), this PR attempts to turn `@return` annotations on private methods into return type declarations. Commits ------- f54ca001fe Turned return type annotations of private methods into php return types.
2 parents e424dda + 1c8b541 commit 9ea8dc8

15 files changed

+30
-79
lines changed

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

CacheWarmer/TemplateFinder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public function findAllTemplates()
7272
*
7373
* @return TemplateReferenceInterface[]
7474
*/
75-
private function findTemplatesInFolder(string $dir)
75+
private function findTemplatesInFolder(string $dir): array
7676
{
7777
$templates = [];
7878

@@ -96,7 +96,7 @@ private function findTemplatesInFolder(string $dir)
9696
*
9797
* @return TemplateReferenceInterface[]
9898
*/
99-
private function findTemplatesInBundle(BundleInterface $bundle)
99+
private function findTemplatesInBundle(BundleInterface $bundle): array
100100
{
101101
$name = $bundle->getName();
102102
$templates = array_unique(array_merge(

CacheWarmer/ValidatorCacheWarmer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ protected function warmUpPhpArrayAdapter(PhpArrayAdapter $phpArrayAdapter, array
8989
*
9090
* @return XmlFileLoader[]|YamlFileLoader[]
9191
*/
92-
private function extractSupportedLoaders(array $loaders)
92+
private function extractSupportedLoaders(array $loaders): array
9393
{
9494
$supportedLoaders = [];
9595

Console/Descriptor/MarkdownDescriptor.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -392,10 +392,7 @@ protected function describeCallable($callable, array $options = [])
392392
throw new \InvalidArgumentException('Callable is not describable.');
393393
}
394394

395-
/**
396-
* @return string
397-
*/
398-
private function formatRouterConfig(array $array)
395+
private function formatRouterConfig(array $array): string
399396
{
400397
if (!$array) {
401398
return 'NONE';

Console/Descriptor/XmlDescriptor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ private function getContainerDefinitionDocument(Definition $definition, string $
390390
/**
391391
* @return \DOMNode[]
392392
*/
393-
private function getArgumentNodes(array $arguments, \DOMDocument $dom)
393+
private function getArgumentNodes(array $arguments, \DOMDocument $dom): array
394394
{
395395
$nodes = [];
396396

Tests/Command/RouterMatchCommandTest.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,7 @@ public function testWithNotMatchPath()
4141
$this->assertStringContainsString('None of the routes match the path "/test"', $tester->getDisplay());
4242
}
4343

44-
/**
45-
* @return CommandTester
46-
*/
47-
private function createCommandTester()
44+
private function createCommandTester(): CommandTester
4845
{
4946
$application = new Application($this->getKernel());
5047
$application->add(new RouterMatchCommand($this->getRouter()));

Tests/Command/TranslationDebugCommandTest.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,7 @@ protected function tearDown()
140140
$this->fs->remove($this->translationDir);
141141
}
142142

143-
/**
144-
* @return CommandTester
145-
*/
146-
private function createCommandTester($extractedMessages = [], $loadedMessages = [], $kernel = null, array $transPaths = [], array $viewsPaths = [])
143+
private function createCommandTester($extractedMessages = [], $loadedMessages = [], $kernel = null, array $transPaths = [], array $viewsPaths = []): CommandTester
147144
{
148145
$translator = $this->getMockBuilder('Symfony\Component\Translation\Translator')
149146
->disableOriginalConstructor()

Tests/Command/TranslationUpdateCommandTest.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,7 @@ protected function tearDown()
118118
$this->fs->remove($this->translationDir);
119119
}
120120

121-
/**
122-
* @return CommandTester
123-
*/
124-
private function createCommandTester($extractedMessages = [], $loadedMessages = [], HttpKernel\KernelInterface $kernel = null, array $transPaths = [], array $viewsPaths = [])
121+
private function createCommandTester($extractedMessages = [], $loadedMessages = [], HttpKernel\KernelInterface $kernel = null, array $transPaths = [], array $viewsPaths = []): CommandTester
125122
{
126123
$translator = $this->getMockBuilder('Symfony\Component\Translation\Translator')
127124
->disableOriginalConstructor()

Tests/Command/XliffLintCommandTest.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,7 @@ public function testLintFilesFromBundleDirectory()
7272
$this->assertStringContainsString('[OK] All 0 XLIFF files contain valid syntax', trim($tester->getDisplay()));
7373
}
7474

75-
/**
76-
* @return CommandTester
77-
*/
78-
private function createCommandTester($application = null)
75+
private function createCommandTester($application = null): CommandTester
7976
{
8077
if (!$application) {
8178
$application = new BaseApplication();

Tests/Command/YamlLintCommandTest.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,7 @@ public function testLintFilesFromBundleDirectory()
109109
$this->assertStringContainsString('[OK] All 0 YAML files contain valid syntax', trim($tester->getDisplay()));
110110
}
111111

112-
/**
113-
* @return string Path to the new file
114-
*/
115-
private function createFile($content)
112+
private function createFile($content): string
116113
{
117114
$filename = tempnam(sys_get_temp_dir().'/yml-lint-test', 'sf-');
118115
file_put_contents($filename, $content);
@@ -122,10 +119,7 @@ private function createFile($content)
122119
return $filename;
123120
}
124121

125-
/**
126-
* @return CommandTester
127-
*/
128-
private function createCommandTester($application = null)
122+
private function createCommandTester($application = null): CommandTester
129123
{
130124
if (!$application) {
131125
$application = new BaseApplication();

0 commit comments

Comments
 (0)