From 10065cc2cd9d99473823a1d5d98a30bf93acacbf Mon Sep 17 00:00:00 2001 From: Rudie Dirkx Date: Sun, 24 Nov 2024 00:23:32 +0100 Subject: [PATCH 1/3] event name & listener callback types --- .../Database/Eloquent/Concerns/HasEvents.php | 22 +++++++++---------- .../Database/Eloquent/SoftDeletes.php | 10 ++++----- src/Illuminate/Events/Dispatcher.php | 4 ++-- src/Illuminate/Support/Facades/Event.php | 2 +- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/Illuminate/Database/Eloquent/Concerns/HasEvents.php b/src/Illuminate/Database/Eloquent/Concerns/HasEvents.php index 304324fa61ec..47919939b6dc 100644 --- a/src/Illuminate/Database/Eloquent/Concerns/HasEvents.php +++ b/src/Illuminate/Database/Eloquent/Concerns/HasEvents.php @@ -183,7 +183,7 @@ public function removeObservableEvents($observables) * Register a model event with the dispatcher. * * @param string $event - * @param \Illuminate\Events\QueuedClosure|\Closure|string|array $callback + * @param \Illuminate\Events\QueuedClosure|class-string|array|callable $callback * @return void */ protected static function registerModelEvent($event, $callback) @@ -266,7 +266,7 @@ protected function filterModelEventResults($result) /** * Register a retrieved model event with the dispatcher. * - * @param \Illuminate\Events\QueuedClosure|\Closure|string|array $callback + * @param \Illuminate\Events\QueuedClosure|class-string|array|callable $callback * @return void */ public static function retrieved($callback) @@ -277,7 +277,7 @@ public static function retrieved($callback) /** * Register a saving model event with the dispatcher. * - * @param \Illuminate\Events\QueuedClosure|\Closure|string|array $callback + * @param \Illuminate\Events\QueuedClosure|class-string|array|callable $callback * @return void */ public static function saving($callback) @@ -288,7 +288,7 @@ public static function saving($callback) /** * Register a saved model event with the dispatcher. * - * @param \Illuminate\Events\QueuedClosure|\Closure|string|array $callback + * @param \Illuminate\Events\QueuedClosure|class-string|array|callable $callback * @return void */ public static function saved($callback) @@ -299,7 +299,7 @@ public static function saved($callback) /** * Register an updating model event with the dispatcher. * - * @param \Illuminate\Events\QueuedClosure|\Closure|string|array $callback + * @param \Illuminate\Events\QueuedClosure|class-string|array|callable $callback * @return void */ public static function updating($callback) @@ -310,7 +310,7 @@ public static function updating($callback) /** * Register an updated model event with the dispatcher. * - * @param \Illuminate\Events\QueuedClosure|\Closure|string|array $callback + * @param \Illuminate\Events\QueuedClosure|class-string|array|callable $callback * @return void */ public static function updated($callback) @@ -321,7 +321,7 @@ public static function updated($callback) /** * Register a creating model event with the dispatcher. * - * @param \Illuminate\Events\QueuedClosure|\Closure|string|array $callback + * @param \Illuminate\Events\QueuedClosure|class-string|array|callable $callback * @return void */ public static function creating($callback) @@ -332,7 +332,7 @@ public static function creating($callback) /** * Register a created model event with the dispatcher. * - * @param \Illuminate\Events\QueuedClosure|\Closure|string|array $callback + * @param \Illuminate\Events\QueuedClosure|class-string|array|callable $callback * @return void */ public static function created($callback) @@ -343,7 +343,7 @@ public static function created($callback) /** * Register a replicating model event with the dispatcher. * - * @param \Illuminate\Events\QueuedClosure|\Closure|string|array $callback + * @param \Illuminate\Events\QueuedClosure|class-string|array|callable $callback * @return void */ public static function replicating($callback) @@ -354,7 +354,7 @@ public static function replicating($callback) /** * Register a deleting model event with the dispatcher. * - * @param \Illuminate\Events\QueuedClosure|\Closure|string|array $callback + * @param \Illuminate\Events\QueuedClosure|class-string|array|callable $callback * @return void */ public static function deleting($callback) @@ -365,7 +365,7 @@ public static function deleting($callback) /** * Register a deleted model event with the dispatcher. * - * @param \Illuminate\Events\QueuedClosure|\Closure|string|array $callback + * @param \Illuminate\Events\QueuedClosure|class-string|array|callable $callback * @return void */ public static function deleted($callback) diff --git a/src/Illuminate/Database/Eloquent/SoftDeletes.php b/src/Illuminate/Database/Eloquent/SoftDeletes.php index c31e23e1766f..28febcb18bf4 100644 --- a/src/Illuminate/Database/Eloquent/SoftDeletes.php +++ b/src/Illuminate/Database/Eloquent/SoftDeletes.php @@ -210,7 +210,7 @@ public function trashed() /** * Register a "softDeleted" model event callback with the dispatcher. * - * @param \Illuminate\Events\QueuedClosure|\Closure|string $callback + * @param \Illuminate\Events\QueuedClosure|class-string|callable $callback * @return void */ public static function softDeleted($callback) @@ -221,7 +221,7 @@ public static function softDeleted($callback) /** * Register a "restoring" model event callback with the dispatcher. * - * @param \Illuminate\Events\QueuedClosure|\Closure|string $callback + * @param \Illuminate\Events\QueuedClosure|class-string|callable $callback * @return void */ public static function restoring($callback) @@ -232,7 +232,7 @@ public static function restoring($callback) /** * Register a "restored" model event callback with the dispatcher. * - * @param \Illuminate\Events\QueuedClosure|\Closure|string $callback + * @param \Illuminate\Events\QueuedClosure|class-string|callable $callback * @return void */ public static function restored($callback) @@ -243,7 +243,7 @@ public static function restored($callback) /** * Register a "forceDeleting" model event callback with the dispatcher. * - * @param \Illuminate\Events\QueuedClosure|\Closure|string $callback + * @param \Illuminate\Events\QueuedClosure|class-string|callable $callback * @return void */ public static function forceDeleting($callback) @@ -254,7 +254,7 @@ public static function forceDeleting($callback) /** * Register a "forceDeleted" model event callback with the dispatcher. * - * @param \Illuminate\Events\QueuedClosure|\Closure|string $callback + * @param \Illuminate\Events\QueuedClosure|class-string|callable $callback * @return void */ public static function forceDeleted($callback) diff --git a/src/Illuminate/Events/Dispatcher.php b/src/Illuminate/Events/Dispatcher.php index 30860a39d1bc..f4055c1cdba6 100755 --- a/src/Illuminate/Events/Dispatcher.php +++ b/src/Illuminate/Events/Dispatcher.php @@ -80,8 +80,8 @@ public function __construct(?ContainerContract $container = null) /** * Register an event listener with the dispatcher. * - * @param \Illuminate\Events\QueuedClosure|\Closure|string|array $events - * @param \Illuminate\Events\QueuedClosure|\Closure|string|array|null $listener + * @param \Illuminate\Events\QueuedClosure|string|class-string|array|callable $events + * @param \Illuminate\Events\QueuedClosure|class-string|array|callable|null $listener * @return void */ public function listen($events, $listener = null) diff --git a/src/Illuminate/Support/Facades/Event.php b/src/Illuminate/Support/Facades/Event.php index f6e17b695397..99bb7d978763 100755 --- a/src/Illuminate/Support/Facades/Event.php +++ b/src/Illuminate/Support/Facades/Event.php @@ -6,7 +6,7 @@ use Illuminate\Support\Testing\Fakes\EventFake; /** - * @method static void listen(\Illuminate\Events\QueuedClosure|\Closure|string|array $events, \Illuminate\Events\QueuedClosure|\Closure|string|array|null $listener = null) + * @method static void listen(\Illuminate\Events\QueuedClosure|string|class-string|array|callable $events, \Illuminate\Events\QueuedClosure|class-string|array|callable|null $listener = null) * @method static bool hasListeners(string $eventName) * @method static bool hasWildcardListeners(string $eventName) * @method static void push(string $event, object|array $payload = []) From 19b8ed48a01a97bd7afc9efe953e6b774e04ce82 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Mon, 25 Nov 2024 16:37:58 -0600 Subject: [PATCH 2/3] formatting --- .../Database/Eloquent/Concerns/HasEvents.php | 22 +++++++++---------- .../Database/Eloquent/SoftDeletes.php | 10 ++++----- src/Illuminate/Events/Dispatcher.php | 4 ++-- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/Illuminate/Database/Eloquent/Concerns/HasEvents.php b/src/Illuminate/Database/Eloquent/Concerns/HasEvents.php index 47919939b6dc..2bd6c6057238 100644 --- a/src/Illuminate/Database/Eloquent/Concerns/HasEvents.php +++ b/src/Illuminate/Database/Eloquent/Concerns/HasEvents.php @@ -183,7 +183,7 @@ public function removeObservableEvents($observables) * Register a model event with the dispatcher. * * @param string $event - * @param \Illuminate\Events\QueuedClosure|class-string|array|callable $callback + * @param \Illuminate\Events\QueuedClosure|callable|array|class-string $callback * @return void */ protected static function registerModelEvent($event, $callback) @@ -266,7 +266,7 @@ protected function filterModelEventResults($result) /** * Register a retrieved model event with the dispatcher. * - * @param \Illuminate\Events\QueuedClosure|class-string|array|callable $callback + * @param \Illuminate\Events\QueuedClosure|callable|array|class-string $callback * @return void */ public static function retrieved($callback) @@ -277,7 +277,7 @@ public static function retrieved($callback) /** * Register a saving model event with the dispatcher. * - * @param \Illuminate\Events\QueuedClosure|class-string|array|callable $callback + * @param \Illuminate\Events\QueuedClosure|callable|array|class-string $callback * @return void */ public static function saving($callback) @@ -288,7 +288,7 @@ public static function saving($callback) /** * Register a saved model event with the dispatcher. * - * @param \Illuminate\Events\QueuedClosure|class-string|array|callable $callback + * @param \Illuminate\Events\QueuedClosure|callable|array|class-string $callback * @return void */ public static function saved($callback) @@ -299,7 +299,7 @@ public static function saved($callback) /** * Register an updating model event with the dispatcher. * - * @param \Illuminate\Events\QueuedClosure|class-string|array|callable $callback + * @param \Illuminate\Events\QueuedClosure|callable|array|class-string $callback * @return void */ public static function updating($callback) @@ -310,7 +310,7 @@ public static function updating($callback) /** * Register an updated model event with the dispatcher. * - * @param \Illuminate\Events\QueuedClosure|class-string|array|callable $callback + * @param \Illuminate\Events\QueuedClosure|callable|array|class-string $callback * @return void */ public static function updated($callback) @@ -321,7 +321,7 @@ public static function updated($callback) /** * Register a creating model event with the dispatcher. * - * @param \Illuminate\Events\QueuedClosure|class-string|array|callable $callback + * @param \Illuminate\Events\QueuedClosure|callable|array|class-string $callback * @return void */ public static function creating($callback) @@ -332,7 +332,7 @@ public static function creating($callback) /** * Register a created model event with the dispatcher. * - * @param \Illuminate\Events\QueuedClosure|class-string|array|callable $callback + * @param \Illuminate\Events\QueuedClosure|callable|array|class-string $callback * @return void */ public static function created($callback) @@ -343,7 +343,7 @@ public static function created($callback) /** * Register a replicating model event with the dispatcher. * - * @param \Illuminate\Events\QueuedClosure|class-string|array|callable $callback + * @param \Illuminate\Events\QueuedClosure|callable|array|class-string $callback * @return void */ public static function replicating($callback) @@ -354,7 +354,7 @@ public static function replicating($callback) /** * Register a deleting model event with the dispatcher. * - * @param \Illuminate\Events\QueuedClosure|class-string|array|callable $callback + * @param \Illuminate\Events\QueuedClosure|callable|array|class-string $callback * @return void */ public static function deleting($callback) @@ -365,7 +365,7 @@ public static function deleting($callback) /** * Register a deleted model event with the dispatcher. * - * @param \Illuminate\Events\QueuedClosure|class-string|array|callable $callback + * @param \Illuminate\Events\QueuedClosure|callable|array|class-string $callback * @return void */ public static function deleted($callback) diff --git a/src/Illuminate/Database/Eloquent/SoftDeletes.php b/src/Illuminate/Database/Eloquent/SoftDeletes.php index 28febcb18bf4..a20f43a4e1bd 100644 --- a/src/Illuminate/Database/Eloquent/SoftDeletes.php +++ b/src/Illuminate/Database/Eloquent/SoftDeletes.php @@ -210,7 +210,7 @@ public function trashed() /** * Register a "softDeleted" model event callback with the dispatcher. * - * @param \Illuminate\Events\QueuedClosure|class-string|callable $callback + * @param \Illuminate\Events\QueuedClosure|callable|class-string $callback * @return void */ public static function softDeleted($callback) @@ -221,7 +221,7 @@ public static function softDeleted($callback) /** * Register a "restoring" model event callback with the dispatcher. * - * @param \Illuminate\Events\QueuedClosure|class-string|callable $callback + * @param \Illuminate\Events\QueuedClosure|callable|class-string $callback * @return void */ public static function restoring($callback) @@ -232,7 +232,7 @@ public static function restoring($callback) /** * Register a "restored" model event callback with the dispatcher. * - * @param \Illuminate\Events\QueuedClosure|class-string|callable $callback + * @param \Illuminate\Events\QueuedClosure|callable|class-string $callback * @return void */ public static function restored($callback) @@ -243,7 +243,7 @@ public static function restored($callback) /** * Register a "forceDeleting" model event callback with the dispatcher. * - * @param \Illuminate\Events\QueuedClosure|class-string|callable $callback + * @param \Illuminate\Events\QueuedClosure|callable|class-string $callback * @return void */ public static function forceDeleting($callback) @@ -254,7 +254,7 @@ public static function forceDeleting($callback) /** * Register a "forceDeleted" model event callback with the dispatcher. * - * @param \Illuminate\Events\QueuedClosure|class-string|callable $callback + * @param \Illuminate\Events\QueuedClosure|callable|class-string $callback * @return void */ public static function forceDeleted($callback) diff --git a/src/Illuminate/Events/Dispatcher.php b/src/Illuminate/Events/Dispatcher.php index f4055c1cdba6..f94d30bcfd19 100755 --- a/src/Illuminate/Events/Dispatcher.php +++ b/src/Illuminate/Events/Dispatcher.php @@ -80,8 +80,8 @@ public function __construct(?ContainerContract $container = null) /** * Register an event listener with the dispatcher. * - * @param \Illuminate\Events\QueuedClosure|string|class-string|array|callable $events - * @param \Illuminate\Events\QueuedClosure|class-string|array|callable|null $listener + * @param \Illuminate\Events\QueuedClosure|callable|array|class-string|string $events + * @param \Illuminate\Events\QueuedClosure|callable|array|class-string|null $listener * @return void */ public function listen($events, $listener = null) From e011ea2b1514f6cee9e9cd8c523ef14962ca02d4 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Mon, 25 Nov 2024 16:41:40 -0600 Subject: [PATCH 3/3] formatting --- src/Illuminate/Support/Facades/Event.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Support/Facades/Event.php b/src/Illuminate/Support/Facades/Event.php index 99bb7d978763..bfaff6eca997 100755 --- a/src/Illuminate/Support/Facades/Event.php +++ b/src/Illuminate/Support/Facades/Event.php @@ -6,7 +6,7 @@ use Illuminate\Support\Testing\Fakes\EventFake; /** - * @method static void listen(\Illuminate\Events\QueuedClosure|string|class-string|array|callable $events, \Illuminate\Events\QueuedClosure|class-string|array|callable|null $listener = null) + * @method static void listen(\Illuminate\Events\QueuedClosure|callable|array|class-string|string $events, \Illuminate\Events\QueuedClosure|callable|array|class-string|null $listener = null) * @method static bool hasListeners(string $eventName) * @method static bool hasWildcardListeners(string $eventName) * @method static void push(string $event, object|array $payload = [])