Skip to content

Commit 12fcb6a

Browse files
[Security] Add deprecation information for is_anonymous
1 parent fb016f7 commit 12fcb6a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

security/expressions.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ accepts an :class:`Symfony\\Component\\ExpressionLanguage\\Expression` object::
2424
public function index(): Response
2525
{
2626
$this->denyAccessUnlessGranted(new Expression(
27-
'"ROLE_ADMIN" in role_names or (not is_anonymous() and user.isSuperAdmin())'
27+
'"ROLE_ADMIN" in role_names or (is_authenticated() and user.isSuperAdmin())'
2828
));
2929

3030
// ...
@@ -78,6 +78,11 @@ Additionally, you have access to a number of functions inside the expression:
7878
equivalent to using the :ref:`isGranted() method <security-isgranted>`
7979
from the security service.
8080

81+
.. deprecated:: 5.4
82+
83+
The ``is_anonymous()`` function is
84+
deprecated since Symfony 5.4.
85+
8186
.. sidebar:: ``is_remember_me()`` is different than checking ``IS_AUTHENTICATED_REMEMBERED``
8287

8388
The ``is_remember_me()`` and ``is_fully_authenticated()`` functions are *similar*

0 commit comments

Comments
 (0)