Skip to content

Commit 6769c9a

Browse files
committed
[HttpKernel][Security] Refactor: use getAttributes with argument
1 parent 36d8d5d commit 6769c9a

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

src/Symfony/Component/HttpKernel/EventListener/CacheAttributeListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function onKernelControllerArguments(ControllerArgumentsEvent $event): vo
5151
{
5252
$request = $event->getRequest();
5353

54-
if (!\is_array($attributes = $request->attributes->get('_cache') ?? $event->getAttributes()[Cache::class] ?? null)) {
54+
if (!$attributes = $request->attributes->get('_cache') ?? $event->getAttributes(Cache::class)) {
5555
return;
5656
}
5757

src/Symfony/Component/Security/Http/EventListener/IsCsrfTokenValidAttributeListener.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ public function __construct(
3535

3636
public function onKernelControllerArguments(ControllerArgumentsEvent $event): void
3737
{
38-
/** @var IsCsrfTokenValid[] $attributes */
39-
if (!\is_array($attributes = $event->getAttributes()[IsCsrfTokenValid::class] ?? null)) {
38+
if (!$attributes = $event->getAttributes(IsCsrfTokenValid::class)) {
4039
return;
4140
}
4241

src/Symfony/Component/Security/Http/EventListener/IsGrantedAttributeListener.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ public function __construct(
3939

4040
public function onKernelControllerArguments(ControllerArgumentsEvent $event): void
4141
{
42-
/** @var IsGranted[] $attributes */
43-
if (!\is_array($attributes = $event->getAttributes()[IsGranted::class] ?? null)) {
42+
if (!$attributes = $event->getAttributes(IsGranted::class)) {
4443
return;
4544
}
4645

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy