Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
SmetDenis committed Apr 11, 2022
1 parent a54433e commit 21de31f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/CliCommand.php
Expand Up @@ -183,8 +183,9 @@ protected function getOptFloat(string $optionName): float
*/
protected function getOptString(string $optionName): string
{
$value = (string)$this->getOpt($optionName);
return \trim($value) ?: '';
$value = trim((string)$this->getOpt($optionName));
$length = \strlen($value);
return $length > 0 ? $value : '';
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/Cli/CliOptionsTest.php
Expand Up @@ -112,7 +112,7 @@ public function testOptionRequiredAndDefault()
"Bool" => false,
"Int" => 0,
"Float" => 0,
"String" => "0",
"String" => '0',
"Array" => ['0']
], $output[$option]);

Expand Down

0 comments on commit 21de31f

Please sign in to comment.