Skip to content

Commit 495f073

Browse files
More return type fixes (bis)
1 parent 488a46f commit 495f073

File tree

26 files changed

+45
-20
lines changed

26 files changed

+45
-20
lines changed

src/Symfony/Bridge/Doctrine/CacheWarmer/ProxyCacheWarmer.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function __construct(ManagerRegistry $registry)
3434
/**
3535
* This cache warmer is not optional, without proxies fatal error occurs!
3636
*
37-
* @return false
37+
* @return bool
3838
*/
3939
public function isOptional()
4040
{

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function warmUp(string $cacheDir)
4949
spl_autoload_register([ClassExistenceResource::class, 'throwOnRequiredClass']);
5050
try {
5151
if (!$this->doWarmUp($cacheDir, $arrayAdapter)) {
52-
return;
52+
return [];
5353
}
5454
} finally {
5555
spl_autoload_unregister([ClassExistenceResource::class, 'throwOnRequiredClass']);

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public function warmUp(string $cacheDir)
100100
{
101101
// skip warmUp when translator doesn't use cache
102102
if (null === $this->options['cache_dir']) {
103-
return;
103+
return [];
104104
}
105105

106106
$localesToWarmUp = $this->enabledLocales ?: array_merge($this->getFallbackLocales(), [$this->getLocale()], $this->resourceLocales);

src/Symfony/Component/Cache/Traits/RedisTrait.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ private function init($redis, string $namespace, int $defaultLifetime, ?Marshall
8484
*
8585
* @param array $options See self::$defaultConnectionOptions
8686
*
87-
* @return \Redis|\RedisCluster|RedisClusterProxy|RedisProxy|\Predis\ClientInterface According to the "class" option
87+
* @return \Redis|\RedisArray|\RedisCluster|RedisClusterProxy|RedisProxy|\Predis\ClientInterface According to the "class" option
8888
*
8989
* @throws InvalidArgumentException when the DSN is invalid
9090
*/

src/Symfony/Component/Console/Helper/HelperInterface.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function setHelperSet(HelperSet $helperSet = null);
2626
/**
2727
* Gets the helper set associated with this helper.
2828
*
29-
* @return HelperSet A HelperSet instance
29+
* @return HelperSet|null
3030
*/
3131
public function getHelperSet();
3232

src/Symfony/Component/Console/Tests/Fixtures/FooLock2Command.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ protected function configure()
1414
$this->setName('foo:lock2');
1515
}
1616

17-
protected function execute(InputInterface $input, OutputInterface $output)
17+
protected function execute(InputInterface $input, OutputInterface $output): int
1818
{
1919
try {
2020
$this->lock();

src/Symfony/Component/Console/Tests/Fixtures/FooLockCommand.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ protected function configure()
1414
$this->setName('foo:lock');
1515
}
1616

17-
protected function execute(InputInterface $input, OutputInterface $output)
17+
protected function execute(InputInterface $input, OutputInterface $output): int
1818
{
1919
if (!$this->lock()) {
2020
return 1;

src/Symfony/Component/Console/Tests/Fixtures/TestCommand.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ protected function configure()
1616
;
1717
}
1818

19-
protected function execute(InputInterface $input, OutputInterface $output)
19+
protected function execute(InputInterface $input, OutputInterface $output): int
2020
{
2121
$output->writeln('execute called');
2222

src/Symfony/Component/DependencyInjection/Definition.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,7 @@ public function setConfigurator($configurator)
812812
/**
813813
* Gets the configurator to call after the service is fully initialized.
814814
*
815-
* @return callable|array|null
815+
* @return string|array|null
816816
*/
817817
public function getConfigurator()
818818
{

src/Symfony/Component/DependencyInjection/Loader/ClosureLoader.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function __construct(ContainerBuilder $container, string $env = null)
3636
*/
3737
public function load($resource, string $type = null)
3838
{
39-
$resource($this->container, $this->env);
39+
return $resource($this->container, $this->env);
4040
}
4141

4242
/**

src/Symfony/Component/DependencyInjection/Loader/DirectoryLoader.php

+2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ public function load($file, string $type = null)
3838
$this->import($dir, null, false, $path);
3939
}
4040
}
41+
42+
return null;
4143
}
4244

4345
/**

src/Symfony/Component/DependencyInjection/Loader/FileLoader.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function import($resource, string $type = null, $ignoreErrors = false, st
6363
}
6464

6565
try {
66-
parent::import(...$args);
66+
return parent::import(...$args);
6767
} catch (LoaderLoadException $e) {
6868
if (!$ignoreNotFound || !($prev = $e->getPrevious()) instanceof FileLocatorFileNotFoundException) {
6969
throw $e;
@@ -79,6 +79,8 @@ public function import($resource, string $type = null, $ignoreErrors = false, st
7979
throw $e;
8080
}
8181
}
82+
83+
return null;
8284
}
8385

8486
/**

src/Symfony/Component/DependencyInjection/Loader/GlobFileLoader.php

+2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ public function load($resource, string $type = null)
2828
}
2929

3030
$this->container->addResource($globResource);
31+
32+
return null;
3133
}
3234

3335
/**

src/Symfony/Component/DependencyInjection/Loader/IniFileLoader.php

+2
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ public function load($resource, string $type = null)
5050
$this->container->setParameter($key, $this->phpize($value));
5151
}
5252
}
53+
54+
return null;
5355
}
5456

5557
/**

src/Symfony/Component/DependencyInjection/Loader/PhpFileLoader.php

+2
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ public function load($resource, string $type = null)
7070
$this->instanceof = [];
7171
$this->registerAliasesForSinglyImplementedInterfaces();
7272
}
73+
74+
return null;
7375
}
7476

7577
/**

src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php

+2
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ public function load($resource, string $type = null)
6666
}
6767
}
6868
}
69+
70+
return null;
6971
}
7072

7173
private function loadXml(\DOMDocument $xml, string $path, \DOMNode $root = null): void

src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public function load($resource, string $type = null)
126126

127127
// empty file
128128
if (null === $content) {
129-
return;
129+
return null;
130130
}
131131

132132
$this->loadContent($content, $path);
@@ -145,6 +145,8 @@ public function load($resource, string $type = null)
145145
$this->env = $env;
146146
}
147147
}
148+
149+
return null;
148150
}
149151

150152
private function loadContent(array $content, string $path)

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public function transform($value)
104104
*
105105
* @param string $value Percentage value
106106
*
107-
* @return int|float Normalized value
107+
* @return int|float|null
108108
*
109109
* @throws TransformationFailedException if the given value is not a string or
110110
* if the value could not be transformed

src/Symfony/Component/HttpFoundation/Session/Storage/MetadataBag.php

+1
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ public function getLastUsed()
139139
public function clear()
140140
{
141141
// nothing to do
142+
return null;
142143
}
143144

144145
/**

src/Symfony/Component/HttpKernel/Tests/KernelTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ public function getNamespace(): string
522522
}
523523

524524
/**
525-
* @return false
525+
* @return string|false
526526
*/
527527
public function getXsdValidationBasePath()
528528
{

src/Symfony/Component/Ldap/Tests/Security/CheckLdapCredentialsListenerTest.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,12 @@ public function testBindFailureShouldThrowAnException()
147147

148148
public function testQueryForDn()
149149
{
150-
$collection = new \ArrayIterator([new Entry('')]);
150+
$collection = new class([new Entry('')]) extends \ArrayObject implements CollectionInterface {
151+
public function toArray(): array
152+
{
153+
return $this->getArrayCopy();
154+
}
155+
};
151156

152157
$query = $this->createMock(QueryInterface::class);
153158
$query->expects($this->once())->method('execute')->willReturn($collection);

src/Symfony/Component/Routing/Matcher/ExpressionLanguageProvider.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,10 @@ public function __construct(ServiceProviderInterface $functions)
3434
*/
3535
public function getFunctions()
3636
{
37+
$functions = [];
38+
3739
foreach ($this->functions->getProvidedServices() as $function => $type) {
38-
yield new ExpressionFunction(
40+
$functions[] = new ExpressionFunction(
3941
$function,
4042
static function (...$args) use ($function) {
4143
return sprintf('($context->getParameter(\'_functions\')->get(%s)(%s))', var_export($function, true), implode(', ', $args));
@@ -45,6 +47,8 @@ function ($values, ...$args) use ($function) {
4547
}
4648
);
4749
}
50+
51+
return $functions;
4852
}
4953

5054
public function get(string $function): callable

src/Symfony/Component/Runtime/Tests/phpt/kernel.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public function __construct(string $var)
1515
$this->var = $var;
1616
}
1717

18-
public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true)
18+
public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true): Response
1919
{
2020
return new Response('OK Kernel '.$this->var);
2121
}

src/Symfony/Component/Security/Http/Authenticator/AbstractAuthenticator.php

-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ abstract class AbstractAuthenticator implements AuthenticatorInterface
2828
/**
2929
* Shortcut to create a PostAuthenticationToken for you, if you don't really
3030
* care about which authenticated token you're using.
31-
*
32-
* @return PostAuthenticationToken
3331
*/
3432
public function createToken(Passport $passport, string $firewallName): TokenInterface
3533
{

src/Symfony/Component/Security/Http/Authenticator/Passport/PassportTrait.php

+3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ trait PassportTrait
2020
{
2121
private $badges = [];
2222

23+
/**
24+
* @return $this
25+
*/
2326
public function addBadge(BadgeInterface $badge): PassportInterface
2427
{
2528
$this->badges[\get_class($badge)] = $badge;

src/Symfony/Component/Validator/Tests/Mapping/MemberMetadataTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public function getPropertyValue($object)
112112
{
113113
}
114114

115-
protected function newReflectionMember($object): object
115+
protected function newReflectionMember($object): \ReflectionMethod|\ReflectionProperty
116116
{
117117
}
118118
}

0 commit comments

Comments
 (0)