first argument of option() function is required

This commit is contained in:
Pig Fang 2023-01-25 11:45:33 +08:00
parent 63b828d46b
commit 82dd87703f
No known key found for this signature in database
GPG Key ID: A8198F548DADA9E2
2 changed files with 1 additions and 12 deletions

View File

@ -52,21 +52,11 @@ if (!function_exists('option')) {
* Get / set the specified option value.
*
* If an array is passed as the key, we will assume you want to set an array of values.
*
* @param array|string $key
* @param mixed $default
* @param bool $raw return raw value without convertion
*
* @return mixed
*/
function option($key = null, $default = null, $raw = false)
function option(string|array $key, mixed $default = null, bool $raw = false)
{
$options = app('options');
if (is_null($key)) {
return $options;
}
if (is_array($key)) {
$options->set($key);

View File

@ -14,7 +14,6 @@ class OptionTest extends TestCase
$options = resolve(Option::class);
$options->set('k1', '(null)');
$this->assertNull($options->get('k1'));
$this->assertNull(option()->get('k1'));
}
public function testSet()