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

If option item text is greater than width, it has syntax error #8

Closed
mikeerickson opened this issue Feb 8, 2018 · 1 comment
Closed

Comments

@mikeerickson
Copy link

Using the following

$options = ['Item 1',str_repeat('-', 80),'Item 3'];
$option = $this->menu('Select', $options)
   ->setWidth(40);

produces the following error

 Whoops\Exception\ErrorException  : str_repeat(): Second argument has to be greater than or equal to 0

  at /Users/merickson/docker/localenv/m4-tools/vendor/php-school/cli-menu/src/CliMenu.php: 319
  315:                 str_repeat(' ', $this->style->getMargin()),
  316:                 $setColour,
  317:                 str_repeat(' ', $this->style->getPadding()),
  318:                 $row,
  319:                 str_repeat(' ', $this->style->getRightHandPadding(mb_strlen(s::stripAnsiEscapeSequence($row)))),
  320:                 $unsetColour,
  321:                 str_repeat(' ', $this->style->getMargin())
  322:             );
  323:         }, $rows);
  324:     }

  Exception trace:

  1   str_repeat(" ")
      /Users/merickson/docker/localenv/m4-tools/vendor/php-school/cli-menu/src/CliMenu.php : 319

  2   PhpSchool\CliMenu\CliMenu::PhpSchool\CliMenu\{closure}("  --------------------------------------------------------------------------------")
      [internal] : 0

  Please use the argument -v to see more details.


@nunomaduro
Copy link
Owner

Thanks, @mikeerickson. But I will close this issue due to the lack of activity.

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

No branches or pull requests

2 participants