|
13 | 13 |
|
14 | 14 | use Psr\EventDispatcher\StoppableEventInterface;
|
15 | 15 |
|
16 |
| -if (interface_exists(StoppableEventInterface::class)) { |
| 16 | +/** |
| 17 | + * Event is the base class for classes containing event data. |
| 18 | + * |
| 19 | + * This class contains no event data. It is used by events that do not pass |
| 20 | + * state information to an event handler when an event is raised. |
| 21 | + * |
| 22 | + * You can call the method stopPropagation() to abort the execution of |
| 23 | + * further listeners in your event listener. |
| 24 | + * |
| 25 | + * @author Guilherme Blanco <[email protected]> |
| 26 | + * @author Jonathan Wage <[email protected]> |
| 27 | + * @author Roman Borschel <[email protected]> |
| 28 | + * @author Bernhard Schussek <[email protected]> |
| 29 | + * @author Nicolas Grekas <[email protected]> |
| 30 | + */ |
| 31 | +class Event implements StoppableEventInterface |
| 32 | +{ |
| 33 | + private $propagationStopped = false; |
| 34 | + |
17 | 35 | /**
|
18 |
| - * Event is the base class for classes containing event data. |
19 |
| - * |
20 |
| - * This class contains no event data. It is used by events that do not pass |
21 |
| - * state information to an event handler when an event is raised. |
22 |
| - * |
23 |
| - * You can call the method stopPropagation() to abort the execution of |
24 |
| - * further listeners in your event listener. |
25 |
| - * |
26 |
| - * @author Guilherme Blanco <[email protected]> |
27 |
| - * @author Jonathan Wage <[email protected]> |
28 |
| - * @author Roman Borschel <[email protected]> |
29 |
| - * @author Bernhard Schussek <[email protected]> |
30 |
| - * @author Nicolas Grekas <[email protected]> |
| 36 | + * {@inheritdoc} |
31 | 37 | */
|
32 |
| - class Event implements StoppableEventInterface |
| 38 | + public function isPropagationStopped(): bool |
33 | 39 | {
|
34 |
| - private $propagationStopped = false; |
35 |
| - |
36 |
| - /** |
37 |
| - * Returns whether further event listeners should be triggered. |
38 |
| - */ |
39 |
| - public function isPropagationStopped(): bool |
40 |
| - { |
41 |
| - return $this->propagationStopped; |
42 |
| - } |
43 |
| - |
44 |
| - /** |
45 |
| - * Stops the propagation of the event to further event listeners. |
46 |
| - * |
47 |
| - * If multiple event listeners are connected to the same event, no |
48 |
| - * further event listener will be triggered once any trigger calls |
49 |
| - * stopPropagation(). |
50 |
| - */ |
51 |
| - public function stopPropagation(): void |
52 |
| - { |
53 |
| - $this->propagationStopped = true; |
54 |
| - } |
| 40 | + return $this->propagationStopped; |
55 | 41 | }
|
56 |
| -} else { |
| 42 | + |
57 | 43 | /**
|
58 |
| - * Event is the base class for classes containing event data. |
59 |
| - * |
60 |
| - * This class contains no event data. It is used by events that do not pass |
61 |
| - * state information to an event handler when an event is raised. |
| 44 | + * Stops the propagation of the event to further event listeners. |
62 | 45 | *
|
63 |
| - * You can call the method stopPropagation() to abort the execution of |
64 |
| - * further listeners in your event listener. |
65 |
| - * |
66 |
| - * @author Guilherme Blanco <[email protected]> |
67 |
| - * @author Jonathan Wage <[email protected]> |
68 |
| - * @author Roman Borschel <[email protected]> |
69 |
| - * @author Bernhard Schussek <[email protected]> |
70 |
| - * @author Nicolas Grekas <[email protected]> |
| 46 | + * If multiple event listeners are connected to the same event, no |
| 47 | + * further event listener will be triggered once any trigger calls |
| 48 | + * stopPropagation(). |
71 | 49 | */
|
72 |
| - class Event |
| 50 | + public function stopPropagation(): void |
73 | 51 | {
|
74 |
| - private $propagationStopped = false; |
75 |
| - |
76 |
| - /** |
77 |
| - * Returns whether further event listeners should be triggered. |
78 |
| - */ |
79 |
| - public function isPropagationStopped(): bool |
80 |
| - { |
81 |
| - return $this->propagationStopped; |
82 |
| - } |
83 |
| - |
84 |
| - /** |
85 |
| - * Stops the propagation of the event to further event listeners. |
86 |
| - * |
87 |
| - * If multiple event listeners are connected to the same event, no |
88 |
| - * further event listener will be triggered once any trigger calls |
89 |
| - * stopPropagation(). |
90 |
| - */ |
91 |
| - public function stopPropagation(): void |
92 |
| - { |
93 |
| - $this->propagationStopped = true; |
94 |
| - } |
| 52 | + $this->propagationStopped = true; |
95 | 53 | }
|
96 | 54 | }
|
0 commit comments