@@ -24,29 +24,13 @@ class ExpressionLanguageProvider implements ExpressionFunctionProviderInterface
24
24
public function getFunctions (): array
25
25
{
26
26
return [
27
- new ExpressionFunction ('is_authenticated ' , function () {
28
- return '$auth_checker->isGranted("IS_AUTHENTICATED") ' ;
29
- }, function (array $ variables ) {
30
- return $ variables ['auth_checker ' ]->isGranted ('IS_AUTHENTICATED ' );
31
- }),
27
+ new ExpressionFunction ('is_authenticated ' , fn () => '$auth_checker->isGranted("IS_AUTHENTICATED") ' , fn (array $ variables ) => $ variables ['auth_checker ' ]->isGranted ('IS_AUTHENTICATED ' )),
32
28
33
- new ExpressionFunction ('is_fully_authenticated ' , function () {
34
- return '$token && $auth_checker->isGranted("IS_AUTHENTICATED_FULLY") ' ;
35
- }, function (array $ variables ) {
36
- return $ variables ['token ' ] && $ variables ['auth_checker ' ]->isGranted ('IS_AUTHENTICATED_FULLY ' );
37
- }),
29
+ new ExpressionFunction ('is_fully_authenticated ' , fn () => '$token && $auth_checker->isGranted("IS_AUTHENTICATED_FULLY") ' , fn (array $ variables ) => $ variables ['token ' ] && $ variables ['auth_checker ' ]->isGranted ('IS_AUTHENTICATED_FULLY ' )),
38
30
39
- new ExpressionFunction ('is_granted ' , function ($ attributes , $ object = 'null ' ) {
40
- return sprintf ('$auth_checker->isGranted(%s, %s) ' , $ attributes , $ object );
41
- }, function (array $ variables , $ attributes , $ object = null ) {
42
- return $ variables ['auth_checker ' ]->isGranted ($ attributes , $ object );
43
- }),
31
+ new ExpressionFunction ('is_granted ' , fn ($ attributes , $ object = 'null ' ) => sprintf ('$auth_checker->isGranted(%s, %s) ' , $ attributes , $ object ), fn (array $ variables , $ attributes , $ object = null ) => $ variables ['auth_checker ' ]->isGranted ($ attributes , $ object )),
44
32
45
- new ExpressionFunction ('is_remember_me ' , function () {
46
- return '$token && $auth_checker->isGranted("IS_REMEMBERED") ' ;
47
- }, function (array $ variables ) {
48
- return $ variables ['token ' ] && $ variables ['auth_checker ' ]->isGranted ('IS_REMEMBERED ' );
49
- }),
33
+ new ExpressionFunction ('is_remember_me ' , fn () => '$token && $auth_checker->isGranted("IS_REMEMBERED") ' , fn (array $ variables ) => $ variables ['token ' ] && $ variables ['auth_checker ' ]->isGranted ('IS_REMEMBERED ' )),
50
34
];
51
35
}
52
36
}
0 commit comments