-
Notifications
You must be signed in to change notification settings - Fork 108
Description
Hello,
Sorry by advence for my poor english.
I have a little blink before show menu, because many deprecated warning is write before like
Deprecated: array_fill(): Passing null to parameter #2 ($count) of type int is deprecated in /Users/alexandre/Tools/krg-env/vendor/php-school/cli-menu/src/MenuStyle.php on line 672
PHP Deprecated: str_repeat(): Passing null to parameter #2 ($times) of type int is deprecated in /Users/alexandre/Tools/krg-env/vendor/php-school/cli-menu/src/MenuStyle.php on line 493
How reproduce:
Environment: php8.1, Mac Os Big Sur, iterm2 with zsh
Require cli menu and launch basic use found in doc
$itemCallable = function (CliMenu $menu) {
echo $menu->getSelectedItem()->getText();
};
$menu = (new CliMenuBuilder())
->setTitle('Basic CLI Menu')
->addItem('First Item', $itemCallable)
->addItem('Second Item', $itemCallable)
->addItem('Third Item', $itemCallable)
->addLineBreak('-')
->setBorder(1, 2, 'yellow')
->setPadding(2, 4)
->setMarginAuto()
->build();
$menu->open();
My proposition:
Add shortand $var ?? 0
on str_repeat()
and array_fill()
parameters.
Maybe add a declare(strict_types=1);
for renforce code?
I will propose a PR soon.
Temporary fix:
A bad but functional error_reporting(E_ALL ^ E_DEPRECATED);
before use remove deprecated warning.