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

Prevent trying to open() menus without any items #130

Closed
Lynesth opened this issue May 13, 2018 · 2 comments
Closed

Prevent trying to open() menus without any items #130

Lynesth opened this issue May 13, 2018 · 2 comments
Labels
Milestone

Comments

@Lynesth
Copy link
Collaborator

Lynesth commented May 13, 2018

Or at least handle it correctly. It crashes when trying to move the selection.

@AydinHassan AydinHassan added this to the 3.0 milestone May 14, 2018
@AydinHassan
Copy link
Member

@Lynesth is this still the case? I can't reproduce this on master

@Lynesth
Copy link
Collaborator Author

Lynesth commented May 14, 2018

Yep I confirm this still is the case on master.

You can reproduce it like this:

<?php

use PhpSchool\CliMenu\CliMenu;
use PhpSchool\CliMenu\CliMenuBuilder;

require_once(__DIR__ . '/../vendor/autoload.php');

$itemCallable = function (CliMenu $menu) {
    echo $menu->getSelectedItem()->getText();
};

$menu = (new CliMenuBuilder)
    ->disableDefaultItems()
    ->build();

$menu->open();

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

No branches or pull requests

2 participants