Skip to content

Commit 5dc09b7

Browse files
committed
[HttpKernel] Backport type declaration fixes
Signed-off-by: Alexander M. Turek <me@derrabus.de>
1 parent 5c04ec0 commit 5dc09b7

12 files changed

+57
-17
lines changed

CacheClearer/ChainCacheClearer.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ class ChainCacheClearer implements CacheClearerInterface
2222
{
2323
private $clearers;
2424

25+
/**
26+
* @param iterable<mixed, CacheClearerInterface> $clearers
27+
*/
2528
public function __construct(iterable $clearers = [])
2629
{
2730
$this->clearers = $clearers;

CacheClearer/Psr6CacheClearer.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,36 @@
1111

1212
namespace Symfony\Component\HttpKernel\CacheClearer;
1313

14+
use Psr\Cache\CacheItemPoolInterface;
15+
1416
/**
1517
* @author Nicolas Grekas <p@tchwork.com>
1618
*/
1719
class Psr6CacheClearer implements CacheClearerInterface
1820
{
1921
private $pools = [];
2022

23+
/**
24+
* @param array<string, CacheItemPoolInterface> $pools
25+
*/
2126
public function __construct(array $pools = [])
2227
{
2328
$this->pools = $pools;
2429
}
2530

31+
/**
32+
* @return bool
33+
*/
2634
public function hasPool(string $name)
2735
{
2836
return isset($this->pools[$name]);
2937
}
3038

39+
/**
40+
* @return CacheItemPoolInterface
41+
*
42+
* @throws \InvalidArgumentException If the cache pool with the given name does not exist
43+
*/
3144
public function getPool(string $name)
3245
{
3346
if (!$this->hasPool($name)) {
@@ -37,6 +50,11 @@ public function getPool(string $name)
3750
return $this->pools[$name];
3851
}
3952

53+
/**
54+
* @return bool
55+
*
56+
* @throws \InvalidArgumentException If the cache pool with the given name does not exist
57+
*/
4058
public function clearPool(string $name)
4159
{
4260
if (!isset($this->pools[$name])) {

CacheWarmer/CacheWarmerAggregate.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ class CacheWarmerAggregate implements CacheWarmerInterface
2626
private $optionalsEnabled = false;
2727
private $onlyOptionalsEnabled = false;
2828

29+
/**
30+
* @param iterable<mixed, CacheWarmerInterface> $warmers
31+
*/
2932
public function __construct(iterable $warmers = [], bool $debug = false, string $deprecationLogsFilepath = null)
3033
{
3134
$this->warmers = $warmers;

Controller/ArgumentResolver.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,11 @@
2828
final class ArgumentResolver implements ArgumentResolverInterface
2929
{
3030
private $argumentMetadataFactory;
31+
private $argumentValueResolvers;
3132

3233
/**
33-
* @var iterable|ArgumentValueResolverInterface[]
34+
* @param iterable<mixed, ArgumentValueResolverInterface> $argumentValueResolvers
3435
*/
35-
private $argumentValueResolvers;
36-
3736
public function __construct(ArgumentMetadataFactoryInterface $argumentMetadataFactory = null, iterable $argumentValueResolvers = [])
3837
{
3938
$this->argumentMetadataFactory = $argumentMetadataFactory ?? new ArgumentMetadataFactory();
@@ -83,6 +82,9 @@ public function getArguments(Request $request, callable $controller): array
8382
return $arguments;
8483
}
8584

85+
/**
86+
* @return iterable<int, ArgumentValueResolverInterface>
87+
*/
8688
public static function getDefaultArgumentValueResolvers(): iterable
8789
{
8890
return [

DependencyInjection/LazyLoadingFragmentHandler.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
class LazyLoadingFragmentHandler extends FragmentHandler
2424
{
2525
private $container;
26+
27+
/**
28+
* @var array<string, bool>
29+
*/
2630
private $initialized = [];
2731

2832
public function __construct(ContainerInterface $container, RequestStack $requestStack, bool $debug = false)

DependencyInjection/MergeExtensionConfigurationPass.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ class MergeExtensionConfigurationPass extends BaseMergeExtensionConfigurationPas
2323
{
2424
private $extensions;
2525

26+
/**
27+
* @param string[] $extensions
28+
*/
2629
public function __construct(array $extensions)
2730
{
2831
$this->extensions = $extensions;

DependencyInjection/ServicesResetter.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ class ServicesResetter implements ResetInterface
2626
private $resettableServices;
2727
private $resetMethods;
2828

29+
/**
30+
* @param \Traversable<string, object> $resettableServices
31+
* @param array<string, string|string[]> $resetMethods
32+
*/
2933
public function __construct(\Traversable $resettableServices, array $resetMethods)
3034
{
3135
$this->resettableServices = $resettableServices;

EventListener/DebugHandlersListener.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ class DebugHandlersListener implements EventSubscriberInterface
4343
private $hasTerminatedWithException;
4444

4545
/**
46-
* @param callable|null $exceptionHandler A handler that must support \Throwable instances that will be called on Exception
47-
* @param array|int $levels An array map of E_* to LogLevel::* or an integer bit field of E_* constants
48-
* @param int|null $throwAt Thrown errors in a bit field of E_* constants, or null to keep the current value
49-
* @param bool $scream Enables/disables screaming mode, where even silenced errors are logged
50-
* @param bool $scope Enables/disables scoping mode
46+
* @param callable|null $exceptionHandler A handler that must support \Throwable instances that will be called on Exception
47+
* @param array|int|null $levels An array map of E_* to LogLevel::* or an integer bit field of E_* constants
48+
* @param int|null $throwAt Thrown errors in a bit field of E_* constants, or null to keep the current value
49+
* @param bool $scream Enables/disables screaming mode, where even silenced errors are logged
50+
* @param bool $scope Enables/disables scoping mode
5151
*/
5252
public function __construct(callable $exceptionHandler = null, LoggerInterface $logger = null, $levels = \E_ALL, ?int $throwAt = \E_ALL, bool $scream = true, $scope = true, $deprecationLogger = null, $fileLinkFormat = null)
5353
{

EventListener/RouterListener.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,8 @@ class RouterListener implements EventSubscriberInterface
5050
private $debug;
5151

5252
/**
53-
* @param UrlMatcherInterface|RequestMatcherInterface $matcher The Url or Request matcher
54-
* @param RequestContext|null $context The RequestContext (can be null when $matcher implements RequestContextAwareInterface)
55-
* @param string $projectDir
53+
* @param UrlMatcherInterface|RequestMatcherInterface $matcher The Url or Request matcher
54+
* @param RequestContext|null $context The RequestContext (can be null when $matcher implements RequestContextAwareInterface)
5655
*
5756
* @throws \InvalidArgumentException
5857
*/
@@ -67,7 +66,7 @@ public function __construct($matcher, RequestStack $requestStack, RequestContext
6766
}
6867

6968
$this->matcher = $matcher;
70-
$this->context = $context ?: $matcher->getContext();
69+
$this->context = $context ?? $matcher->getContext();
7170
$this->requestStack = $requestStack;
7271
$this->logger = $logger;
7372
$this->projectDir = $projectDir;

HttpKernel.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,7 @@ public function __construct(EventDispatcherInterface $dispatcher, ControllerReso
6060
$this->dispatcher = $dispatcher;
6161
$this->resolver = $resolver;
6262
$this->requestStack = $requestStack ?? new RequestStack();
63-
$this->argumentResolver = $argumentResolver;
64-
65-
if (null === $this->argumentResolver) {
66-
$this->argumentResolver = new ArgumentResolver();
67-
}
63+
$this->argumentResolver = $argumentResolver ?? new ArgumentResolver();
6864
}
6965

7066
/**

0 commit comments

Comments
 (0)