Skip to content

Commit 83c986a

Browse files
committed
[Security] Add types to private properties
Signed-off-by: Alexander M. Turek <me@derrabus.de>
1 parent 915090d commit 83c986a

15 files changed

+58
-54
lines changed

CacheWarmer/ExpressionCacheWarmer.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717

1818
class ExpressionCacheWarmer implements CacheWarmerInterface
1919
{
20-
private $expressions;
21-
private $expressionLanguage;
20+
private iterable $expressions;
21+
private ExpressionLanguage $expressionLanguage;
2222

2323
/**
24-
* @param iterable|Expression[] $expressions
24+
* @param iterable<mixed, Expression|string> $expressions
2525
*/
2626
public function __construct(iterable $expressions, ExpressionLanguage $expressionLanguage)
2727
{

Command/DebugFirewallCommand.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@
3232
#[AsCommand(name: 'debug:firewall', description: 'Display information about your security firewall(s)')]
3333
final class DebugFirewallCommand extends Command
3434
{
35-
private $firewallNames;
36-
private $contexts;
37-
private $eventDispatchers;
38-
private $authenticators;
35+
private array $firewallNames;
36+
private ContainerInterface $contexts;
37+
private ContainerInterface $eventDispatchers;
38+
private array $authenticators;
3939

4040
/**
4141
* @param string[] $firewallNames

DataCollector/SecurityDataCollector.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@
3636
*/
3737
class SecurityDataCollector extends DataCollector implements LateDataCollectorInterface
3838
{
39-
private $tokenStorage;
40-
private $roleHierarchy;
41-
private $logoutUrlGenerator;
42-
private $accessDecisionManager;
43-
private $firewallMap;
44-
private $firewall;
45-
private $hasVarDumper;
39+
private ?TokenStorageInterface $tokenStorage;
40+
private ?RoleHierarchyInterface $roleHierarchy;
41+
private ?LogoutUrlGenerator $logoutUrlGenerator;
42+
private ?AccessDecisionManagerInterface $accessDecisionManager;
43+
private ?FirewallMapInterface $firewallMap;
44+
private ?TraceableFirewallListener $firewall;
45+
private bool $hasVarDumper;
4646

4747
public function __construct(TokenStorageInterface $tokenStorage = null, RoleHierarchyInterface $roleHierarchy = null, LogoutUrlGenerator $logoutUrlGenerator = null, AccessDecisionManagerInterface $accessDecisionManager = null, FirewallMapInterface $firewallMap = null, TraceableFirewallListener $firewall = null)
4848
{

Debug/TraceableFirewallListener.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
*/
2626
final class TraceableFirewallListener extends FirewallListener
2727
{
28-
private $wrappedListeners = [];
29-
private $authenticatorsInfo = [];
28+
private array $wrappedListeners = [];
29+
private array $authenticatorsInfo = [];
3030

3131
public function getWrappedListeners()
3232
{

Debug/TraceableListenerTrait.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Bundle\SecurityBundle\Debug;
1313

14+
use Symfony\Component\HttpFoundation\Response;
1415
use Symfony\Component\Security\Http\Authenticator\Debug\TraceableAuthenticatorManagerListener;
1516
use Symfony\Component\VarDumper\Caster\ClassStub;
1617

@@ -21,10 +22,10 @@
2122
*/
2223
trait TraceableListenerTrait
2324
{
24-
private $response;
25-
private $listener;
26-
private $time;
27-
private $stub;
25+
private ?Response $response = null;
26+
private mixed $listener;
27+
private ?float $time = null;
28+
private object $stub;
2829

2930
/**
3031
* Proxies all method calls to the original listener.

DependencyInjection/MainConfiguration.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ class MainConfiguration implements ConfigurationInterface
3636
/** @internal */
3737
public const STRATEGY_PRIORITY = 'priority';
3838

39-
private $factories;
40-
private $userProviderFactories;
39+
private array $factories;
40+
private array $userProviderFactories;
4141

4242
/**
4343
* @param AuthenticatorFactoryInterface[] $factories

DependencyInjection/SecurityExtension.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,14 @@
5555
*/
5656
class SecurityExtension extends Extension implements PrependExtensionInterface
5757
{
58-
private $requestMatchers = [];
59-
private $expressions = [];
60-
private $contextListeners = [];
58+
private array $requestMatchers = [];
59+
private array $expressions = [];
60+
private array $contextListeners = [];
6161
/** @var list<array{0: int, 1: AuthenticatorFactoryInterface}> */
62-
private $factories = [];
62+
private array $factories = [];
6363
/** @var AuthenticatorFactoryInterface[] */
64-
private $sortedFactories = [];
65-
private $userProviderFactories = [];
64+
private array $sortedFactories = [];
65+
private array $userProviderFactories = [];
6666

6767
public function prepend(ContainerBuilder $container)
6868
{

EventListener/FirewallListener.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
*/
2626
class FirewallListener extends Firewall
2727
{
28-
private $map;
29-
private $logoutUrlGenerator;
28+
private FirewallMapInterface $map;
29+
private LogoutUrlGenerator $logoutUrlGenerator;
3030

3131
public function __construct(FirewallMapInterface $map, EventDispatcherInterface $dispatcher, LogoutUrlGenerator $logoutUrlGenerator)
3232
{

EventListener/VoteListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
*/
2525
class VoteListener implements EventSubscriberInterface
2626
{
27-
private $traceableAccessDecisionManager;
27+
private TraceableAccessDecisionManager $traceableAccessDecisionManager;
2828

2929
public function __construct(TraceableAccessDecisionManager $traceableAccessDecisionManager)
3030
{

RememberMe/DecoratedRememberMeHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
*/
2525
final class DecoratedRememberMeHandler implements RememberMeHandlerInterface
2626
{
27-
private $handler;
27+
private RememberMeHandlerInterface $handler;
2828

2929
public function __construct(RememberMeHandlerInterface $handler)
3030
{

0 commit comments

Comments
 (0)