diff --git a/phpstan-baseline.php b/phpstan-baseline.php index a7fd4cba69c0..9ed028147f1d 100644 --- a/phpstan-baseline.php +++ b/phpstan-baseline.php @@ -1246,51 +1246,11 @@ 'count' => 1, 'path' => __DIR__ . '/system/HTTP/UserAgent.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Function delete_cookie\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Helpers/cookie_helper.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Function set_cookie\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Helpers/cookie_helper.php', -]; $ignoreErrors[] = [ 'message' => '#^Right side of && is always true\\.$#', 'count' => 1, 'path' => __DIR__ . '/system/Helpers/filesystem_helper.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Function d\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Helpers/kint_helper.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Function d\\(\\) has parameter \\$vars with no type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Helpers/kint_helper.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Function dd\\(\\) has no return type specified\\.$#', - 'count' => 2, - 'path' => __DIR__ . '/system/Helpers/kint_helper.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Function dd\\(\\) has parameter \\$vars with no type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Helpers/kint_helper.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Function trace\\(\\) has no return type specified\\.$#', - 'count' => 2, - 'path' => __DIR__ . '/system/Helpers/kint_helper.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Function mock\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Helpers/test_helper.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\Honeypot\\\\Exceptions\\\\HoneypotException\\:\\:forNoHiddenValue\\(\\) has no return type specified\\.$#', 'count' => 1, diff --git a/system/Helpers/cookie_helper.php b/system/Helpers/cookie_helper.php index 9fc004c28b9a..379481b45376 100755 --- a/system/Helpers/cookie_helper.php +++ b/system/Helpers/cookie_helper.php @@ -34,6 +34,8 @@ * @param bool|null $httpOnly True makes the cookie accessible via http(s) only (no javascript) * @param string|null $sameSite The cookie SameSite value * + * @return void + * * @see \CodeIgniter\HTTP\Response::setCookie() */ function set_cookie( @@ -91,6 +93,8 @@ function get_cookie($index, bool $xssClean = false, ?string $prefix = '') * @param string $path the cookie path * @param string $prefix the cookie prefix * + * @return void + * * @see \CodeIgniter\HTTP\Response::deleteCookie() */ function delete_cookie($name, string $domain = '', string $path = '/', string $prefix = '') diff --git a/system/Helpers/kint_helper.php b/system/Helpers/kint_helper.php index 10c4f34e938d..eaa2e947bc96 100644 --- a/system/Helpers/kint_helper.php +++ b/system/Helpers/kint_helper.php @@ -16,7 +16,9 @@ /** * Prints a Kint debug report and exits. * - * @param array ...$vars + * @param array $vars + * + * @phpstan-return never * * @codeCoverageIgnore Can't be tested ... exits */ @@ -31,6 +33,13 @@ function dd(...$vars) } } else { // In case that Kint is not loaded. + /** + * dd function + * + * @param array $vars + * + * @return int + */ function dd(...$vars) { return 0; @@ -40,6 +49,13 @@ function dd(...$vars) if (! function_exists('d') && ! class_exists(Kint::class)) { // In case that Kint is not loaded. + /** + * d function + * + * @param array $vars + * + * @return int + */ function d(...$vars) { return 0; @@ -51,6 +67,11 @@ function d(...$vars) /** * Provides a backtrace to the current execution point, from Kint. */ + /** + * trace function + * + * @return void + */ function trace() { Kint::$aliases[] = 'trace'; @@ -58,6 +79,11 @@ function trace() } } else { // In case that Kint is not loaded. + /** + * trace function + * + * @return int + */ function trace() { return 0; diff --git a/system/Helpers/test_helper.php b/system/Helpers/test_helper.php index fe6b06794ccd..809a7aabe71b 100644 --- a/system/Helpers/test_helper.php +++ b/system/Helpers/test_helper.php @@ -47,6 +47,8 @@ function fake($model, ?array $overrides = null, $persist = true) * Used within our test suite to mock certain system tools. * * @param string $className Fully qualified class name + * + * @return object */ function mock(string $className) {