Skip to content

Commit c58ec86

Browse files
derrabusnicolas-grekas
authored andcommitted
Add missing return types to interfaces
1 parent be9d263 commit c58ec86

3 files changed

+29
-2
lines changed

Debug/TraceableEventDispatcher.php

+8-2
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ public function addSubscriber(EventSubscriberInterface $subscriber)
6767
$this->dispatcher->addSubscriber($subscriber);
6868
}
6969

70+
/**
71+
* @return void
72+
*/
7073
public function removeListener(string $eventName, callable|array $listener)
7174
{
7275
if (isset($this->wrappedListeners[$eventName])) {
@@ -79,12 +82,15 @@ public function removeListener(string $eventName, callable|array $listener)
7982
}
8083
}
8184

82-
return $this->dispatcher->removeListener($eventName, $listener);
85+
$this->dispatcher->removeListener($eventName, $listener);
8386
}
8487

88+
/**
89+
* @return void
90+
*/
8591
public function removeSubscriber(EventSubscriberInterface $subscriber)
8692
{
87-
return $this->dispatcher->removeSubscriber($subscriber);
93+
$this->dispatcher->removeSubscriber($subscriber);
8894
}
8995

9096
public function getListeners(string $eventName = null): array

EventDispatcherInterface.php

+9
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ interface EventDispatcherInterface extends ContractsEventDispatcherInterface
2727
*
2828
* @param int $priority The higher this value, the earlier an event
2929
* listener will be triggered in the chain (defaults to 0)
30+
*
31+
* @return void
3032
*/
3133
public function addListener(string $eventName, callable $listener, int $priority = 0);
3234

@@ -35,14 +37,21 @@ public function addListener(string $eventName, callable $listener, int $priority
3537
*
3638
* The subscriber is asked for all the events it is
3739
* interested in and added as a listener for these events.
40+
*
41+
* @return void
3842
*/
3943
public function addSubscriber(EventSubscriberInterface $subscriber);
4044

4145
/**
4246
* Removes an event listener from the specified events.
47+
*
48+
* @return void
4349
*/
4450
public function removeListener(string $eventName, callable $listener);
4551

52+
/**
53+
* @return void
54+
*/
4655
public function removeSubscriber(EventSubscriberInterface $subscriber);
4756

4857
/**

ImmutableEventDispatcher.php

+12
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,33 @@ public function dispatch(object $event, string $eventName = null): object
3030
return $this->dispatcher->dispatch($event, $eventName);
3131
}
3232

33+
/**
34+
* @return never
35+
*/
3336
public function addListener(string $eventName, callable|array $listener, int $priority = 0)
3437
{
3538
throw new \BadMethodCallException('Unmodifiable event dispatchers must not be modified.');
3639
}
3740

41+
/**
42+
* @return never
43+
*/
3844
public function addSubscriber(EventSubscriberInterface $subscriber)
3945
{
4046
throw new \BadMethodCallException('Unmodifiable event dispatchers must not be modified.');
4147
}
4248

49+
/**
50+
* @return never
51+
*/
4352
public function removeListener(string $eventName, callable|array $listener)
4453
{
4554
throw new \BadMethodCallException('Unmodifiable event dispatchers must not be modified.');
4655
}
4756

57+
/**
58+
* @return never
59+
*/
4860
public function removeSubscriber(EventSubscriberInterface $subscriber)
4961
{
5062
throw new \BadMethodCallException('Unmodifiable event dispatchers must not be modified.');

0 commit comments

Comments
 (0)