From f547d05e6094309eb62d44f9ffd6e95012ccbcce Mon Sep 17 00:00:00 2001 From: Denny Septian Panggabean Date: Thu, 17 Aug 2023 09:00:06 +0700 Subject: [PATCH 1/2] docs: PHPStan Codeigniter no type specified --- phpstan-baseline.php | 75 ------------------------------------------ system/CodeIgniter.php | 28 ++++++++++++++++ 2 files changed, 28 insertions(+), 75 deletions(-) diff --git a/phpstan-baseline.php b/phpstan-baseline.php index 457f762607af..d2f7e722c2dd 100644 --- a/phpstan-baseline.php +++ b/phpstan-baseline.php @@ -81,76 +81,6 @@ 'count' => 1, 'path' => __DIR__ . '/system/CodeIgniter.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\CodeIgniter\\:\\:bootstrapEnvironment\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/CodeIgniter.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\CodeIgniter\\:\\:cache\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/CodeIgniter.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\CodeIgniter\\:\\:callExit\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/CodeIgniter.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\CodeIgniter\\:\\:detectEnvironment\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/CodeIgniter.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\CodeIgniter\\:\\:forceSecureAccess\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/CodeIgniter.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\CodeIgniter\\:\\:gatherOutput\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/CodeIgniter.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\CodeIgniter\\:\\:getRequestObject\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/CodeIgniter.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\CodeIgniter\\:\\:getResponseObject\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/CodeIgniter.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\CodeIgniter\\:\\:initialize\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/CodeIgniter.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\CodeIgniter\\:\\:initializeKint\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/CodeIgniter.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\CodeIgniter\\:\\:resolvePlatformExtensions\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/CodeIgniter.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\CodeIgniter\\:\\:spoofRequestMethod\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/CodeIgniter.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\CodeIgniter\\:\\:startBenchmark\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/CodeIgniter.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\CodeIgniter\\:\\:storePreviousURL\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/CodeIgniter.php', -]; $ignoreErrors[] = [ 'message' => '#^Property CodeIgniter\\\\CodeIgniter\\:\\:\\$controller type has no signature specified for Closure\\.$#', 'count' => 1, @@ -1576,11 +1506,6 @@ 'count' => 1, 'path' => __DIR__ . '/system/Test/Mock/MockCache.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Test\\\\Mock\\\\MockCodeIgniter\\:\\:callExit\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Test/Mock/MockCodeIgniter.php', -]; $ignoreErrors[] = [ 'message' => '#^Cannot access property \\$insert_id on object\\|resource\\|false\\.$#', 'count' => 1, diff --git a/system/CodeIgniter.php b/system/CodeIgniter.php index af3a06f1731a..603db1479ee7 100644 --- a/system/CodeIgniter.php +++ b/system/CodeIgniter.php @@ -176,6 +176,8 @@ public function __construct(App $config) /** * Handles some basic app and environment setup. + * + * @return void */ public function initialize() { @@ -203,6 +205,8 @@ public function initialize() /** * Checks system for missing required PHP extensions. * + * @return void + * * @throws FrameworkException * * @codeCoverageIgnore @@ -230,6 +234,8 @@ protected function resolvePlatformExtensions() /** * Initializes Kint + * + * @return void */ protected function initializeKint() { @@ -569,6 +575,8 @@ protected function handleRequest(?RouteCollectionInterface $routes, Cache $cache * testing * production * + * @return void + * * @codeCoverageIgnore */ protected function detectEnvironment() @@ -584,6 +592,8 @@ protected function detectEnvironment() * * If no boot file exists, we shouldn't continue because something * is wrong. At the very least, they should have error reporting setup. + * + * @return void */ protected function bootstrapEnvironment() { @@ -604,6 +614,8 @@ protected function bootstrapEnvironment() * * The timer is used to display total script execution both in the * debug toolbar, and potentially on the displayed page. + * + * @return void */ protected function startBenchmark() { @@ -631,6 +643,8 @@ public function setRequest(Request $request) /** * Get our Request object, (either IncomingRequest or CLIRequest). + * + * @return void */ protected function getRequestObject() { @@ -650,6 +664,8 @@ protected function getRequestObject() /** * Get our Response object, and set some default values, including * the HTTP protocol version and a default successful response. + * + * @return void */ protected function getResponseObject() { @@ -672,6 +688,8 @@ protected function getResponseObject() * * @param int $duration How long the Strict Transport Security * should be enforced for this URL. + * + * @return void */ protected function forceSecureAccess($duration = 31_536_000) { @@ -722,6 +740,8 @@ public function displayCache(Cache $config) /** * Tells the app that the final output should be cached. + * + * @return void */ public static function cache(int $time) { @@ -1000,6 +1020,8 @@ protected function display404errors(PageNotFoundException $e) * @param Cache|null $cacheConfig Deprecated. No longer used. * @param ResponseInterface|string|null $returned * + * @return void + * * @deprecated $cacheConfig is deprecated. */ protected function gatherOutput(?Cache $cacheConfig = null, $returned = null) @@ -1049,6 +1071,8 @@ protected function gatherOutput(?Cache $cacheConfig = null, $returned = null) * This helps provider safer, more reliable previous_url() detection. * * @param string|URI $uri + * + * @return void */ public function storePreviousURL($uri) { @@ -1090,6 +1114,8 @@ public function storePreviousURL($uri) /** * Modifies the Request Object to use a different method if a POST * variable called _method is found. + * + * @return void */ public function spoofRequestMethod() { @@ -1129,6 +1155,8 @@ protected function sendResponse() * without actually stopping script execution. * * @param int $code + * + * @return void */ protected function callExit($code) { From 369928f33a5dfe4cda0538864e421c18d04c0090 Mon Sep 17 00:00:00 2001 From: Denny Septian Panggabean <97607754+ddevsr@users.noreply.github.com> Date: Thu, 17 Aug 2023 09:47:40 +0700 Subject: [PATCH 2/2] Update system/CodeIgniter.php Co-authored-by: kenjis --- system/CodeIgniter.php | 1 + 1 file changed, 1 insertion(+) diff --git a/system/CodeIgniter.php b/system/CodeIgniter.php index 603db1479ee7..b6b0f9138212 100644 --- a/system/CodeIgniter.php +++ b/system/CodeIgniter.php @@ -1157,6 +1157,7 @@ protected function sendResponse() * @param int $code * * @return void + * @phpstan-return never */ protected function callExit($code) {