Skip to content

Commit 5fb61b1

Browse files
committed
refactor: fix phpstan and regenerate baseline
1 parent a17c9be commit 5fb61b1

17 files changed

+41
-39
lines changed

phpstan-baseline.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7453,12 +7453,6 @@
74537453
'count' => 1,
74547454
'path' => __DIR__ . '/system/Images/Handlers/BaseHandler.php',
74557455
];
7456-
$ignoreErrors[] = [
7457-
// identifier: return.missing
7458-
'message' => '#^Method CodeIgniter\\\\Images\\\\Handlers\\\\BaseHandler\\:\\:__call\\(\\) should return mixed but return statement is missing\\.$#',
7459-
'count' => 1,
7460-
'path' => __DIR__ . '/system/Images/Handlers/BaseHandler.php',
7461-
];
74627456
$ignoreErrors[] = [
74637457
// identifier: missingType.iterableValue
74647458
'message' => '#^Method CodeIgniter\\\\Images\\\\Handlers\\\\BaseHandler\\:\\:_text\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#',
@@ -7609,12 +7603,6 @@
76097603
'count' => 1,
76107604
'path' => __DIR__ . '/system/Language/Language.php',
76117605
];
7612-
$ignoreErrors[] = [
7613-
// identifier: missingType.iterableValue
7614-
'message' => '#^Method CodeIgniter\\\\Language\\\\Language\\:\\:load\\(\\) return type has no value type specified in iterable type array\\.$#',
7615-
'count' => 1,
7616-
'path' => __DIR__ . '/system/Language/Language.php',
7617-
];
76187606
$ignoreErrors[] = [
76197607
// identifier: missingType.iterableValue
76207608
'message' => '#^Method CodeIgniter\\\\Language\\\\Language\\:\\:parseLine\\(\\) return type has no value type specified in iterable type array\\.$#',

system/Filters/CSRF.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,9 @@ public function before(RequestInterface $request, $arguments = null)
6565
* We don't have anything to do here.
6666
*
6767
* @param list<string>|null $arguments
68-
*
69-
* @return void
7068
*/
7169
public function after(RequestInterface $request, ResponseInterface $response, $arguments = null)
7270
{
71+
return null;
7372
}
7473
}

system/Filters/DebugToolbar.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class DebugToolbar implements FilterInterface
3030
*/
3131
public function before(RequestInterface $request, $arguments = null)
3232
{
33+
return null;
3334
}
3435

3536
/**
@@ -41,5 +42,7 @@ public function before(RequestInterface $request, $arguments = null)
4142
public function after(RequestInterface $request, ResponseInterface $response, $arguments = null)
4243
{
4344
service('toolbar')->prepare($request, $response);
45+
46+
return $response;
4447
}
4548
}

system/Filters/FilterInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ interface FilterInterface
3333
*
3434
* @param list<string>|null $arguments
3535
*
36-
* @return RequestInterface|ResponseInterface|string|void
36+
* @return RequestInterface|ResponseInterface|string|null
3737
*/
3838
public function before(RequestInterface $request, $arguments = null);
3939

@@ -45,7 +45,7 @@ public function before(RequestInterface $request, $arguments = null);
4545
*
4646
* @param list<string>|null $arguments
4747
*
48-
* @return ResponseInterface|void
48+
* @return ResponseInterface|null
4949
*/
5050
public function after(RequestInterface $request, ResponseInterface $response, $arguments = null);
5151
}

system/Filters/ForceHTTPS.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,9 @@ public function before(RequestInterface $request, $arguments = null)
5757
* We don't have anything to do here.
5858
*
5959
* @param array|null $arguments
60-
*
61-
* @return void
6260
*/
6361
public function after(RequestInterface $request, ResponseInterface $response, $arguments = null)
6462
{
63+
return null;
6564
}
6665
}

system/Filters/Honeypot.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,14 @@ class Honeypot implements FilterInterface
3636
public function before(RequestInterface $request, $arguments = null)
3737
{
3838
if (! $request instanceof IncomingRequest) {
39-
return;
39+
return null;
4040
}
4141

4242
if (service('honeypot')->hasContent($request)) {
4343
throw HoneypotException::isBot();
4444
}
45+
46+
return null;
4547
}
4648

4749
/**
@@ -52,5 +54,7 @@ public function before(RequestInterface $request, $arguments = null)
5254
public function after(RequestInterface $request, ResponseInterface $response, $arguments = null)
5355
{
5456
service('honeypot')->attachHoneypot($response);
57+
58+
return $response;
5559
}
5660
}

system/Filters/InvalidChars.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,11 @@ class InvalidChars implements FilterInterface
4848
* Check invalid characters.
4949
*
5050
* @param list<string>|null $arguments
51-
*
52-
* @return void
5351
*/
5452
public function before(RequestInterface $request, $arguments = null)
5553
{
5654
if (! $request instanceof IncomingRequest) {
57-
return;
55+
return null;
5856
}
5957

6058
$data = [
@@ -69,17 +67,18 @@ public function before(RequestInterface $request, $arguments = null)
6967
$this->checkEncoding($values);
7068
$this->checkControl($values);
7169
}
70+
71+
return null;
7272
}
7373

7474
/**
7575
* We don't have anything to do here.
7676
*
7777
* @param list<string>|null $arguments
78-
*
79-
* @return void
8078
*/
8179
public function after(RequestInterface $request, ResponseInterface $response, $arguments = null)
8280
{
81+
return null;
8382
}
8483

8584
/**

system/Filters/PageCache.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,6 @@ public function before(RequestInterface $request, $arguments = null)
5959
* Cache the page.
6060
*
6161
* @param array|null $arguments
62-
*
63-
* @return void
6462
*/
6563
public function after(RequestInterface $request, ResponseInterface $response, $arguments = null)
6664
{
@@ -74,6 +72,9 @@ public function after(RequestInterface $request, ResponseInterface $response, $a
7472
// so that we can have live speed updates along the way.
7573
// Must be run after filters to preserve the Response headers.
7674
$this->pageCache->make($request, $response);
75+
return $response;
7776
}
77+
78+
return null;
7879
}
7980
}

system/Filters/PerformanceMetrics.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,13 @@ class PerformanceMetrics implements FilterInterface
2828
*/
2929
public function before(RequestInterface $request, $arguments = null)
3030
{
31+
return null;
3132
}
3233

3334
/**
3435
* Replaces the performance metrics.
3536
*
3637
* @param array|null $arguments
37-
*
38-
* @return void
3938
*/
4039
public function after(RequestInterface $request, ResponseInterface $response, $arguments = null)
4140
{
@@ -57,6 +56,10 @@ public function after(RequestInterface $request, ResponseInterface $response, $a
5756
);
5857

5958
$response->setBody($output);
59+
60+
return $response;
6061
}
62+
63+
return null;
6164
}
6265
}

system/Filters/SecureHeaders.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,24 +52,23 @@ class SecureHeaders implements FilterInterface
5252
* We don't have anything to do here.
5353
*
5454
* @param list<string>|null $arguments
55-
*
56-
* @return void
5755
*/
5856
public function before(RequestInterface $request, $arguments = null)
5957
{
58+
return null;
6059
}
6160

6261
/**
6362
* Add security headers.
6463
*
6564
* @param list<string>|null $arguments
66-
*
67-
* @return void
6865
*/
6966
public function after(RequestInterface $request, ResponseInterface $response, $arguments = null)
7067
{
7168
foreach ($this->headers as $header => $value) {
7269
$response->setHeader($header, $value);
7370
}
71+
72+
return $response;
7473
}
7574
}

0 commit comments

Comments
 (0)