Skip to content

docs: fix @param array type for Commands #8111

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

Merged
merged 1 commit into from
Oct 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
50 changes: 0 additions & 50 deletions phpstan-baseline.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,16 +196,6 @@
'count' => 1,
'path' => __DIR__ . '/system/Commands/Database/CreateDatabase.php',
];
$ignoreErrors[] = [
'message' => '#^PHPDoc type array\\<string, string\\> of property CodeIgniter\\\\Commands\\\\Database\\\\CreateDatabase\\:\\:\\$arguments is not the same as PHPDoc type array of overridden property CodeIgniter\\\\CLI\\\\BaseCommand\\:\\:\\$arguments\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Commands/Database/CreateDatabase.php',
];
$ignoreErrors[] = [
'message' => '#^PHPDoc type array\\<string, string\\> of property CodeIgniter\\\\Commands\\\\Database\\\\CreateDatabase\\:\\:\\$options is not the same as PHPDoc type array of overridden property CodeIgniter\\\\CLI\\\\BaseCommand\\:\\:\\$options\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Commands/Database/CreateDatabase.php',
];
$ignoreErrors[] = [
'message' => '#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#',
'count' => 1,
Expand All @@ -216,11 +206,6 @@
'count' => 1,
'path' => __DIR__ . '/system/Commands/Database/MigrateStatus.php',
];
$ignoreErrors[] = [
'message' => '#^PHPDoc type array\\<string, string\\> of property CodeIgniter\\\\Commands\\\\Database\\\\MigrateStatus\\:\\:\\$options is not the same as PHPDoc type array of overridden property CodeIgniter\\\\CLI\\\\BaseCommand\\:\\:\\$options\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Commands/Database/MigrateStatus.php',
];
$ignoreErrors[] = [
'message' => '#^Parameter \\#1 \\$params \\(array\\<string, mixed\\>\\) of method CodeIgniter\\\\Commands\\\\Database\\\\MigrateStatus\\:\\:run\\(\\) should be contravariant with parameter \\$params \\(array\\<int\\|string, string\\|null\\>\\) of method CodeIgniter\\\\CLI\\\\BaseCommand\\:\\:run\\(\\)$#',
'count' => 1,
Expand All @@ -231,11 +216,6 @@
'count' => 1,
'path' => __DIR__ . '/system/Commands/Database/Seed.php',
];
$ignoreErrors[] = [
'message' => '#^PHPDoc type array\\<string, string\\> of property CodeIgniter\\\\Commands\\\\Database\\\\Seed\\:\\:\\$arguments is not the same as PHPDoc type array of overridden property CodeIgniter\\\\CLI\\\\BaseCommand\\:\\:\\$arguments\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Commands/Database/Seed.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\Commands\\\\Database\\\\ShowTableInfo\\:\\:showAllTables\\(\\) has no return type specified\\.$#',
'count' => 1,
Expand All @@ -246,16 +226,6 @@
'count' => 1,
'path' => __DIR__ . '/system/Commands/Database/ShowTableInfo.php',
];
$ignoreErrors[] = [
'message' => '#^PHPDoc type array\\<string, string\\> of property CodeIgniter\\\\Commands\\\\Database\\\\ShowTableInfo\\:\\:\\$arguments is not the same as PHPDoc type array of overridden property CodeIgniter\\\\CLI\\\\BaseCommand\\:\\:\\$arguments\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Commands/Database/ShowTableInfo.php',
];
$ignoreErrors[] = [
'message' => '#^PHPDoc type array\\<string, string\\> of property CodeIgniter\\\\Commands\\\\Database\\\\ShowTableInfo\\:\\:\\$options is not the same as PHPDoc type array of overridden property CodeIgniter\\\\CLI\\\\BaseCommand\\:\\:\\$options\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Commands/Database/ShowTableInfo.php',
];
$ignoreErrors[] = [
'message' => '#^Accessing offset \'encryption\\.key\' directly on \\$_SERVER is discouraged\\.$#',
'count' => 1,
Expand Down Expand Up @@ -756,26 +726,11 @@
'count' => 3,
'path' => __DIR__ . '/system/Commands/Utilities/Environment.php',
];
$ignoreErrors[] = [
'message' => '#^PHPDoc type array\\<string, string\\> of property CodeIgniter\\\\Commands\\\\Utilities\\\\Environment\\:\\:\\$arguments is not the same as PHPDoc type array of overridden property CodeIgniter\\\\CLI\\\\BaseCommand\\:\\:\\$arguments\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Commands/Utilities/Environment.php',
];
$ignoreErrors[] = [
'message' => '#^PHPDoc type array\\<string, string\\> of property CodeIgniter\\\\Commands\\\\Utilities\\\\FilterCheck\\:\\:\\$arguments is not the same as PHPDoc type array of overridden property CodeIgniter\\\\CLI\\\\BaseCommand\\:\\:\\$arguments\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Commands/Utilities/FilterCheck.php',
];
$ignoreErrors[] = [
'message' => '#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Commands/Utilities/Namespaces.php',
];
$ignoreErrors[] = [
'message' => '#^PHPDoc type array\\<string, string\\> of property CodeIgniter\\\\Commands\\\\Utilities\\\\Publish\\:\\:\\$arguments is not the same as PHPDoc type array of overridden property CodeIgniter\\\\CLI\\\\BaseCommand\\:\\:\\$arguments\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Commands/Utilities/Publish.php',
];
$ignoreErrors[] = [
'message' => '#^Accessing offset \'HTTP_HOST\' directly on \\$_SERVER is discouraged\\.$#',
'count' => 1,
Expand All @@ -796,11 +751,6 @@
'count' => 3,
'path' => __DIR__ . '/system/Commands/Utilities/Routes.php',
];
$ignoreErrors[] = [
'message' => '#^PHPDoc type array\\<string, string\\> of property CodeIgniter\\\\Commands\\\\Utilities\\\\Routes\\:\\:\\$options is not the same as PHPDoc type array of overridden property CodeIgniter\\\\CLI\\\\BaseCommand\\:\\:\\$options\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Commands/Utilities/Routes.php',
];
$ignoreErrors[] = [
'message' => '#^Implicit array creation is not allowed \\- variable \\$filters might not exist\\.$#',
'count' => 1,
Expand Down
20 changes: 10 additions & 10 deletions system/CLI/BaseCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@
/**
* BaseCommand is the base class used in creating CLI commands.
*
* @property array $arguments
* @property Commands $commands
* @property string $description
* @property string $group
* @property LoggerInterface $logger
* @property string $name
* @property array $options
* @property string $usage
* @property array<string, string> $arguments
* @property Commands $commands
* @property string $description
* @property string $group
* @property LoggerInterface $logger
* @property string $name
* @property array<string, string> $options
* @property string $usage
*/
abstract class BaseCommand
{
Expand Down Expand Up @@ -62,14 +62,14 @@ abstract class BaseCommand
/**
* the Command's options description
*
* @var array
* @var array<string, string>
*/
protected $options = [];

/**
* the Command's Arguments description
*
* @var array
* @var array<string, string>
*/
protected $arguments = [];

Expand Down
2 changes: 1 addition & 1 deletion system/Commands/Cache/ClearCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class ClearCache extends BaseCommand
/**
* the Command's Arguments
*
* @var array
* @var array<string, string>
*/
protected $arguments = [
'driver' => 'The cache driver to use',
Expand Down
2 changes: 1 addition & 1 deletion system/Commands/Database/Migrate.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class Migrate extends BaseCommand
/**
* the Command's Options
*
* @var array
* @var array<string, string>
*/
protected $options = [
'-n' => 'Set migration namespace',
Expand Down
2 changes: 1 addition & 1 deletion system/Commands/Database/MigrateRefresh.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class MigrateRefresh extends BaseCommand
/**
* the Command's Options
*
* @var array
* @var array<string, string>
*/
protected $options = [
'-n' => 'Set migration namespace',
Expand Down
2 changes: 1 addition & 1 deletion system/Commands/Database/MigrateRollback.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class MigrateRollback extends BaseCommand
/**
* the Command's Options
*
* @var array
* @var array<string, string>
*/
protected $options = [
'-b' => 'Specify a batch to roll back to; e.g. "3" to return to batch #3',
Expand Down
2 changes: 1 addition & 1 deletion system/Commands/Encryption/GenerateKey.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class GenerateKey extends BaseCommand
/**
* The command's options
*
* @var array
* @var array<string, string>
*/
protected $options = [
'--force' => 'Force overwrite existing key in `.env` file.',
Expand Down
4 changes: 2 additions & 2 deletions system/Commands/Generators/CellGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class CellGenerator extends BaseCommand
/**
* The Command's Arguments
*
* @var array
* @var array<string, string>
*/
protected $arguments = [
'name' => 'The cell class name.',
Expand All @@ -61,7 +61,7 @@ class CellGenerator extends BaseCommand
/**
* The Command's Options
*
* @var array
* @var array<string, string>
*/
protected $options = [
'--namespace' => 'Set root namespace. Default: "APP_NAMESPACE".',
Expand Down
4 changes: 2 additions & 2 deletions system/Commands/Generators/CommandGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class CommandGenerator extends BaseCommand
/**
* The Command's Arguments
*
* @var array
* @var array<string, string>
*/
protected $arguments = [
'name' => 'The command class name.',
Expand All @@ -62,7 +62,7 @@ class CommandGenerator extends BaseCommand
/**
* The Command's Options
*
* @var array
* @var array<string, string>
*/
protected $options = [
'--command' => 'The command name. Default: "command:name"',
Expand Down
4 changes: 2 additions & 2 deletions system/Commands/Generators/ConfigGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class ConfigGenerator extends BaseCommand
/**
* The Command's Arguments
*
* @var array
* @var array<string, string>
*/
protected $arguments = [
'name' => 'The config class name.',
Expand All @@ -61,7 +61,7 @@ class ConfigGenerator extends BaseCommand
/**
* The Command's Options
*
* @var array
* @var array<string, string>
*/
protected $options = [
'--namespace' => 'Set root namespace. Default: "APP_NAMESPACE".',
Expand Down
4 changes: 2 additions & 2 deletions system/Commands/Generators/ControllerGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class ControllerGenerator extends BaseCommand
/**
* The Command's Arguments
*
* @var array
* @var array<string, string>
*/
protected $arguments = [
'name' => 'The controller class name.',
Expand All @@ -65,7 +65,7 @@ class ControllerGenerator extends BaseCommand
/**
* The Command's Options
*
* @var array
* @var array<string, string>
*/
protected $options = [
'--bare' => 'Extends from CodeIgniter\Controller instead of BaseController.',
Expand Down
4 changes: 2 additions & 2 deletions system/Commands/Generators/EntityGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class EntityGenerator extends BaseCommand
/**
* The Command's Arguments
*
* @var array
* @var array<string, string>
*/
protected $arguments = [
'name' => 'The entity class name.',
Expand All @@ -61,7 +61,7 @@ class EntityGenerator extends BaseCommand
/**
* The Command's Options
*
* @var array
* @var array<string, string>
*/
protected $options = [
'--namespace' => 'Set root namespace. Default: "APP_NAMESPACE".',
Expand Down
4 changes: 2 additions & 2 deletions system/Commands/Generators/FilterGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class FilterGenerator extends BaseCommand
/**
* The Command's Arguments
*
* @var array
* @var array<string, string>
*/
protected $arguments = [
'name' => 'The filter class name.',
Expand All @@ -61,7 +61,7 @@ class FilterGenerator extends BaseCommand
/**
* The Command's Options
*
* @var array
* @var array<string, string>
*/
protected $options = [
'--namespace' => 'Set root namespace. Default: "APP_NAMESPACE".',
Expand Down
4 changes: 2 additions & 2 deletions system/Commands/Generators/MigrateCreate.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class MigrateCreate extends BaseCommand
/**
* The Command's arguments.
*
* @var array
* @var array<string, string>
*/
protected $arguments = [
'name' => 'The migration file name.',
Expand All @@ -64,7 +64,7 @@ class MigrateCreate extends BaseCommand
/**
* The Command's options.
*
* @var array
* @var array<string, string>
*/
protected $options = [
'--namespace' => 'Set root namespace. Defaults to APP_NAMESPACE',
Expand Down
4 changes: 2 additions & 2 deletions system/Commands/Generators/MigrationGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class MigrationGenerator extends BaseCommand
/**
* The Command's Arguments
*
* @var array
* @var array<string, string>
*/
protected $arguments = [
'name' => 'The migration class name.',
Expand All @@ -65,7 +65,7 @@ class MigrationGenerator extends BaseCommand
/**
* The Command's Options
*
* @var array
* @var array<string, string>
*/
protected $options = [
'--session' => 'Generates the migration file for database sessions.',
Expand Down
4 changes: 2 additions & 2 deletions system/Commands/Generators/ModelGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class ModelGenerator extends BaseCommand
/**
* The Command's Arguments
*
* @var array
* @var array<string, string>
*/
protected $arguments = [
'name' => 'The model class name.',
Expand All @@ -62,7 +62,7 @@ class ModelGenerator extends BaseCommand
/**
* The Command's Options
*
* @var array
* @var array<string, string>
*/
protected $options = [
'--table' => 'Supply a table name. Default: "the lowercased plural of the class name".',
Expand Down
4 changes: 2 additions & 2 deletions system/Commands/Generators/ScaffoldGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class ScaffoldGenerator extends BaseCommand
/**
* The Command's Arguments
*
* @var array
* @var array<string, string>
*/
protected $arguments = [
'name' => 'The class name',
Expand All @@ -62,7 +62,7 @@ class ScaffoldGenerator extends BaseCommand
/**
* The Command's Options
*
* @var array
* @var array<string, string>
*/
protected $options = [
'--bare' => 'Add the "--bare" option to controller component.',
Expand Down
4 changes: 2 additions & 2 deletions system/Commands/Generators/SeederGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class SeederGenerator extends BaseCommand
/**
* The Command's Arguments
*
* @var array
* @var array<string, string>
*/
protected $arguments = [
'name' => 'The seeder class name.',
Expand All @@ -61,7 +61,7 @@ class SeederGenerator extends BaseCommand
/**
* The Command's Options
*
* @var array
* @var array<string, string>
*/
protected $options = [
'--namespace' => 'Set root namespace. Default: "APP_NAMESPACE".',
Expand Down
2 changes: 1 addition & 1 deletion system/Commands/Generators/SessionMigrationGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class SessionMigrationGenerator extends BaseCommand
/**
* The Command's Options
*
* @var array
* @var array<string, string>
*/
protected $options = [
'-t' => 'Supply a table name.',
Expand Down
Loading