Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: system/CLI/BaseCommand.php #8741

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
kenjis marked this conversation as resolved.
Show resolved Hide resolved
*/
public function __get(string $key)
{
Expand Down
Loading