Skip to content

Commit

Permalink
Avoid undefined behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
duncan3dc committed Jul 10, 2018
1 parent b07c2a4 commit 0581d72
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Argument/Argument.php
Expand Up @@ -2,6 +2,8 @@

namespace League\CLImate\Argument;

use function is_array;

class Argument
{
/**
Expand Down Expand Up @@ -310,7 +312,10 @@ public function defaultValue()
*/
public function setDefaultValue($defaultValue)
{
$this->defaultValue = (array) $defaultValue;
if (!is_array($defaultValue)) {
$defaultValue = [$defaultValue];
}
$this->defaultValue = $defaultValue;
}

/**
Expand Down

0 comments on commit 0581d72

Please sign in to comment.