mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 21:04:52 +08:00
Fix missing optional warning
This commit is contained in:
parent
8143b1d768
commit
92483cf188
@ -166,6 +166,8 @@ class ConfigValidator
|
|||||||
// check libs
|
// check libs
|
||||||
if (isset($craft['libs']) && is_string($craft['libs'])) {
|
if (isset($craft['libs']) && is_string($craft['libs'])) {
|
||||||
$craft['libs'] = array_filter(array_map(fn ($x) => trim($x), explode(',', $craft['libs'])));
|
$craft['libs'] = array_filter(array_map(fn ($x) => trim($x), explode(',', $craft['libs'])));
|
||||||
|
} elseif (!isset($craft['libs'])) {
|
||||||
|
$craft['libs'] = [];
|
||||||
}
|
}
|
||||||
// check sapi
|
// check sapi
|
||||||
if (!isset($craft['sapi'])) {
|
if (!isset($craft['sapi'])) {
|
||||||
@ -177,6 +179,8 @@ class ConfigValidator
|
|||||||
// debug as boolean
|
// debug as boolean
|
||||||
if (isset($craft['debug'])) {
|
if (isset($craft['debug'])) {
|
||||||
$craft['debug'] = filter_var($craft['debug'], FILTER_VALIDATE_BOOLEAN);
|
$craft['debug'] = filter_var($craft['debug'], FILTER_VALIDATE_BOOLEAN);
|
||||||
|
} else {
|
||||||
|
$craft['debug'] = false;
|
||||||
}
|
}
|
||||||
// check clean-build
|
// check clean-build
|
||||||
$craft['clean-build'] ??= false;
|
$craft['clean-build'] ??= false;
|
||||||
@ -194,6 +198,8 @@ class ConfigValidator
|
|||||||
throw new ValidationException("Craft file build-options {$key} must be an array");
|
throw new ValidationException("Craft file build-options {$key} must be an array");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$craft['build-options'] = [];
|
||||||
}
|
}
|
||||||
// check download options
|
// check download options
|
||||||
if (isset($craft['download-options'])) {
|
if (isset($craft['download-options'])) {
|
||||||
@ -209,12 +215,16 @@ class ConfigValidator
|
|||||||
throw new ValidationException("Craft file download-options {$key} must be an array");
|
throw new ValidationException("Craft file download-options {$key} must be an array");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$craft['download-options'] = [];
|
||||||
}
|
}
|
||||||
// check extra-env
|
// check extra-env
|
||||||
if (isset($craft['extra-env'])) {
|
if (isset($craft['extra-env'])) {
|
||||||
if (!is_assoc_array($craft['extra-env'])) {
|
if (!is_assoc_array($craft['extra-env'])) {
|
||||||
throw new ValidationException('Craft file extra-env must be an object');
|
throw new ValidationException('Craft file extra-env must be an object');
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$craft['extra-env'] = [];
|
||||||
}
|
}
|
||||||
// check craft-options
|
// check craft-options
|
||||||
$craft['craft-options']['doctor'] ??= true;
|
$craft['craft-options']['doctor'] ??= true;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user