8000 minor #43899 [Security][SecurityBundle] Backport type fixes (derrabus) · symfony/symfony@aa68efc · GitHub
[go: up one dir, main page]

Skip to content

Commit aa68efc

Browse files
committed
minor #43899 [Security][SecurityBundle] Backport type fixes (derrabus)
This PR was merged into the 5.4 branch. Discussion ---------- [Security][SecurityBundle] Backport type fixes | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | Backports from #43872 | License | MIT | Doc PR | N/A Commits ------- 8ac471b [Security] Backport type fixes
2 parents d254e8d + 8ac471b commit aa68efc

File tree

6 files changed

+19
-13
lines changed

6 files changed

+19
-13
lines changed

src/Symfony/Bundle/SecurityBundle/CacheWarmer/ExpressionCacheWarmer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class ExpressionCacheWarmer implements CacheWarmerInterface
2121
private $expressionLanguage;
2222

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

src/Symfony/Component/Security/Core/Role/RoleHierarchy.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@
1919
class RoleHierarchy implements RoleHierarchyInterface
2020
{
2121
private $hierarchy;
22+
/** @var array<string, list<string>> */
2223
protected $map;
2324

2425
/**
25-
* @param array $hierarchy An array defining the hierarchy
26+
* @param array<string, list<string>> $hierarchy
2627
*/
2728
public function __construct(array $hierarchy)
2829
{

src/Symfony/Component/Security/Core/User/ChainUserProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class ChainUserProvider implements UserProviderInterface, PasswordUpgraderInterf
2727
private $providers;
2828

2929
/**
30-
* @param iterable<int, UserProviderInterface> $providers
30+
* @param iterable<array-key, UserProviderInterface> $providers
3131
*/
3232
public function __construct(iterable $providers)
3333
{

src/Symfony/Component/Security/Core/User/InMemoryUserProvider.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,16 @@
2424
*/
2525
class InMemoryUserProvider implements UserProviderInterface
2626
{
27+
/**
28+
* @var array<string, UserInterface>
29+
*/
2730
private $users;
2831

2932
/**
3033
* The user array is a hash where the keys are usernames and the values are
3134
* an array of attributes: 'password', 'enabled', and 'roles'.
3235
*
33-
* @param array $users An array of users
36+
* @param array<string, array{password?: string, enabled?: bool, roles?: list<string>}> $users An array of users
3437
*/
3538
public function __construct(array $users = [])
3639
{

src/Symfony/Component/Security/Http/Authentication/AuthenticatorManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class AuthenticatorManager implements AuthenticatorManagerInterface, UserAuthent
5555
private $requiredBadges;
5656

5757
/**
58-
* @param AuthenticatorInterface[] $authenticators
58+
* @param iterable<mixed, AuthenticatorInterface> $authenticators
5959
*/
6060
public function __construct(iterable $authenticators, TokenStorageInterface $tokenStorage, EventDispatcherInterface $eventDispatcher, string $firewallName, LoggerInterface $logger = null, bool $eraseCredentials = true, bool $hideUserNotFoundExceptions = true, array $requiredBadges = [])
6161
{

src/Symfony/Component/Security/Http/Logout/LogoutUrlGenerator.php

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ class LogoutUrlGenerator
2929
private $router;
3030
private $tokenStorage;
3131
private $listeners = [];
32-
private $currentFirewall;
32+
/** @var string|null */
33+
private $currentFirewallName;
34+
/** @var string|null */
35+
private $currentFirewallContext;
3336

3437
public function __construct(RequestStack $requestStack = null, UrlGeneratorInterface $router = null, TokenStorageInterface $tokenStorage = null)
3538
{
@@ -74,7 +77,8 @@ public function getLogoutUrl(string $key = null)
7477

7578
public function setCurrentFirewall(?string $key, string $context = null)
7679
{
77-
$this->currentFirewall = [$key, $context];
80+
$this->currentFirewallName = $key;
81+
$this->currentFirewallContext = $context;
7882
}
7983

8084
/**
@@ -130,7 +134,7 @@ private function getListener(?string $key): array
130134
if (null !== $this->tokenStorage) {
131135
$token = $this->tokenStorage->getToken();
132136

133-
// @deprecated since 5.4
137+
// @deprecated since Symfony 5.4
134138
if ($token instanceof AnonymousToken) {
135139
throw new \InvalidArgumentException('Unable to generate a logout url for an anonymous token.');
136140
}
@@ -151,14 +155,12 @@ private function getListener(?string $key): array
151155
}
152156

153157
// Fetch from injected current firewall information, if possible
154-
[$key, $context] = $this->currentFirewall;
155-
156-
if (isset($this->listeners[$key])) {
157-
return $this->listeners[$key];
158+
if (isset($this->listeners[$this->currentFirewallName])) {
159+
return $this->listeners[$this->currentFirewallName];
158160
}
159161

160162
foreach ($this->listeners as $listener) {
161-
if (isset($listener[4]) && $context === $listener[4]) {
163+
if (isset($listener[4]) && $this->currentFirewallContext === $listener[4]) {
162164
return $listener;
163165
}
164166
}

0 commit comments

Comments
 (0)
0