Skip to content

Commit ffb5c26

Browse files
committed
feature #42471 Add generic types to traversable implementations (derrabus)
This PR was merged into the 5.4 branch. Discussion ---------- Add generic types to traversable implementations | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | no | New feature? | kinda | Deprecations? | no | Tickets | N/A | License | MIT | Doc PR | N/A Since tool support for generic types is growing, I wanted to give it a try and add generics to our traversable implementations. This should help Psalm to understand our code better. Furthermore, it helps app developers with running static code analysis on their own codebases. Marking this as WIP for now until I reviewed all errors reported by Psalm. Commits ------- 7f824fcf95 Add generic types to traversable implementations
2 parents 8b1780b + 7e5e614 commit ffb5c26

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

Firewall.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@
1212
namespace Symfony\Component\Security\Http;
1313

1414
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
15+
use Symfony\Component\HttpFoundation\Request;
1516
use Symfony\Component\HttpKernel\Event\FinishRequestEvent;
1617
use Symfony\Component\HttpKernel\Event\RequestEvent;
1718
use Symfony\Component\HttpKernel\KernelEvents;
19+
use Symfony\Component\Security\Http\Firewall\ExceptionListener;
1820
use Symfony\Component\Security\Http\Firewall\FirewallListenerInterface;
1921
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
2022

@@ -32,6 +34,10 @@ class Firewall implements EventSubscriberInterface
3234
{
3335
private $map;
3436
private $dispatcher;
37+
38+
/**
39+
* @var \SplObjectStorage<Request, ExceptionListener>
40+
*/
3541
private $exceptionListeners;
3642

3743
public function __construct(FirewallMapInterface $map, EventDispatcherInterface $dispatcher)

Firewall/ContextListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class ContextListener extends AbstractListener
5858
private $sessionTrackerEnabler;
5959

6060
/**
61-
* @param iterable|UserProviderInterface[] $userProviders
61+
* @param iterable<int, UserProviderInterface> $userProviders
6262
*/
6363
public function __construct(TokenStorageInterface $tokenStorage, iterable $userProviders, string $contextKey, LoggerInterface $logger = null, EventDispatcherInterface $dispatcher = null, AuthenticationTrustResolverInterface $trustResolver = null, callable $sessionTrackerEnabler = null)
6464
{

FirewallMapInterface.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
namespace Symfony\Component\Security\Http;
1313

1414
use Symfony\Component\HttpFoundation\Request;
15+
use Symfony\Component\Security\Http\Firewall\ExceptionListener;
16+
use Symfony\Component\Security\Http\Firewall\LogoutListener;
1517

1618
/**
1719
* This interface must be implemented by firewall maps.
@@ -33,7 +35,7 @@ interface FirewallMapInterface
3335
* If there is no logout listener, the third element of the outer array
3436
* must be null.
3537
*
36-
* @return array of the format [[AuthenticationListener], ExceptionListener, LogoutListener]
38+
* @return array{list<callable>, ExceptionListener, LogoutListener}
3739
*/
3840
public function getListeners(Request $request);
3941
}

0 commit comments

Comments
 (0)