Skip to content

Commit 64af5bb

Browse files
MatTheCatnicolas-grekas
authored andcommitted
[HttpKernel] Introduce pinnable value resolvers with #[ValueResolver] and #[AsPinnedValueResolver]
1 parent b587e36 commit 64af5bb

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

Attribute/CurrentUser.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,17 @@
1111

1212
namespace Symfony\Component\Security\Http\Attribute;
1313

14+
use Symfony\Component\HttpKernel\Attribute\ValueResolver;
15+
use Symfony\Component\Security\Http\Controller\UserValueResolver;
16+
1417
/**
1518
* Indicates that a controller argument should receive the current logged user.
1619
*/
1720
#[\Attribute(\Attribute::TARGET_PARAMETER)]
18-
class CurrentUser
21+
class CurrentUser extends ValueResolver
1922
{
23+
public function __construct(bool $disabled = false, string $resolver = UserValueResolver::class)
24+
{
25+
parent::__construct($resolver, $disabled);
26+
}
2027
}

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"symfony/deprecation-contracts": "^2.5|^3",
2121
"symfony/security-core": "~6.0.19|~6.1.11|^6.2.5",
2222
"symfony/http-foundation": "^5.4|^6.0",
23-
"symfony/http-kernel": "^6.2",
23+
"symfony/http-kernel": "^6.3",
2424
"symfony/polyfill-mbstring": "~1.0",
2525
"symfony/property-access": "^5.4|^6.0"
2626
},

0 commit comments

Comments
 (0)