Skip to content

Commit

Permalink
test: refactor system/CLI/BaseCommand.php
Browse files Browse the repository at this point in the history
  • Loading branch information
mcsaygili committed Apr 10, 2024
1 parent 2c524fd commit a5213fe
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 23 deletions.
20 changes: 0 additions & 20 deletions phpstan-baseline.php
Original file line number Diff line number Diff line change
Expand Up @@ -261,26 +261,6 @@
'count' => 1,
'path' => __DIR__ . '/system/BaseModel.php',
];
$ignoreErrors[] = [
'message' => '#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#',
'count' => 2,
'path' => __DIR__ . '/system/CLI/BaseCommand.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\CLI\\\\BaseCommand\\:\\:__get\\(\\) return type has no value type specified in iterable type array\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/CLI/BaseCommand.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\CLI\\\\BaseCommand\\:\\:call\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/CLI/BaseCommand.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\CLI\\\\BaseCommand\\:\\:getPad\\(\\) has parameter \\$array with no value type specified in iterable type array\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/CLI/BaseCommand.php',
];
$ignoreErrors[] = [
'message' => '#^Accessing offset \'ANSICON\' directly on \\$_SERVER is discouraged\\.$#',
'count' => 1,
Expand Down
10 changes: 7 additions & 3 deletions system/CLI/BaseCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ abstract public function run(array $params);
/**
* Can be used by a command to run other commands.
*
* @param array<int|string, string|null> $params
*
* @return int|void
*
* @throws ReflectionException
Expand Down Expand Up @@ -140,7 +142,7 @@ public function showHelp()
{
CLI::write(lang('CLI.helpUsage'), 'yellow');

if (! empty($this->usage)) {
if (isset($this->usage)) {
$usage = $this->usage;
} else {
$usage = $this->name;
Expand All @@ -152,7 +154,7 @@ public function showHelp()

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

if (! empty($this->description)) {
if (isset($this->description)) {
CLI::newLine();
CLI::write(lang('CLI.helpDescription'), 'yellow');
CLI::write($this->setPad($this->description, 0, 0, 2));
Expand Down Expand Up @@ -194,6 +196,8 @@ public function setPad(string $item, int $max, int $extra = 2, int $indent = 0):
/**
* Get pad for $key => $value array output
*
* @param array<string, string> $array
*
* @deprecated Use setPad() instead.
*
* @codeCoverageIgnore
Expand All @@ -212,7 +216,7 @@ public function getPad(array $array, int $pad): int
/**
* Makes it simple to access our protected properties.
*
* @return array|Commands|LoggerInterface|string|null
* @return Commands|list<mixed>|LoggerInterface|string|null
*/
public function __get(string $key)
{
Expand Down

0 comments on commit a5213fe

Please sign in to comment.