@@ -134,9 +134,7 @@ Using Expressions for Complex Security Restrictions
134134If your security logic is a little bit more complex, you can use an :doc: `expression </components/expression_language >`
135135inside ``@Security ``. In the following example, a user can only access the
136136controller if their email matches the value returned by the ``getAuthorEmail() ``
137- method on the ``Post `` object:
138-
139- .. code-block :: php
137+ method on the ``Post `` object::
140138
141139 use App\Entity\Post;
142140 use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
@@ -167,9 +165,7 @@ need to repeat the expression code using Twig syntax:
167165 {% endif %}
168166
169167The easiest solution - if your logic is simple enough - is to add a new method
170- to the ``Post `` entity that checks if a given user is its author:
171-
172- .. code-block :: php
168+ to the ``Post `` entity that checks if a given user is its author::
173169
174170 // src/Entity/Post.php
175171 // ...
@@ -189,9 +185,7 @@ to the ``Post`` entity that checks if a given user is its author:
189185 }
190186 }
191187
192- Now you can reuse this method both in the template and in the security expression:
193-
194- .. code-block :: php
188+ Now you can reuse this method both in the template and in the security expression::
195189
196190 use App\Entity\Post;
197191 use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
@@ -222,9 +216,7 @@ Checking Permissions without @Security
222216The above example with ``@Security `` only works because we're using the
223217:ref: `ParamConverter <best-practices-paramconverter >`, which gives the expression
224218access to the ``post `` variable. If you don't use this, or have some other
225- more advanced use-case, you can always do the same security check in PHP:
226-
227- .. code-block :: php
219+ more advanced use-case, you can always do the same security check in PHP::
228220
229221 /**
230222 * @Route("/{id}/edit", name="admin_post_edit")
@@ -271,9 +263,7 @@ If your security logic is complex and can't be centralized into a method like
271263all cases.
272264
273265First, create a voter class. The following example shows a voter that implements
274- the same ``getAuthorEmail() `` logic you used above:
275-
276- .. code-block :: php
266+ the same ``getAuthorEmail() `` logic you used above::
277267
278268 namespace App\Security;
279269
@@ -345,9 +335,7 @@ your application will :ref:`autoconfigure <services-autoconfigure>` your securit
345335voter and inject an ``AccessDecisionManagerInterface `` instance into it thanks to
346336:doc: `autowiring </service_container/autowiring >`.
347337
348- Now, you can use the voter with the ``@Security `` annotation:
349-
350- .. code-block :: php
338+ Now, you can use the voter with the ``@Security `` annotation::
351339
352340 /**
353341 * @Route("/{id}/edit", name="admin_post_edit")
@@ -359,9 +347,7 @@ Now, you can use the voter with the ``@Security`` annotation:
359347 }
360348
361349You can also use this directly with the ``security.authorization_checker `` service or
362- via the even easier shortcut in a controller:
363-
364- .. code-block :: php
350+ via the even easier shortcut in a controller::
365351
366352 /**
367353 * @Route("/{id}/edit", name="admin_post_edit")
0 commit comments