Skip to content

Commit 3f42244

Browse files
Add return types to tests and final|internal|private methods
1 parent e0e6831 commit 3f42244

File tree

17 files changed

+32
-27
lines changed

17 files changed

+32
-27
lines changed

Test/TestContainer.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ public function has($id): bool
9797

9898
/**
9999
* {@inheritdoc}
100+
*
101+
* @return object|null
100102
*/
101103
public function get($id, $invalidBehavior = /* self::EXCEPTION_ON_INVALID_REFERENCE */ 1)
102104
{

Tests/Command/CacheClearCommand/Fixture/TestAppKernel.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919

2020
class TestAppKernel extends Kernel
2121
{
22-
public function registerBundles()
22+
public function registerBundles(): iterable
2323
{
2424
return [
2525
new FrameworkBundle(),
2626
];
2727
}
2828

29-
public function getProjectDir()
29+
public function getProjectDir(): string
3030
{
3131
return __DIR__.'/test';
3232
}

Tests/Console/Descriptor/ObjectsProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ public static function staticMethod()
202202

203203
class RouteStub extends Route
204204
{
205-
public function compile()
205+
public function compile(): CompiledRoute
206206
{
207207
return new CompiledRoute('', '#PATH_REGEX#', [], [], '#HOST_REGEX#');
208208
}

Tests/DependencyInjection/Compiler/DataCollectorTranslatorPassTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public function getNotImplementingTranslatorBagInterfaceTranslatorClassNames()
108108

109109
class TranslatorWithTranslatorBag implements TranslatorInterface
110110
{
111-
public function trans($id, array $parameters = [], $domain = null, $locale = null)
111+
public function trans($id, array $parameters = [], $domain = null, $locale = null): string
112112
{
113113
}
114114
}

Tests/DependencyInjection/Fixtures/CustomPathBundle/src/CustomPathBundle.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
class CustomPathBundle extends Bundle
1717
{
18-
public function getPath()
18+
public function getPath(): string
1919
{
2020
return __DIR__.'/..';
2121
}

Tests/Functional/AbstractWebTestCase.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase as BaseWebTestCase;
1515
use Symfony\Component\Filesystem\Filesystem;
16+
use Symfony\Component\HttpKernel\KernelInterface;
1617

1718
abstract class AbstractWebTestCase extends BaseWebTestCase
1819
{
@@ -42,14 +43,14 @@ protected static function deleteTmpDir()
4243
$fs->remove($dir);
4344
}
4445

45-
protected static function getKernelClass()
46+
protected static function getKernelClass(): string
4647
{
4748
require_once __DIR__.'/app/AppKernel.php';
4849

4950
return 'Symfony\Bundle\FrameworkBundle\Tests\Functional\app\AppKernel';
5051
}
5152

52-
protected static function createKernel(array $options = [])
53+
protected static function createKernel(array $options = []): KernelInterface
5354
{
5455
$class = self::getKernelClass();
5556

Tests/Functional/AutowiringTypesTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
1818
use Symfony\Component\EventDispatcher\EventDispatcher;
1919
use Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher;
20+
use Symfony\Component\HttpKernel\KernelInterface;
2021
use Symfony\Component\Templating\EngineInterface as ComponentEngineInterface;
2122

2223
class AutowiringTypesTest extends AbstractWebTestCase
@@ -70,7 +71,7 @@ public function testCacheAutowiring()
7071
$this->assertInstanceOf(FilesystemAdapter::class, $autowiredServices->getCachePool());
7172
}
7273

73-
protected static function createKernel(array $options = [])
74+
protected static function createKernel(array $options = []): KernelInterface
7475
{
7576
return parent::createKernel(['test_case' => 'AutowiringTypes'] + $options);
7677
}

Tests/Functional/Bundle/TestBundle/DependencyInjection/Configuration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public function __construct($customConfig = null)
2323
$this->customConfig = $customConfig;
2424
}
2525

26-
public function getConfigTreeBuilder()
26+
public function getConfigTreeBuilder(): TreeBuilder
2727
{
2828
$treeBuilder = new TreeBuilder('test');
2929

Tests/Functional/Bundle/TestBundle/DependencyInjection/TestExtension.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\DependencyInjection;
1313

14+
use Symfony\Component\Config\Definition\ConfigurationInterface;
1415
use Symfony\Component\DependencyInjection\Alias;
1516
use Symfony\Component\DependencyInjection\ContainerBuilder;
1617
use Symfony\Component\DependencyInjection\Extension\Extension;
@@ -42,7 +43,7 @@ public function prepend(ContainerBuilder $container)
4243
/**
4344
* {@inheritdoc}
4445
*/
45-
public function getConfiguration(array $config, ContainerBuilder $container)
46+
public function getConfiguration(array $config, ContainerBuilder $container): ?ConfigurationInterface
4647
{
4748
return new Configuration($this->customConfig);
4849
}

Tests/Functional/Bundle/TestBundle/TransDebug/TransSubscriberService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function __construct(ContainerInterface $container)
2424
$this->container = $container;
2525
}
2626

27-
public static function getSubscribedServices()
27+
public static function getSubscribedServices(): array
2828
{
2929
return ['translator' => TranslatorInterface::class];
3030
}

0 commit comments

Comments
 (0)