You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Results in the following warning: "Expected parameter of type '\Closure|null', 'int' provided"
An integer is valid here, as per the definition:
/** * Retrieve an item from the cache by key. * * @template TCacheValue * * @param array|string $key * @param TCacheValue|(\Closure(): TCacheValue) $default * @return (TCacheValue is null ? mixed : TCacheValue) */publicfunctionget($key, $default = null): mixed
{
if (is_array($key)) {
return$this->many($key);
}
$this->event(newRetrievingKey($this->getName(), $key));
$value = $this->store->get($this->itemKey($key));
// If we could not find the cache value, we will fire the missed event and get// the default value for this cache value. This default could be a callback// so we will execute the value function which will resolve it if needed.if (is_null($value)) {
$this->event(newCacheMissed($this->getName(), $key));
$value = value($default);
} else {
$this->event(newCacheHit($this->getName(), $key, $value));
}
return$value;
}
Noting specifically:
$value = value($default);
Which when passed an int, will just return the int
/** * Return the default value of the given value. * * @template TValue * @template TArgs * * @param TValue|\Closure(TArgs): TValue $value * @param TArgs ...$args * @return TValue */functionvalue($value, ...$args)
{
return$valueinstanceof Closure ? $value(...$args) : $value;
}
Plugin version
8.3.3.242
Operating system
MacOS
Steps to reproduce
Make use of the Cache facade's get method, and set the default to an integer
Cache::get('foo', 1);
Relevant log output
No response
The text was updated successfully, but these errors were encountered:
Bug description
Hey, appreciate the work on the plugin.
The following code:
Results in the following warning: "Expected parameter of type '\Closure|null', 'int' provided"
An integer is valid here, as per the definition:
Noting specifically:
Which when passed an int, will just return the int
Plugin version
8.3.3.242
Operating system
MacOS
Steps to reproduce
Make use of the Cache facade's get method, and set the default to an integer
Relevant log output
No response
The text was updated successfully, but these errors were encountered: