From 35b1aa9fe1ca3435596a4513d2d87a83ff52a9a7 Mon Sep 17 00:00:00 2001 From: ping-yee <611077101@mail.nknu.edu.tw> Date: Wed, 2 Aug 2023 19:02:27 +0800 Subject: [PATCH] Dev: remove the evnet ignore errors in phpstan-baseline.php --- phpstan-baseline.php | 25 ------------------------- system/Events/Events.php | 10 ++++++++++ 2 files changed, 10 insertions(+), 25 deletions(-) diff --git a/phpstan-baseline.php b/phpstan-baseline.php index 9665737db821..2862ecaed635 100644 --- a/phpstan-baseline.php +++ b/phpstan-baseline.php @@ -901,41 +901,16 @@ 'count' => 1, 'path' => __DIR__ . '/system/Entity/Entity.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Events\\\\Events\\:\\:initialize\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Events/Events.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Events\\\\Events\\:\\:on\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Events/Events.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\Events\\\\Events\\:\\:on\\(\\) has parameter \\$callback with no signature specified for callable\\.$#', 'count' => 1, 'path' => __DIR__ . '/system/Events/Events.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Events\\\\Events\\:\\:removeAllListeners\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Events/Events.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\Events\\\\Events\\:\\:removeListener\\(\\) has parameter \\$listener with no signature specified for callable\\.$#', 'count' => 1, 'path' => __DIR__ . '/system/Events/Events.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Events\\\\Events\\:\\:setFiles\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Events/Events.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Events\\\\Events\\:\\:simulate\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Events/Events.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\Exceptions\\\\CastException\\:\\:forInvalidJsonFormatException\\(\\) has no return type specified\\.$#', 'count' => 1, diff --git a/system/Events/Events.php b/system/Events/Events.php index f90af36c2e57..ff8c92822e52 100644 --- a/system/Events/Events.php +++ b/system/Events/Events.php @@ -63,6 +63,8 @@ class Events /** * Ensures that we have a events file ready. + * + * @return void */ public static function initialize() { @@ -108,6 +110,8 @@ public static function initialize() * @param string $eventName * @param callable $callback * @param int $priority + * + * @return void */ public static function on($eventName, $callback, $priority = self::PRIORITY_NORMAL) { @@ -222,6 +226,8 @@ public static function removeListener($eventName, callable $listener): bool * removed, otherwise all listeners for all events are removed. * * @param string|null $eventName + * + * @return void */ public static function removeAllListeners($eventName = null) { @@ -234,6 +240,8 @@ public static function removeAllListeners($eventName = null) /** * Sets the path to the file that routes are read from. + * + * @return void */ public static function setFiles(array $files) { @@ -254,6 +262,8 @@ public static function getFiles() * Turns simulation on or off. When on, events will not be triggered, * simply logged. Useful during testing when you don't actually want * the tests to run. + * + * @return void */ public static function simulate(bool $choice = true) {