8000 feature #18685 move event listener method type hint docs to @Event an… · symfony/symfony@6857c36 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6857c36

Browse files
committed
feature #18685 move event listener method type hint docs to @event annotations defau… (Haehnchen)
This PR was submitted for the 3.0 branch but it was merged into the 3.1-dev branch instead (closes #18685). Discussion ---------- move event listener method type hint docs to @event annotations defau… | Q | A | ------------- | --- | Branch? | 3.0 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | reference to the documentation PR, if any I moved all `listener method receives a "*"` from php docs to "@event". makes them parsable by PhpStorm Plugin without extract class names out of comments. This helps to prefill type hints on method creation. There is also a fallback for doccomments, but it would be much easier to provide a common structure eg for external libs. see also #18684, which adds some missing "@Events" External issue: Haehnchen/idea-php-symfony2-plugin#493 ![phpstorm-events-method](https://cloud.githubusercontent.com/assets/1011712/14941660/e214f546-0fa3-11e6-8d2e-fa6fc7a6f201.png) Commits ------- f2c0446 move event listener method type hint docs to @event annotations default value. makes it easily parsable by PhpStorm plugin
2 parents cab3f45 + f2c0446 commit 6857c36

File tree

5 files changed

+25
-63
lines changed

5 files changed

+25
-63
lines changed

src/Symfony/Component/Console/ConsoleEvents.php

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,7 @@ final class ConsoleEvents
2323
* executed by the console. It also allows you to modify the command, input and output
2424
* before they are handled to the command.
2525
*
26-
* The event listener method receives a Symfony\Component\Console\Event\ConsoleCommandEvent
27-
* instance.
28-
*
29-
* @Event
26+
* @Event("Symfony\Component\Console\Event\ConsoleCommandEvent")
3027
*
3128
* @var string
3229
*/
@@ -36,10 +33,7 @@ final class ConsoleEvents
3633
* The TERMINATE event allows you to attach listeners after a command is
3734
* executed by the console.
3835
*
39-
* The event listener method receives a Symfony\Component\Console\Event\ConsoleTerminateEvent
40-
* instance.
41-
*
42-
* @Event
36+
* @Event("Symfony\Component\Console\Event\ConsoleTerminateEvent")
4337
*
4438
* @var string
4539
*/
@@ -49,11 +43,9 @@ final class ConsoleEvents
4943
* The EXCEPTION event occurs when an uncaught exception appears.
5044
*
5145
* This event allows you to deal with the exception or
52-
* to modify the thrown exception. The event listener method receives
53-
* a Symfony\Component\Console\Event\ConsoleExceptionEvent
54-
* instance.
46+
* to modify the thrown exception.
5547
*
56-
* @Event
48+
* @Event("Symfony\Component\Console\Event\ConsoleExceptionEvent")
5749
*
5850
* @var string
5951
*/

src/Symfony/Component/Form/FormEvents.php

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,8 @@ final class FormEvents
2828
* It can be used to:
2929
* - Change data from the request, before submitting the data to the form.
3030
* - Add or remove form fields, before submitting the data to the form.
31-
* The event listener method receives a Symfony\Component\Form\FormEvent instance.
3231
*
33-
* @Event
32+
* @Event("Symfony\Component\Form\FormEvent")
3433
*/
3534
const PRE_SUBMIT = 'form.pre_bind';
3635

@@ -39,9 +38,8 @@ final class FormEvents
3938
* transforms back the normalized data to the model and view data.
4039
*
4140
* It can be used to change data from the normalized representation of the data.
42-
* The event listener method receives a Symfony\Component\Form\FormEvent instance.
4341
*
44-
* @Event
42+
* @Event("Symfony\Component\Form\FormEvent")
4543
*/
4644
const SUBMIT = 'form.bind';
4745

@@ -50,9 +48,8 @@ final class FormEvents
5048
* once the model and view data have been denormalized.
5149
*
5250
* It can be used to fetch data after denormalization.
53-
* The event listener method receives a Symfony\Component\Form\FormEvent instance.
5451
*
55-
* @Event
52+
* @Event("Symfony\Component\Form\FormEvent")
5653
*/
5754
const POST_SUBMIT = 'form.post_bind';
5855

@@ -62,19 +59,17 @@ final class FormEvents
6259
* It can be used to:
6360
* - Modify the data given during pre-population;
6461
* - Modify a form depending on the pre-populated data (adding or removing fields dynamically).
65-
* The event listener method receives a Symfony\Component\Form\FormEvent instance.
6662
*
67-
* @Event
63+
* @Event("Symfony\Component\Form\FormEvent")
6864
*/
6965
const PRE_SET_DATA = 'form.pre_set_data';
7066

7167
/**
7268
* The FormEvents::POST_SET_DATA event is dispatched at the end of the Form::setData() method.
7369
*
7470
* This event is mostly here for reading data after having pre-populated the form.
75-
* The event listener method receives a Symfony\Component\Form\FormEvent instance.
7671
*
77-
* @Event
72+
* @Event("Symfony\Component\Form\FormEvent")
7873
*/
7974
const POST_SET_DATA = 'form.post_set_data';
8075

src/Symfony/Component/HttpKernel/KernelEvents.php

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,9 @@ final class KernelEvents
2323
* dispatching.
2424
*
2525
* This event allows you to create a response for a request before any
26-
* other code in the framework is executed. The event listener method
27-
* receives a Symfony\Component\HttpKernel\Event\GetResponseEvent
28-
* instance.
26+
* other code in the framework is executed.
2927
*
30-
* @Event
28+
* @Event("Symfony\Component\HttpKernel\Event\GetResponseEvent")
3129
*
3230
* @var string
3331
*/
@@ -37,11 +35,9 @@ final class KernelEvents
3735
* The EXCEPTION event occurs when an uncaught exception appears.
3836
*
3937
* This event allows you to create a response for a thrown exception or
40-
* to modify the thrown exception. The event listener method receives
41-
* a Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent
42-
* instance.
38+
* to modify the thrown exception.
4339
*
44-
* @Event
40+
* @Event("Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent")
4541
*
4642
* @var string
4743
*/
@@ -52,11 +48,9 @@ final class KernelEvents
5248
* is not a Response instance.
5349
*
5450
* This event allows you to create a response for the return value of the
55-
* controller. The event listener method receives a
56-
* Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent
57-
* instance.
51+
* controller.
5852
*
59-
* @Event
53+
* @Event("Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent")
6054
*
6155
* @var string
6256
*/
@@ -67,10 +61,9 @@ final class KernelEvents
6761
* handling a request.
6862
*
6963
* This event allows you to change the controller that will handle the
70-
* request. The event listener method receives a
71-
* Symfony\Component\HttpKernel\Event\FilterControllerEvent instance.
64+
* request.
7265
*
73-
* @Event
66+
* @Event("Symfony\Component\HttpKernel\Event\FilterControllerEvent")
7467
*
7568
* @var string
7669
*/
@@ -94,10 +87,9 @@ final class KernelEvents
9487
* replying to a request.
9588
*
9689
* This event allows you to modify or replace the response that will be
97-
* replied. The event listener method receives a
98-
* Symfony\Component\HttpKernel\Event\FilterResponseEvent instance.
90+
* replied.
9991
*
100-
* @Event
92+
* @Event("Symfony\Component\HttpKernel\Event\FilterResponseEvent")
10193
*
10294
* @var string
10395
*/
@@ -107,10 +99,8 @@ final class KernelEvents
10799
* The TERMINATE event occurs once a response was sent.
108100
*
109101
* This event allows you to run expensive post-response jobs.
110-
* The event listener method receives a
111-
* Symfony\Component\HttpKernel\Event\PostResponseEvent instance.
112102
*
113-
* @Event
103+
* @Event("Symfony\Component\HttpKernel\Event\PostResponseEvent")
114104
*
115105
* @var string
116106
*/
@@ -121,10 +111,8 @@ final class KernelEvents
121111
*
122112
* This event allows you to reset the global and environmental state of
123113
* the application, when it was changed during the request.
124-
* The event listener method receives a
125-
* Symfony\Component\HttpKernel\Event\FinishRequestEvent instance.
126114
*
127-
* @Event
115+
* @Event("Symfony\Component\HttpKernel\Event\FinishRequestEvent")
128116
*
129117
* @var string
130118
*/

src/Symfony/Component/Security/Core/AuthenticationEvents.php

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@ final class AuthenticationEvents
1717
* The AUTHENTICATION_SUCCESS event occurs after a user is authenticated
1818
* by one provider.
1919
*
20-
* The event listener method receives a
21-
* Symfony\Component\Security\Core\Event\AuthenticationEvent instance.
22-
*
23-
* @Event
20+
* @Event("Symfony\Component\Security\Core\Event\AuthenticationEvent")
2421
*
2522
* @var string
2623
*/
@@ -30,11 +27,7 @@ final class AuthenticationEvents
3027
* The AUTHENTICATION_FAILURE event occurs after a user cannot be
3128
* authenticated by any of the providers.
3229
*
33-
* The event listener method receives a
34-
* Symfony\Component\Security\Core\Event\AuthenticationFailureEvent
35-
* instance.
36-
*
37-
* @Event
30+
* @Event("Symfony\Component\Security\Core\Event\AuthenticationFailureEvent")
3831
*
3932
* @var string
4033
*/

src/Symfony/Component/Security/Http/SecurityEvents.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@ final class SecurityEvents
1717
* The INTERACTIVE_LOGIN event occurs after a user is logged in
1818
* interactively for authentication based on http, cookies or X509.
1919
*
20-
* The event listener method receives a
21-
* Symfony\Component\Security\Http\Event\InteractiveLoginEvent instance.
22-
*
23-
* @Event
20+
* @Event("Symfony\Component\Security\Http\Event\InteractiveLoginEvent")
2421
*
2522
* @var string
2623
*/
@@ -30,10 +27,7 @@ final class SecurityEvents
3027
* The SWITCH_USER event occurs before switch to another user and
3128
* before exit from an already switched user.
3229
*
33-
* The event listener method receives a
34-
* Symfony\Component\Security\Http\Event\SwitchUserEvent instance.
35-
*
36-
* @Event
30+
* @Event("Symfony\Component\Security\Http\Event\SwitchUserEvent")
3731
*
3832
* @var string
3933
*/

0 commit comments

Comments
 (0)
0