Skip to content

Commit 52ebe5b

Browse files
committed
fix: phpstan CLI no type specified
1 parent f491f66 commit 52ebe5b

5 files changed

Lines changed: 34 additions & 85 deletions

File tree

phpstan-baseline.php

Lines changed: 0 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -31,91 +31,6 @@
3131
'count' => 1,
3232
'path' => __DIR__ . '/system/BaseModel.php',
3333
];
34-
$ignoreErrors[] = [
35-
'message' => '#^Method CodeIgniter\\\\CLI\\\\BaseCommand\\:\\:showError\\(\\) has no return type specified\\.$#',
36-
'count' => 1,
37-
'path' => __DIR__ . '/system/CLI/BaseCommand.php',
38-
];
39-
$ignoreErrors[] = [
40-
'message' => '#^Method CodeIgniter\\\\CLI\\\\BaseCommand\\:\\:showHelp\\(\\) has no return type specified\\.$#',
41-
'count' => 1,
42-
'path' => __DIR__ . '/system/CLI/BaseCommand.php',
43-
];
44-
$ignoreErrors[] = [
45-
'message' => '#^Method CodeIgniter\\\\CLI\\\\CLI\\:\\:beep\\(\\) has no return type specified\\.$#',
46-
'count' => 1,
47-
'path' => __DIR__ . '/system/CLI/CLI.php',
48-
];
49-
$ignoreErrors[] = [
50-
'message' => '#^Method CodeIgniter\\\\CLI\\\\CLI\\:\\:clearScreen\\(\\) has no return type specified\\.$#',
51-
'count' => 1,
52-
'path' => __DIR__ . '/system/CLI/CLI.php',
53-
];
54-
$ignoreErrors[] = [
55-
'message' => '#^Method CodeIgniter\\\\CLI\\\\CLI\\:\\:error\\(\\) has no return type specified\\.$#',
56-
'count' => 1,
57-
'path' => __DIR__ . '/system/CLI/CLI.php',
58-
];
59-
$ignoreErrors[] = [
60-
'message' => '#^Method CodeIgniter\\\\CLI\\\\CLI\\:\\:fwrite\\(\\) has no return type specified\\.$#',
61-
'count' => 1,
62-
'path' => __DIR__ . '/system/CLI/CLI.php',
63-
];
64-
$ignoreErrors[] = [
65-
'message' => '#^Method CodeIgniter\\\\CLI\\\\CLI\\:\\:generateDimensions\\(\\) has no return type specified\\.$#',
66-
'count' => 1,
67-
'path' => __DIR__ . '/system/CLI/CLI.php',
68-
];
69-
$ignoreErrors[] = [
70-
'message' => '#^Method CodeIgniter\\\\CLI\\\\CLI\\:\\:init\\(\\) has no return type specified\\.$#',
71-
'count' => 1,
72-
'path' => __DIR__ . '/system/CLI/CLI.php',
73-
];
74-
$ignoreErrors[] = [
75-
'message' => '#^Method CodeIgniter\\\\CLI\\\\CLI\\:\\:newLine\\(\\) has no return type specified\\.$#',
76-
'count' => 1,
77-
'path' => __DIR__ . '/system/CLI/CLI.php',
78-
];
79-
$ignoreErrors[] = [
80-
'message' => '#^Method CodeIgniter\\\\CLI\\\\CLI\\:\\:parseCommandLine\\(\\) has no return type specified\\.$#',
81-
'count' => 1,
82-
'path' => __DIR__ . '/system/CLI/CLI.php',
83-
];
84-
$ignoreErrors[] = [
85-
'message' => '#^Method CodeIgniter\\\\CLI\\\\CLI\\:\\:print\\(\\) has no return type specified\\.$#',
86-
'count' => 1,
87-
'path' => __DIR__ . '/system/CLI/CLI.php',
88-
];
89-
$ignoreErrors[] = [
90-
'message' => '#^Method CodeIgniter\\\\CLI\\\\CLI\\:\\:showProgress\\(\\) has no return type specified\\.$#',
91-
'count' => 1,
92-
'path' => __DIR__ . '/system/CLI/CLI.php',
93-
];
94-
$ignoreErrors[] = [
95-
'message' => '#^Method CodeIgniter\\\\CLI\\\\CLI\\:\\:table\\(\\) has no return type specified\\.$#',
96-
'count' => 1,
97-
'path' => __DIR__ . '/system/CLI/CLI.php',
98-
];
99-
$ignoreErrors[] = [
100-
'message' => '#^Method CodeIgniter\\\\CLI\\\\CLI\\:\\:wait\\(\\) has no return type specified\\.$#',
101-
'count' => 1,
102-
'path' => __DIR__ . '/system/CLI/CLI.php',
103-
];
104-
$ignoreErrors[] = [
105-
'message' => '#^Method CodeIgniter\\\\CLI\\\\CLI\\:\\:write\\(\\) has no return type specified\\.$#',
106-
'count' => 1,
107-
'path' => __DIR__ . '/system/CLI/CLI.php',
108-
];
109-
$ignoreErrors[] = [
110-
'message' => '#^Method CodeIgniter\\\\CLI\\\\Commands\\:\\:discoverCommands\\(\\) has no return type specified\\.$#',
111-
'count' => 1,
112-
'path' => __DIR__ . '/system/CLI/Commands.php',
113-
];
114-
$ignoreErrors[] = [
115-
'message' => '#^Method CodeIgniter\\\\CLI\\\\Console\\:\\:showHeader\\(\\) has no return type specified\\.$#',
116-
'count' => 1,
117-
'path' => __DIR__ . '/system/CLI/Console.php',
118-
];
11934
$ignoreErrors[] = [
12035
'message' => '#^Method CodeIgniter\\\\Cache\\\\CacheInterface\\:\\:initialize\\(\\) has no return type specified\\.$#',
12136
'count' => 1,

system/CLI/BaseCommand.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ protected function call(string $command, array $params = [])
117117

118118
/**
119119
* A simple method to display an error with line/file, in child commands.
120+
*
121+
* @return void
120122
*/
121123
protected function showError(Throwable $e)
122124
{
@@ -129,6 +131,8 @@ protected function showError(Throwable $e)
129131

130132
/**
131133
* Show Help includes (Usage, Arguments, Description, Options).
134+
*
135+
* @return void
132136
*/
133137
public function showHelp()
134138
{

system/CLI/CLI.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ class CLI
142142

143143
/**
144144
* Static "constructor".
145+
*
146+
* @return void
145147
*/
146148
public static function init()
147149
{
@@ -429,6 +431,8 @@ protected static function validate(string $field, string $value, $rules): bool
429431
/**
430432
* Outputs a string to the CLI without any surrounding newlines.
431433
* Useful for showing repeating elements on a single line.
434+
*
435+
* @return void
432436
*/
433437
public static function print(string $text = '', ?string $foreground = null, ?string $background = null)
434438
{
@@ -443,6 +447,8 @@ public static function print(string $text = '', ?string $foreground = null, ?str
443447

444448
/**
445449
* Outputs a string to the cli on it's own line.
450+
*
451+
* @return void
446452
*/
447453
public static function write(string $text = '', ?string $foreground = null, ?string $background = null)
448454
{
@@ -460,6 +466,8 @@ public static function write(string $text = '', ?string $foreground = null, ?str
460466

461467
/**
462468
* Outputs an error to the CLI using STDERR instead of STDOUT
469+
*
470+
* @return void
463471
*/
464472
public static function error(string $text, string $foreground = 'light_red', ?string $background = null)
465473
{
@@ -481,6 +489,8 @@ public static function error(string $text, string $foreground = 'light_red', ?st
481489
* Beeps a certain number of times.
482490
*
483491
* @param int $num The number of times to beep
492+
*
493+
* @return void
484494
*/
485495
public static function beep(int $num = 1)
486496
{
@@ -493,6 +503,8 @@ public static function beep(int $num = 1)
493503
*
494504
* @param int $seconds Number of seconds
495505
* @param bool $countdown Show a countdown or not
506+
*
507+
* @return void
496508
*/
497509
public static function wait(int $seconds, bool $countdown = false)
498510
{
@@ -529,6 +541,8 @@ public static function isWindows(): bool
529541

530542
/**
531543
* Enter a number of empty lines
544+
*
545+
* @return void
532546
*/
533547
public static function newLine(int $num = 1)
534548
{
@@ -542,6 +556,8 @@ public static function newLine(int $num = 1)
542556
* Clears the screen of output
543557
*
544558
* @codeCoverageIgnore
559+
*
560+
* @return void
545561
*/
546562
public static function clearScreen()
547563
{
@@ -735,6 +751,8 @@ public static function getHeight(int $default = 32): int
735751
* Populates the CLI's dimensions.
736752
*
737753
* @codeCoverageIgnore
754+
*
755+
* @return void
738756
*/
739757
public static function generateDimensions()
740758
{
@@ -778,6 +796,8 @@ public static function generateDimensions()
778796
* to update it. Set $thisStep = false to erase the progress bar.
779797
*
780798
* @param bool|int $thisStep
799+
*
800+
* @return void
781801
*/
782802
public static function showProgress($thisStep = 1, int $totalSteps = 10)
783803
{
@@ -859,6 +879,8 @@ public static function wrap(?string $string = null, int $max = 0, int $padLeft =
859879
/**
860880
* Parses the command line it was called from and collects all
861881
* options and valid segments.
882+
*
883+
* @return void
862884
*/
863885
protected static function parseCommandLine()
864886
{
@@ -998,6 +1020,8 @@ public static function getOptionString(bool $useLongOpts = false, bool $trim = f
9981020
*
9991021
* @param array $tbody List of rows
10001022
* @param array $thead List of columns
1023+
*
1024+
* @return void
10011025
*/
10021026
public static function table(array $tbody, array $thead = [])
10031027
{
@@ -1096,6 +1120,8 @@ public static function table(array $tbody, array $thead = [])
10961120
* solution down the road.
10971121
*
10981122
* @param resource $handle
1123+
*
1124+
* @return void
10991125
*/
11001126
protected static function fwrite($handle, string $string)
11011127
{

system/CLI/Commands.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ public function getCommands()
7878
/**
7979
* Discovers all commands in the framework and within user code,
8080
* and collects instances of them to work with.
81+
*
82+
* @return void
8183
*/
8284
public function discoverCommands()
8385
{

system/CLI/Console.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ public function run()
3939

4040
/**
4141
* Displays basic information about the Console.
42+
*
43+
* @return void
4244
*/
4345
public function showHeader(bool $suppress = false)
4446
{

0 commit comments

Comments
 (0)