diff --git a/app/Console/Commands/DeviceAdd.php b/app/Console/Commands/DeviceAdd.php index 06f07f828d..40f9c95bb5 100644 --- a/app/Console/Commands/DeviceAdd.php +++ b/app/Console/Commands/DeviceAdd.php @@ -65,11 +65,11 @@ class DeviceAdd extends LnmsCommand $this->addOption('port', 'r', InputOption::VALUE_REQUIRED); $this->addOption('transport', 't', InputOption::VALUE_REQUIRED); $this->addOption('display-name', 'd', InputOption::VALUE_REQUIRED); - $this->addOption('security-name', 'u', InputOption::VALUE_REQUIRED, null, 'root'); + $this->addOption('security-name', 'u', InputOption::VALUE_REQUIRED, '', 'root'); $this->addOption('auth-password', 'A', InputOption::VALUE_REQUIRED); - $this->addOption('auth-protocol', 'a', InputOption::VALUE_REQUIRED, null, 'MD5'); + $this->addOption('auth-protocol', 'a', InputOption::VALUE_REQUIRED, '', 'MD5'); $this->addOption('privacy-password', 'X', InputOption::VALUE_REQUIRED); - $this->addOption('privacy-protocol', 'x', InputOption::VALUE_REQUIRED, null, 'AES'); + $this->addOption('privacy-protocol', 'x', InputOption::VALUE_REQUIRED, '', 'AES'); $this->addOption('force', 'f', InputOption::VALUE_NONE); $this->addOption('ping-fallback', 'b', InputOption::VALUE_NONE); $this->addOption('poller-group', 'g', InputOption::VALUE_REQUIRED); diff --git a/app/Console/Commands/SnmpFetch.php b/app/Console/Commands/SnmpFetch.php index 57f04daacc..3c3e8c725d 100644 --- a/app/Console/Commands/SnmpFetch.php +++ b/app/Console/Commands/SnmpFetch.php @@ -27,7 +27,7 @@ class SnmpFetch extends LnmsCommand $this->addArgument('oid', InputArgument::REQUIRED); $this->addOption('type', 't', InputOption::VALUE_REQUIRED, trans('commands.snmp:fetch.options.type', ['types' => '[get, walk, next, translate]']), 'get'); $this->addOption('output', 'o', InputOption::VALUE_REQUIRED, trans('commands.snmp:fetch.options.output', ['formats' => '[value, values, table]'])); - $this->addOption('depth', 'd', InputOption::VALUE_REQUIRED, null, 1); + $this->addOption('depth', 'd', InputOption::VALUE_REQUIRED, '', 1); $this->addOption('numeric', 'i', InputOption::VALUE_NONE); } diff --git a/app/Console/DynamicInputOption.php b/app/Console/DynamicInputOption.php index f4fa6c6cc1..84fc43b12c 100644 --- a/app/Console/DynamicInputOption.php +++ b/app/Console/DynamicInputOption.php @@ -42,7 +42,7 @@ class DynamicInputOption extends InputOption parent::__construct($name, $shortcut, $mode, $description, $default); } - public function getDescription() + public function getDescription(): string { $description = parent::getDescription(); @@ -53,7 +53,7 @@ class DynamicInputOption extends InputOption return $description; } - public function getDefault() + public function getDefault(): array|string|int|float|bool|null { if (is_callable($this->defaultCallable)) { return call_user_func($this->defaultCallable); diff --git a/app/Console/LnmsCommand.php b/app/Console/LnmsCommand.php index 62d4970e57..4bd543e907 100644 --- a/app/Console/LnmsCommand.php +++ b/app/Console/LnmsCommand.php @@ -71,7 +71,7 @@ abstract class LnmsCommand extends Command * * @throws InvalidArgumentException When argument mode is not valid */ - public function addArgument($name, $mode = null, $description = null, $default = null) + public function addArgument(string $name, ?int $mode = null, string $description = '', mixed $default = null): static { // use a generated translation location by default if (is_null($description)) { @@ -96,7 +96,7 @@ abstract class LnmsCommand extends Command * * @throws InvalidArgumentException If option mode is invalid or incompatible */ - public function addOption($name, $shortcut = null, $mode = null, $description = null, $default = null) + public function addOption(string $name, array|string|null $shortcut = null, ?int $mode = null, string $description = '', mixed $default = null): static { // use a generated translation location by default if (is_null($description)) {