private $description;
/**
- * Constructor.
- *
- * @param string $name The option name
- * @param string|array $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts
- * @param int $mode The option mode: One of the VALUE_* constants
- * @param string $description A description text
- * @param mixed $default The default value (must be null for self::VALUE_NONE)
+ * @param string $name The option name
+ * @param string|array $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts
+ * @param int|null $mode The option mode: One of the VALUE_* constants
+ * @param string $description A description text
+ * @param string|string[]|int|bool|null $default The default value (must be null for self::VALUE_NONE)
*
* @throws InvalidArgumentException If option mode is invalid or incompatible
*/
}
if (null !== $shortcut) {
- if (is_array($shortcut)) {
+ if (\is_array($shortcut)) {
$shortcut = implode('|', $shortcut);
}
$shortcuts = preg_split('{(\|)-?}', ltrim($shortcut, '-'));
if (null === $mode) {
$mode = self::VALUE_NONE;
- } elseif (!is_int($mode) || $mode > 15 || $mode < 1) {
+ } elseif (!\is_int($mode) || $mode > 15 || $mode < 1) {
throw new InvalidArgumentException(sprintf('Option mode "%s" is not valid.', $mode));
}
/**
* Sets the default value.
*
- * @param mixed $default The default value
+ * @param string|string[]|int|bool|null $default The default value
*
* @throws LogicException When incorrect default value is given
*/
if ($this->isArray()) {
if (null === $default) {
$default = array();
- } elseif (!is_array($default)) {
+ } elseif (!\is_array($default)) {
throw new LogicException('A default value for an array option must be an array.');
}
}
/**
* Returns the default value.
*
- * @return mixed The default value
+ * @return string|string[]|int|bool|null The default value
*/
public function getDefault()
{
/**
* Checks whether the given option equals this one.
*
- * @param InputOption $option option to compare
- *
* @return bool
*/
- public function equals(InputOption $option)
+ public function equals(self $option)
{
return $option->getName() === $this->getName()
&& $option->getShortcut() === $this->getShortcut()