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

Menu blink because deprecated warning. #249

Closed
atomatis opened this issue Dec 15, 2021 · 4 comments
Closed

Menu blink because deprecated warning. #249

atomatis opened this issue Dec 15, 2021 · 4 comments

Comments

@atomatis
Copy link

atomatis commented Dec 15, 2021

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.

@AydinHassan
Copy link
Member

Fixed with #252 - thanks for reporting!

@AydinHassan
Copy link
Member

Will tag a new release soon, just doing a bit of housekeeping

@AydinHassan
Copy link
Member

@atomatis tagged 4.3.0

@atomatis
Copy link
Author

Great! TY :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants