Skip to content

Commit 2a2c335

Browse files
author
fureev
committed
fix: instance
1 parent f4074a6 commit 2a2c335

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/Global/base.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
/**
99
* Return the default value of the given value.
1010
*/
11-
function value(mixed $value, mixed ...$args): mixed
11+
function value(mixed $value, mixed ...$params): mixed
1212
{
1313
return $value instanceof Closure || (is_object($value) && is_callable($value))
14-
? $value(...$args)
14+
? $value(...$params)
1515
: $value;
1616
}
1717
}
@@ -151,6 +151,13 @@ function isTrue(mixed $val, bool $return_null = false): ?bool
151151
}
152152

153153
if (!function_exists('instance')) {
154+
/**
155+
* @phpstan-param T|class-string<T>|null $instance
156+
* @param mixed ...$params
157+
* @phpstan-return T|null
158+
*
159+
* @template T as object
160+
*/
154161
function instance(string|object|null $instance, mixed ...$params): ?object
155162
{
156163
if (is_object($instance)) {

0 commit comments

Comments
 (0)