Skip to content

Commit e14e145

Browse files
authored
Merge pull request #8741 from mcsaygili/refactor-system-CLI-BaseCommand.php
refactor: system/CLI/BaseCommand.php
2 parents 3866007 + 2a6591a commit e14e145

File tree

2 files changed

+7
-23
lines changed

2 files changed

+7
-23
lines changed

phpstan-baseline.php

-20
Original file line numberDiff line numberDiff line change
@@ -261,26 +261,6 @@
261261
'count' => 1,
262262
'path' => __DIR__ . '/system/BaseModel.php',
263263
];
264-
$ignoreErrors[] = [
265-
'message' => '#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#',
266-
'count' => 2,
267-
'path' => __DIR__ . '/system/CLI/BaseCommand.php',
268-
];
269-
$ignoreErrors[] = [
270-
'message' => '#^Method CodeIgniter\\\\CLI\\\\BaseCommand\\:\\:__get\\(\\) return type has no value type specified in iterable type array\\.$#',
271-
'count' => 1,
272-
'path' => __DIR__ . '/system/CLI/BaseCommand.php',
273-
];
274-
$ignoreErrors[] = [
275-
'message' => '#^Method CodeIgniter\\\\CLI\\\\BaseCommand\\:\\:call\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#',
276-
'count' => 1,
277-
'path' => __DIR__ . '/system/CLI/BaseCommand.php',
278-
];
279-
$ignoreErrors[] = [
280-
'message' => '#^Method CodeIgniter\\\\CLI\\\\BaseCommand\\:\\:getPad\\(\\) has parameter \\$array with no value type specified in iterable type array\\.$#',
281-
'count' => 1,
282-
'path' => __DIR__ . '/system/CLI/BaseCommand.php',
283-
];
284264
$ignoreErrors[] = [
285265
'message' => '#^Accessing offset \'ANSICON\' directly on \\$_SERVER is discouraged\\.$#',
286266
'count' => 1,

system/CLI/BaseCommand.php

+7-3
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ abstract public function run(array $params);
108108
/**
109109
* Can be used by a command to run other commands.
110110
*
111+
* @param array<int|string, string|null> $params
112+
*
111113
* @return int|void
112114
*
113115
* @throws ReflectionException
@@ -140,7 +142,7 @@ public function showHelp()
140142
{
141143
CLI::write(lang('CLI.helpUsage'), 'yellow');
142144

143-
if (! empty($this->usage)) {
145+
if (isset($this->usage)) {
144146
$usage = $this->usage;
145147
} else {
146148
$usage = $this->name;
@@ -152,7 +154,7 @@ public function showHelp()
152154

153155
CLI::write($this->setPad($usage, 0, 0, 2));
154156

155-
if (! empty($this->description)) {
157+
if (isset($this->description)) {
156158
CLI::newLine();
157159
CLI::write(lang('CLI.helpDescription'), 'yellow');
158160
CLI::write($this->setPad($this->description, 0, 0, 2));
@@ -194,6 +196,8 @@ public function setPad(string $item, int $max, int $extra = 2, int $indent = 0):
194196
/**
195197
* Get pad for $key => $value array output
196198
*
199+
* @param array<string, string> $array
200+
*
197201
* @deprecated Use setPad() instead.
198202
*
199203
* @codeCoverageIgnore
@@ -212,7 +216,7 @@ public function getPad(array $array, int $pad): int
212216
/**
213217
* Makes it simple to access our protected properties.
214218
*
215-
* @return array|Commands|LoggerInterface|string|null
219+
* @return array<string, string>|Commands|LoggerInterface|string|null
216220
*/
217221
public function __get(string $key)
218222
{

0 commit comments

Comments
 (0)