diff --git a/phpstan-baseline.php b/phpstan-baseline.php index 6d22593ffcab..16da2877e0a3 100644 --- a/phpstan-baseline.php +++ b/phpstan-baseline.php @@ -716,76 +716,6 @@ 'count' => 1, 'path' => __DIR__ . '/system/Database/Seeder.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Debug\\\\Exceptions\\:\\:exceptionHandler\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Debug/Exceptions.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Debug\\\\Exceptions\\:\\:initialize\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Debug/Exceptions.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Debug\\\\Exceptions\\:\\:render\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Debug/Exceptions.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Debug\\\\Exceptions\\:\\:shutdownHandler\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Debug/Exceptions.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Debug\\\\Iterator\\:\\:add\\(\\) has parameter \\$closure with no signature specified for Closure\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Debug/Iterator.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Debug\\\\Timer\\:\\:record\\(\\) has parameter \\$callable with no signature specified for callable\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Debug/Timer.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Debug\\\\Toolbar\\:\\:prepare\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Debug/Toolbar.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Debug\\\\Toolbar\\:\\:respond\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Debug/Toolbar.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Debug\\\\Toolbar\\\\Collectors\\\\BaseCollector\\:\\:getBadgeValue\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Debug/Toolbar/Collectors/BaseCollector.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Debug\\\\Toolbar\\\\Collectors\\\\BaseCollector\\:\\:getVarData\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Debug/Toolbar/Collectors/BaseCollector.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Debug\\\\Toolbar\\\\Collectors\\\\Database\\:\\:collect\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Debug/Toolbar/Collectors/Database.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Debug\\\\Toolbar\\\\Collectors\\\\Database\\:\\:getConnections\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Debug/Toolbar/Collectors/Database.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Debug\\\\Toolbar\\\\Collectors\\\\History\\:\\:setFiles\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Debug/Toolbar/Collectors/History.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Debug\\\\Toolbar\\\\Collectors\\\\Logs\\:\\:collectLogs\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Debug/Toolbar/Collectors/Logs.php', -]; $ignoreErrors[] = [ 'message' => '#^Property CodeIgniter\\\\Log\\\\Logger\\:\\:\\$logCache \\(array\\) on left side of \\?\\? is not nullable\\.$#', 'count' => 1, diff --git a/system/Debug/Exceptions.php b/system/Debug/Exceptions.php index 6df81c16d5a5..77f5736d28a3 100644 --- a/system/Debug/Exceptions.php +++ b/system/Debug/Exceptions.php @@ -98,6 +98,8 @@ public function __construct(ExceptionsConfig $config, $request, ResponseInterfac * handling of our application. * * @codeCoverageIgnore + * + * @return void */ public function initialize() { @@ -112,6 +114,9 @@ public function initialize() * and fire an event that allows custom actions to be taken at this point. * * @codeCoverageIgnore + * + * @return void + * @phpstan-return never|void */ public function exceptionHandler(Throwable $exception) { @@ -189,6 +194,9 @@ public function errorHandler(int $severity, string $message, ?string $file = nul * need to be caught and handle them. * * @codeCoverageIgnore + * + * @return void + * @phpstan-return never|void */ public function shutdownHandler() { @@ -243,6 +251,9 @@ protected function determineView(Throwable $exception, string $templatePath): st /** * Given an exception and status code will display the error to the client. + * + * @return void + * @phpstan-return never|void */ protected function render(Throwable $exception, int $statusCode) { diff --git a/system/Debug/Iterator.php b/system/Debug/Iterator.php index 62343745b17b..f54335b6dd70 100644 --- a/system/Debug/Iterator.php +++ b/system/Debug/Iterator.php @@ -38,6 +38,8 @@ class Iterator * Tests are simply closures that the user can define any sequence of * things to happen during the test. * + * @phpstan-param Closure(): mixed $closure + * * @return $this */ public function add(string $name, Closure $closure) diff --git a/system/Debug/Timer.php b/system/Debug/Timer.php index 68a9b7898c64..216b10bab758 100644 --- a/system/Debug/Timer.php +++ b/system/Debug/Timer.php @@ -131,8 +131,8 @@ public function has(string $name): bool * Executes callable and measures its time. * Returns its return value if any. * - * @param string $name The name of the timer - * @param callable $callable callable to be executed + * @param string $name The name of the timer + * @phpstan-param callable(): mixed $callable callable to be executed * * @return array|bool|float|int|object|resource|string|null */ diff --git a/system/Debug/Toolbar.php b/system/Debug/Toolbar.php index f00ad09bd122..d20125b9b5bd 100644 --- a/system/Debug/Toolbar.php +++ b/system/Debug/Toolbar.php @@ -348,6 +348,8 @@ protected function roundTo(float $number, int $increments = 5): float * * @param RequestInterface $request * @param ResponseInterface $response + * + * @return void */ public function prepare(?RequestInterface $request = null, ?ResponseInterface $response = null) { @@ -434,6 +436,9 @@ public function prepare(?RequestInterface $request = null, ?ResponseInterface $r * Inject debug toolbar into the response. * * @codeCoverageIgnore + * + * @return void + * @phpstan-return never|void */ public function respond() { diff --git a/system/Debug/Toolbar/Collectors/BaseCollector.php b/system/Debug/Toolbar/Collectors/BaseCollector.php index e8aaad9ba115..4704fcdcaaeb 100644 --- a/system/Debug/Toolbar/Collectors/BaseCollector.php +++ b/system/Debug/Toolbar/Collectors/BaseCollector.php @@ -137,6 +137,8 @@ public function hasVarData(): bool * 'bar' => 'baz' * ], * ]; + * + * @return array|null */ public function getVarData() { @@ -183,6 +185,8 @@ public function cleanPath(string $file): string /** * Gets the "badge" value for the button. + * + * @return int|null */ public function getBadgeValue() { diff --git a/system/Debug/Toolbar/Collectors/Database.php b/system/Debug/Toolbar/Collectors/Database.php index 5cb285b95554..f487af59cef4 100644 --- a/system/Debug/Toolbar/Collectors/Database.php +++ b/system/Debug/Toolbar/Collectors/Database.php @@ -76,6 +76,9 @@ public function __construct() * data. * * @internal + * + * @return void + * @phpstan-return never|void */ public static function collect(Query $query) { @@ -247,7 +250,7 @@ public function icon(): string /** * Gets the connections from the database config */ - private function getConnections() + private function getConnections(): void { $this->connections = \Config\Database::getConnections(); } diff --git a/system/Debug/Toolbar/Collectors/History.php b/system/Debug/Toolbar/Collectors/History.php index afc68ee85f2e..9645bd91863a 100644 --- a/system/Debug/Toolbar/Collectors/History.php +++ b/system/Debug/Toolbar/Collectors/History.php @@ -60,6 +60,8 @@ class History extends BaseCollector * * @param string $current Current history time * @param int $limit Max history files + * + * @return void */ public function setFiles(string $current, int $limit = 20) { diff --git a/system/Debug/Toolbar/Collectors/Logs.php b/system/Debug/Toolbar/Collectors/Logs.php index 42d7307ab9d1..d656ca9bcefb 100644 --- a/system/Debug/Toolbar/Collectors/Logs.php +++ b/system/Debug/Toolbar/Collectors/Logs.php @@ -81,6 +81,8 @@ public function icon(): string /** * Ensures the data has been collected. + * + * @return array */ protected function collectLogs() {