Skip to content

Commit fe023ab

Browse files
committed
minor #19899 Remove redundant parenthesis on attribute (alamirault)
This PR was merged into the 6.4 branch. Discussion ---------- Remove redundant parenthesis on attribute Follow #19898 on, 6.4 > > In symfony codebase `#[Foo]` is used instead of `#[Foo()]` > > Phpstorm like also without > ![image](https://github.com/symfony/symfony-docs/assets/9253091/9a4902ef-4c6a-428d-9fae-7034aca17f19) > > I've made also PR for 6.4, if you're agree with this rule I will made other PR. > (And maybe a new doctor-rst rule) Commits ------- 5d63d63 Remove redundant parenthesis on attribute
2 parents 255b3b3 + 5d63d63 commit fe023ab

10 files changed

+18
-18
lines changed

components/http_kernel.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ return a ``Response``.
421421

422422
There is a default listener inside the Symfony Framework for the ``kernel.view``
423423
event. If your controller action returns an array, and you apply the
424-
:ref:`#[Template()] attribute <templates-template-attribute>` to that
424+
:ref:`#[Template] attribute <templates-template-attribute>` to that
425425
controller action, then this listener renders a template, passes the array
426426
you returned from your controller to that template, and creates a ``Response``
427427
containing the returned content from that template.

controller.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ Make sure to install `phpstan/phpdoc-parser`_ and `phpdocumentor/type-resolver`_
557557
if you want to map a nested array of specific DTOs::
558558

559559
public function dashboard(
560-
#[MapRequestPayload()] EmployeesDto $employeesDto
560+
#[MapRequestPayload] EmployeesDto $employeesDto
561561
): Response
562562
{
563563
// ...

http_cache.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ The *easiest* way to cache a response is by caching it for a specific amount of
231231
232232
.. versionadded:: 6.2
233233

234-
The ``#[Cache()]`` attribute was introduced in Symfony 6.2.
234+
The ``#[Cache]`` attribute was introduced in Symfony 6.2.
235235

236236
Thanks to this new code, your HTTP response will have the following header:
237237

@@ -331,7 +331,7 @@ Additionally, most cache-related HTTP headers can be set via the single
331331

332332
.. tip::
333333

334-
All these options are also available when using the ``#[Cache()]`` attribute.
334+
All these options are also available when using the ``#[Cache]`` attribute.
335335

336336
Cache Invalidation
337337
------------------

http_cache/cache_vary.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ trigger a different representation of the requested resource:
2828
resource based on the URI and the value of the ``Accept-Encoding`` and
2929
``User-Agent`` request header.
3030

31-
Set the ``Vary`` header via the ``Response`` object methods or the ``#[Cache()]``
31+
Set the ``Vary`` header via the ``Response`` object methods or the ``#[Cache]``
3232
attribute::
3333

3434
.. configuration-block::

http_cache/expiration.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ or disadvantage to either.
6161

6262
According to the HTTP specification, "the ``Expires`` header field gives
6363
the date/time after which the response is considered stale." The ``Expires``
64-
header can be set with the ``expires`` option of the ``#[Cache()]`` attribute or
64+
header can be set with the ``expires`` option of the ``#[Cache]`` attribute or
6565
the ``setExpires()`` ``Response`` method::
6666

6767
.. configuration-block::

security.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -2525,7 +2525,7 @@ will happen:
25252525
.. _security-securing-controller-annotations:
25262526
.. _security-securing-controller-attributes:
25272527

2528-
Another way to secure one or more controller actions is to use the ``#[IsGranted()]`` attribute.
2528+
Another way to secure one or more controller actions is to use the ``#[IsGranted]`` attribute.
25292529
In the following example, all controller actions will require the
25302530
``ROLE_ADMIN`` permission, except for ``adminDashboard()``, which will require
25312531
the ``ROLE_SUPER_ADMIN`` permission:
@@ -2579,11 +2579,11 @@ that is thrown with the ``exceptionCode`` argument::
25792579

25802580
.. versionadded:: 6.2
25812581

2582-
The ``#[IsGranted()]`` attribute was introduced in Symfony 6.2.
2582+
The ``#[IsGranted]`` attribute was introduced in Symfony 6.2.
25832583

25842584
.. versionadded:: 6.3
25852585

2586-
The ``exceptionCode`` argument of the ``#[IsGranted()]`` attribute was
2586+
The ``exceptionCode`` argument of the ``#[IsGranted]`` attribute was
25872587
introduced in Symfony 6.3.
25882588

25892589
.. _security-template:

security/expressions.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Using Expressions in Security Access Controls
77
the :doc:`Voter System </security/voters>`.
88

99
In addition to security roles like ``ROLE_ADMIN``, the ``isGranted()`` method
10-
and ``#[IsGranted()]`` attribute also accept an
10+
and ``#[IsGranted]`` attribute also accept an
1111
:class:`Symfony\\Component\\ExpressionLanguage\\Expression` object:
1212

1313
.. configuration-block::
@@ -71,7 +71,7 @@ and ``#[IsGranted()]`` attribute also accept an
7171
7272
.. versionadded:: 6.2
7373

74-
The ``#[IsGranted()]`` attribute was introduced in Symfony 6.2.
74+
The ``#[IsGranted]`` attribute was introduced in Symfony 6.2.
7575

7676
In this example, if the current user has ``ROLE_ADMIN`` or if the current
7777
user object's ``isSuperAdmin()`` method returns ``true``, then access will
@@ -142,7 +142,7 @@ Additionally, you have access to a number of functions inside the expression:
142142
true if the user has actually logged in during this session (i.e. is
143143
full-fledged).
144144

145-
In case of the ``#[IsGranted()]`` attribute, the subject can also be an
145+
In case of the ``#[IsGranted]`` attribute, the subject can also be an
146146
:class:`Symfony\\Component\\ExpressionLanguage\\Expression` object::
147147

148148
// src/Controller/MyController.php

security/voters.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -121,14 +121,14 @@ code like this:
121121
}
122122
}
123123
124-
The ``#[IsGranted()]`` attribute or ``denyAccessUnlessGranted()`` method (and also the ``isGranted()`` method)
124+
The ``#[IsGranted]`` attribute or ``denyAccessUnlessGranted()`` method (and also the ``isGranted()`` method)
125125
calls out to the "voter" system. Right now, no voters will vote on whether or not
126126
the user can "view" or "edit" a ``Post``. But you can create your *own* voter that
127127
decides this using whatever logic you want.
128128

129129
.. versionadded:: 6.2
130130

131-
The ``#[IsGranted()]`` attribute was introduced in Symfony 6.2.
131+
The ``#[IsGranted]`` attribute was introduced in Symfony 6.2.
132132

133133
Creating the custom Voter
134134
-------------------------

service_container/lazy_services.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ laziness, and supports lazy-autowiring of union types::
131131

132132
.. versionadded:: 6.3
133133

134-
The ``lazy`` argument of the ``#[Autowire()]`` attribute was introduced in
134+
The ``lazy`` argument of the ``#[Autowire]`` attribute was introduced in
135135
Symfony 6.3.
136136

137137
Interface Proxifying

templates.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ use the ``render()`` method of the ``twig`` service.
579579

580580
.. _templates-template-attribute:
581581

582-
Another option is to use the ``#[Template()]`` attribute on the controller method
582+
Another option is to use the ``#[Template]`` attribute on the controller method
583583
to define the template to render::
584584

585585
// src/Controller/ProductController.php
@@ -596,7 +596,7 @@ to define the template to render::
596596
{
597597
// ...
598598

599-
// when using the #[Template()] attribute, you only need to return
599+
// when using the #[Template] attribute, you only need to return
600600
// an array with the parameters to pass to the template (the attribute
601601
// is the one which will create and return the Response object).
602602
return [
@@ -608,7 +608,7 @@ to define the template to render::
608608

609609
.. versionadded:: 6.2
610610

611-
The ``#[Template()]`` attribute was introduced in Symfony 6.2.
611+
The ``#[Template]`` attribute was introduced in Symfony 6.2.
612612

613613
The :ref:`base AbstractController <the-base-controller-classes-services>` also provides the
614614
:method:`Symfony\\Bundle\\FrameworkBundle\\Controller\\AbstractController::renderBlock`

0 commit comments

Comments
 (0)