in src/configuration/ArcanistSettings.php [338:404]
public function willWriteValue($key, $value) {
$type = $this->getType($key);
switch ($type) {
case 'bool':
if (strtolower($value) === 'false' ||
strtolower($value) === 'no' ||
strtolower($value) === 'off' ||
$value === '' ||
$value === '0' ||
$value === 0 ||
$value === false) {
$value = false;
} else if (strtolower($value) === 'true' ||
strtolower($value) === 'yes' ||
strtolower($value) === 'on' ||
$value === '1' ||
$value === 1 ||
$value === true) {
$value = true;
} else {
throw new ArcanistUsageException(
pht(
"Type of setting '%s' must be boolean, like 'true' or 'false'.",
$key));
}
break;
case 'list':
if (is_array($value)) {
break;
}
if (is_string($value)) {
$list = json_decode($value, true);
if (is_array($list)) {
$value = $list;
break;
}
}
throw new ArcanistUsageException(
pht(
"Type of setting '%s' must be list. You can specify a list ".
"in JSON, like: %s",
$key,
'["apple", "banana", "cherry"]'));
case 'string':
if (!is_scalar($value)) {
throw new ArcanistUsageException(
pht(
"Type of setting '%s' must be string.",
$key));
}
$value = (string)$value;
break;
case 'wild':
break;
case 'aliases':
throw new Exception(
pht(
'Use "arc alias" to configure aliases, not "arc set-config".'));
break;
}
return $value;
}