Skip to content

Commit 7fa955d

Browse files
committed
Use mixed type only for PHP >= 8
1 parent 44ff763 commit 7fa955d

1 file changed

Lines changed: 33 additions & 12 deletions

File tree

src/Php86/bootstrap.php

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,37 @@
1616
}
1717

1818
if (!function_exists('clamp')) {
19-
/**
20-
* @template V
21-
* @template L
22-
* @template H
23-
*
24-
* @param V $value
25-
* @param L $min
26-
* @param H $max
27-
*
28-
* @return V|L|H
29-
*/
30-
function clamp(mixed $value, mixed $min, mixed $max): mixed { return p\Php86::clamp($value, $min, $max); }
19+
if (\PHP_VERSION_ID >= 80000) {
20+
/**
21+
* @template V
22+
* @template L
23+
* @template H
24+
*
25+
* @param V $value
26+
* @param L $min
27+
* @param H $max
28+
*
29+
* @return V|L|H
30+
*/
31+
function clamp(mixed $value, mixed $min, mixed $max): mixed
32+
{
33+
return p\Php86::clamp($value, $min, $max);
34+
}
35+
} else {
36+
/**
37+
* @template V
38+
* @template L
39+
* @template H
40+
*
41+
* @param V $value
42+
* @param L $min
43+
* @param H $max
44+
*
45+
* @return V|L|H
46+
*/
47+
function clamp($value, $min, $max)
48+
{
49+
return p\Php86::clamp($value, $min, $max);
50+
}
51+
}
3152
}

0 commit comments

Comments
 (0)