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 | $result = $menu->askText() |
||
10 | ->setPlaceholderText('Enter something here') |
||
11 | ->ask(); |
||
12 | |||
13 | var_dump($result->fetch()); |
||
14 | }; |
||
15 | |||
16 | $menu = (new CliMenuBuilder) |
||
17 | ->setTitle('Basic CLI Menu') |
||
18 | ->addItem('Enter text', $itemCallable) |
||
19 | ->addItem('Second Item', $itemCallable) |
||
20 | ->addItem('Third Item', $itemCallable) |
||
21 | ->addLineBreak('-') |
||
22 | ->setMarginAuto('-') |
||
0 ignored issues
–
show
|
|||
23 | ->build(); |
||
24 | |||
25 | $menu->open(); |
||
26 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.
In this case you can add the
@ignore
PhpDoc annotation to the duplicate definition and it will be ignored.