summaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
Diffstat (limited to 'cli')
-rw-r--r--cli/CliOption.php4
-rw-r--r--cli/CliOptionsParser.php4
-rwxr-xr-xcli/create-user.php2
-rwxr-xr-xcli/reconfigure.php3
-rwxr-xr-xcli/update-user.php2
5 files changed, 9 insertions, 6 deletions
diff --git a/cli/CliOption.php b/cli/CliOption.php
index e92fbd804..129d0de03 100644
--- a/cli/CliOption.php
+++ b/cli/CliOption.php
@@ -5,6 +5,7 @@ final class CliOption {
public const VALUE_NONE = 'none';
public const VALUE_REQUIRED = 'required';
public const VALUE_OPTIONAL = 'optional';
+ /** @var 'none'|'required'|'optional' $valueTaken */
private string $valueTaken = self::VALUE_REQUIRED;
/** @var array{type:string,isArray:bool} $types */
private array $types = ['type' => 'string', 'isArray' => false];
@@ -61,6 +62,7 @@ final class CliOption {
return $this;
}
+ /** @return 'none'|'required'|'optional' */
public function getValueTaken(): string {
return $this->valueTaken;
}
@@ -94,6 +96,6 @@ final class CliOption {
$this->deprecatedAlias,
];
- return array_filter($aliases);
+ return array_filter($aliases, fn(?string $alias): bool => $alias !== null && trim($alias) !== '');
}
}
diff --git a/cli/CliOptionsParser.php b/cli/CliOptionsParser.php
index e1a697e35..9ef9e9f10 100644
--- a/cli/CliOptionsParser.php
+++ b/cli/CliOptionsParser.php
@@ -216,8 +216,8 @@ abstract class CliOptionsParser {
}
return [
- 'long' => array_filter($long),
- 'short' => $short
+ 'long' => array_filter($long, fn(string $v): bool => trim($v) !== ''),
+ 'short' => $short,
];
}
diff --git a/cli/create-user.php b/cli/create-user.php
index cbcc89ba4..0276e80b3 100755
--- a/cli/create-user.php
+++ b/cli/create-user.php
@@ -75,7 +75,7 @@ $values = [
'max_posts_per_rss' => $cliOptions->maxPostsPerRss ?? null,
];
-$values = array_filter($values);
+$values = array_filter($values, fn($v): bool => $v !== null && $v !== '');
$ok = FreshRSS_user_Controller::createUser(
$username,
diff --git a/cli/reconfigure.php b/cli/reconfigure.php
index ef86516f9..f2c86a8d4 100755
--- a/cli/reconfigure.php
+++ b/cli/reconfigure.php
@@ -113,7 +113,8 @@ foreach ($values as $name => $value) {
}
}
-$db = array_merge(FreshRSS_Context::systemConf()->db, array_filter($dbValues));
+$db = array_merge(FreshRSS_Context::systemConf()->db,
+ array_filter($dbValues, fn(?string $v): bool => $v !== null && trim($v) !== ''));
performRequirementCheck($db['type']);
diff --git a/cli/update-user.php b/cli/update-user.php
index 946f296fa..7e50503b9 100755
--- a/cli/update-user.php
+++ b/cli/update-user.php
@@ -66,7 +66,7 @@ $values = [
'max_posts_per_rss' => $cliOptions->maxPostsPerRss ?? null,
];
-$values = array_filter($values);
+$values = array_filter($values, fn($value): bool => $value !== null && $value !== '');
$ok = FreshRSS_user_Controller::updateUser(
$username,