Skip to content

Commit 76b1e35

Browse files
authored
Merge pull request #7801 from kai890707/20230808-debug-phpstan
Fix: Repair conflicts and emove the `Debug` ignore errors.
2 parents fbb9c4d + eae9081 commit 76b1e35

9 files changed

Lines changed: 32 additions & 73 deletions

File tree

phpstan-baseline.php

Lines changed: 0 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -696,76 +696,6 @@
696696
'count' => 1,
697697
'path' => __DIR__ . '/system/Database/Seeder.php',
698698
];
699-
$ignoreErrors[] = [
700-
'message' => '#^Method CodeIgniter\\\\Debug\\\\Exceptions\\:\\:exceptionHandler\\(\\) has no return type specified\\.$#',
701-
'count' => 1,
702-
'path' => __DIR__ . '/system/Debug/Exceptions.php',
703-
];
704-
$ignoreErrors[] = [
705-
'message' => '#^Method CodeIgniter\\\\Debug\\\\Exceptions\\:\\:initialize\\(\\) has no return type specified\\.$#',
706-
'count' => 1,
707-
'path' => __DIR__ . '/system/Debug/Exceptions.php',
708-
];
709-
$ignoreErrors[] = [
710-
'message' => '#^Method CodeIgniter\\\\Debug\\\\Exceptions\\:\\:render\\(\\) has no return type specified\\.$#',
711-
'count' => 1,
712-
'path' => __DIR__ . '/system/Debug/Exceptions.php',
713-
];
714-
$ignoreErrors[] = [
715-
'message' => '#^Method CodeIgniter\\\\Debug\\\\Exceptions\\:\\:shutdownHandler\\(\\) has no return type specified\\.$#',
716-
'count' => 1,
717-
'path' => __DIR__ . '/system/Debug/Exceptions.php',
718-
];
719-
$ignoreErrors[] = [
720-
'message' => '#^Method CodeIgniter\\\\Debug\\\\Iterator\\:\\:add\\(\\) has parameter \\$closure with no signature specified for Closure\\.$#',
721-
'count' => 1,
722-
'path' => __DIR__ . '/system/Debug/Iterator.php',
723-
];
724-
$ignoreErrors[] = [
725-
'message' => '#^Method CodeIgniter\\\\Debug\\\\Timer\\:\\:record\\(\\) has parameter \\$callable with no signature specified for callable\\.$#',
726-
'count' => 1,
727-
'path' => __DIR__ . '/system/Debug/Timer.php',
728-
];
729-
$ignoreErrors[] = [
730-
'message' => '#^Method CodeIgniter\\\\Debug\\\\Toolbar\\:\\:prepare\\(\\) has no return type specified\\.$#',
731-
'count' => 1,
732-
'path' => __DIR__ . '/system/Debug/Toolbar.php',
733-
];
734-
$ignoreErrors[] = [
735-
'message' => '#^Method CodeIgniter\\\\Debug\\\\Toolbar\\:\\:respond\\(\\) has no return type specified\\.$#',
736-
'count' => 1,
737-
'path' => __DIR__ . '/system/Debug/Toolbar.php',
738-
];
739-
$ignoreErrors[] = [
740-
'message' => '#^Method CodeIgniter\\\\Debug\\\\Toolbar\\\\Collectors\\\\BaseCollector\\:\\:getBadgeValue\\(\\) has no return type specified\\.$#',
741-
'count' => 1,
742-
'path' => __DIR__ . '/system/Debug/Toolbar/Collectors/BaseCollector.php',
743-
];
744-
$ignoreErrors[] = [
745-
'message' => '#^Method CodeIgniter\\\\Debug\\\\Toolbar\\\\Collectors\\\\BaseCollector\\:\\:getVarData\\(\\) has no return type specified\\.$#',
746-
'count' => 1,
747-
'path' => __DIR__ . '/system/Debug/Toolbar/Collectors/BaseCollector.php',
748-
];
749-
$ignoreErrors[] = [
750-
'message' => '#^Method CodeIgniter\\\\Debug\\\\Toolbar\\\\Collectors\\\\Database\\:\\:collect\\(\\) has no return type specified\\.$#',
751-
'count' => 1,
752-
'path' => __DIR__ . '/system/Debug/Toolbar/Collectors/Database.php',
753-
];
754-
$ignoreErrors[] = [
755-
'message' => '#^Method CodeIgniter\\\\Debug\\\\Toolbar\\\\Collectors\\\\Database\\:\\:getConnections\\(\\) has no return type specified\\.$#',
756-
'count' => 1,
757-
'path' => __DIR__ . '/system/Debug/Toolbar/Collectors/Database.php',
758-
];
759-
$ignoreErrors[] = [
760-
'message' => '#^Method CodeIgniter\\\\Debug\\\\Toolbar\\\\Collectors\\\\History\\:\\:setFiles\\(\\) has no return type specified\\.$#',
761-
'count' => 1,
762-
'path' => __DIR__ . '/system/Debug/Toolbar/Collectors/History.php',
763-
];
764-
$ignoreErrors[] = [
765-
'message' => '#^Method CodeIgniter\\\\Debug\\\\Toolbar\\\\Collectors\\\\Logs\\:\\:collectLogs\\(\\) has no return type specified\\.$#',
766-
'count' => 1,
767-
'path' => __DIR__ . '/system/Debug/Toolbar/Collectors/Logs.php',
768-
];
769699
$ignoreErrors[] = [
770700
'message' => '#^Property CodeIgniter\\\\Log\\\\Logger\\:\\:\\$logCache \\(array\\) on left side of \\?\\? is not nullable\\.$#',
771701
'count' => 1,

system/Debug/Exceptions.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ public function __construct(ExceptionsConfig $config, $request, ResponseInterfac
9898
* handling of our application.
9999
*
100100
* @codeCoverageIgnore
101+
*
102+
* @return void
101103
*/
102104
public function initialize()
103105
{
@@ -112,6 +114,9 @@ public function initialize()
112114
* and fire an event that allows custom actions to be taken at this point.
113115
*
114116
* @codeCoverageIgnore
117+
*
118+
* @return void
119+
* @phpstan-return never|void
115120
*/
116121
public function exceptionHandler(Throwable $exception)
117122
{
@@ -189,6 +194,9 @@ public function errorHandler(int $severity, string $message, ?string $file = nul
189194
* need to be caught and handle them.
190195
*
191196
* @codeCoverageIgnore
197+
*
198+
* @return void
199+
* @phpstan-return never|void
192200
*/
193201
public function shutdownHandler()
194202
{
@@ -243,6 +251,9 @@ protected function determineView(Throwable $exception, string $templatePath): st
243251

244252
/**
245253
* Given an exception and status code will display the error to the client.
254+
*
255+
* @return void
256+
* @phpstan-return never|void
246257
*/
247258
protected function render(Throwable $exception, int $statusCode)
248259
{

system/Debug/Iterator.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ class Iterator
3838
* Tests are simply closures that the user can define any sequence of
3939
* things to happen during the test.
4040
*
41+
* @phpstan-param Closure(): mixed $closure
42+
*
4143
* @return $this
4244
*/
4345
public function add(string $name, Closure $closure)

system/Debug/Timer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ public function has(string $name): bool
131131
* Executes callable and measures its time.
132132
* Returns its return value if any.
133133
*
134-
* @param string $name The name of the timer
135-
* @param callable $callable callable to be executed
134+
* @param string $name The name of the timer
135+
* @phpstan-param callable(): mixed $callable callable to be executed
136136
*
137137
* @return array|bool|float|int|object|resource|string|null
138138
*/

system/Debug/Toolbar.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,8 @@ protected function roundTo(float $number, int $increments = 5): float
348348
*
349349
* @param RequestInterface $request
350350
* @param ResponseInterface $response
351+
*
352+
* @return void
351353
*/
352354
public function prepare(?RequestInterface $request = null, ?ResponseInterface $response = null)
353355
{
@@ -434,6 +436,9 @@ public function prepare(?RequestInterface $request = null, ?ResponseInterface $r
434436
* Inject debug toolbar into the response.
435437
*
436438
* @codeCoverageIgnore
439+
*
440+
* @return void
441+
* @phpstan-return never|void
437442
*/
438443
public function respond()
439444
{

system/Debug/Toolbar/Collectors/BaseCollector.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ public function hasVarData(): bool
137137
* 'bar' => 'baz'
138138
* ],
139139
* ];
140+
*
141+
* @return array|null
140142
*/
141143
public function getVarData()
142144
{
@@ -183,6 +185,8 @@ public function cleanPath(string $file): string
183185

184186
/**
185187
* Gets the "badge" value for the button.
188+
*
189+
* @return int|null
186190
*/
187191
public function getBadgeValue()
188192
{

system/Debug/Toolbar/Collectors/Database.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ public function __construct()
7676
* data.
7777
*
7878
* @internal
79+
*
80+
* @return void
81+
* @phpstan-return never|void
7982
*/
8083
public static function collect(Query $query)
8184
{
@@ -247,7 +250,7 @@ public function icon(): string
247250
/**
248251
* Gets the connections from the database config
249252
*/
250-
private function getConnections()
253+
private function getConnections(): void
251254
{
252255
$this->connections = \Config\Database::getConnections();
253256
}

system/Debug/Toolbar/Collectors/History.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ class History extends BaseCollector
6060
*
6161
* @param string $current Current history time
6262
* @param int $limit Max history files
63+
*
64+
* @return void
6365
*/
6466
public function setFiles(string $current, int $limit = 20)
6567
{

system/Debug/Toolbar/Collectors/Logs.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ public function icon(): string
8181

8282
/**
8383
* Ensures the data has been collected.
84+
*
85+
* @return array
8486
*/
8587
protected function collectLogs()
8688
{

0 commit comments

Comments
 (0)