simplify Dispatcher and EventDispatcher docblocks

v4
fadrian06 18 hours ago
parent 74c8e456b6
commit 1246c64d99

@ -74,13 +74,6 @@ class Dispatcher
); );
} }
/**
* Sets the engine instance
*
* @param Engine<EngineTemplate> $engine Flight instance
*
* @return void
*/
public function setEngine(Engine $engine): void public function setEngine(Engine $engine): void
{ {
$this->engine = $engine; $this->engine = $engine;
@ -158,14 +151,7 @@ class Dispatcher
return $output; return $output;
} }
/** /** Assigns a callback to an event */
* Assigns a callback to an event.
*
* @param string $name Event name.
* @param callable(): (void|mixed) $callback Callback function.
*
* @return $this
*/
public function set(string $name, callable $callback): self public function set(string $name, callable $callback): self
{ {
$this->events[$name] = $callback; $this->events[$name] = $callback;
@ -173,13 +159,7 @@ class Dispatcher
return $this; return $this;
} }
/** /** Gets an assigned callback */
* Gets an assigned callback.
*
* @param string $name Event name.
*
* @return null|(callable(): (void|mixed)) $callback Callback function.
*/
public function get(string $name): ?callable public function get(string $name): ?callable
{ {
return $this->events[$name] ?? null; return $this->events[$name] ?? null;
@ -498,11 +478,7 @@ class Dispatcher
} }
} }
/** /** Resets the object to the initial state */
* Resets the object to the initial state.
*
* @return $this
*/
public function reset(): self public function reset(): self
{ {
$this->events = []; $this->events = [];

@ -12,7 +12,7 @@ class EventDispatcher
/** @var array<string, array<int, callable(): mixed>> */ /** @var array<string, array<int, callable(): mixed>> */
protected array $listeners = []; protected array $listeners = [];
/** Singleton instance of the EventDispatcher. */ /** Singleton instance of the EventDispatcher */
public static function getInstance(): self public static function getInstance(): self
{ {
if (!self::$instance) { if (!self::$instance) {

Loading…
Cancel
Save