These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | use PhpSchool\CliMenu\CliMenu; |
||
4 | use PhpSchool\CliMenu\Builder\CliMenuBuilder; |
||
5 | |||
6 | require_once(__DIR__ . '/../vendor/autoload.php'); |
||
7 | |||
8 | $itemCallable = function (CliMenu $menu) { |
||
9 | echo $menu->getSelectedItem()->getText(); |
||
10 | }; |
||
11 | |||
12 | $menu = (new CliMenuBuilder) |
||
13 | ->setTitle('Basic CLI Menu Disabled Items') |
||
14 | ->addItem('First Item', $itemCallable) |
||
15 | ->addItem('Second Item', $itemCallable, false, true) |
||
16 | ->addItem('Third Item', $itemCallable, false, true) |
||
17 | ->addSubMenu('sub-menu-1', 'Submenu') |
||
0 ignored issues
–
show
|
|||
18 | ->setTitle('Basic CLI Menu Disabled Items > Submenu') |
||
19 | ->addItem('You can go in here!', $itemCallable) |
||
20 | ->end() |
||
21 | ->addSubMenu('sub-menu-2', 'Disabled Submenu') |
||
22 | ->setTitle('Basic CLI Menu Disabled Items > Disabled Submenu') |
||
23 | ->addItem('Nope can\'t see this!', $itemCallable) |
||
24 | ->disableMenu() |
||
25 | ->end() |
||
26 | ->addLineBreak('-') |
||
27 | ->build(); |
||
28 | |||
29 | $menu->open(); |
||
30 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: