vierge-noire / cakephp-fixture-factories

CakePHP Fixture Factories
https://vierge-noire.github.io/
MIT License
83 stars 21 forks source link

PersistCommand and number argument: default value should be a string #246

Open fidrebg opened 5 months ago

fidrebg commented 5 months ago

Description of the problem

Console Input Options does not support mixed value anymore. Only string, bool and null. So if you try the command you get the following error:

Cake\Console\ConsoleInputOption::__construct(): Argument #5 ($default) must be of type string|bool|null, int given

Versions

Cakephp: 5.0.6 Cakephp-fixture-factories: 3.0.2

Possible solution

In src/Command/PersistCommand.php line 65

Replace

->addOption('number', [ 'help' => 'Number of entities to persist.', 'short' => 'n', 'default' => 1, ])

With

->addOption('number', [ 'help' => 'Number of entities to persist.', 'short' => 'n', 'default' => '1', ])