Skip to content

Commit 3929279

Browse files
committed
Updated some functions to support integers and floats instead of only floats
1 parent 8a61984 commit 3929279

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/procedure/DefaultScope.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -147,35 +147,35 @@ public static function sqrtFunc(float $arg): float {
147147
return sqrt($arg);
148148
}
149149

150-
public static function ceilFunc(float $value): float {
150+
public static function ceilFunc(int|float $value): float {
151151
return ceil($value);
152152
}
153153

154-
public static function floorFunc(float $value): float {
154+
public static function floorFunc(int|float $value): float {
155155
return floor($value);
156156
}
157157

158158
public static function roundFunc(int|float $num, int $precision = 0): float {
159159
return round($num, $precision);
160160
}
161161

162-
public static function sinFunc(float $arg): float {
162+
public static function sinFunc(int|float $arg): float {
163163
return sin($arg);
164164
}
165165

166-
public static function cosFunc(float $arg): float {
166+
public static function cosFunc(int|float $arg): float {
167167
return cos($arg);
168168
}
169169

170-
public static function tanFunc(float $arg): float {
170+
public static function tanFunc(int|float $arg): float {
171171
return tan($arg);
172172
}
173173

174-
public static function is_nanFunc(float $val): bool {
174+
public static function is_nanFunc(int|float $val): bool {
175175
return is_nan($val);
176176
}
177177

178-
public static function absFunc(float $number): float {
178+
public static function absFunc(int|float $number): float {
179179
return abs($number);
180180
}
181181

@@ -187,7 +187,7 @@ public static function sizeofFunc(mixed ...$values): int {
187187
return count(DefaultScope::mergeArraysRecursive($values));
188188
}
189189

190-
public static function inRangeFunc(float $value, float $min, float $max): bool {
190+
public static function inRangeFunc(float|int $value, float|int $min, float|int $max): bool {
191191
return ($min <= $value) && ($value <= $max);
192192
}
193193

@@ -213,7 +213,7 @@ public static function lastOrNullFunc(array $array): mixed {
213213
return end($array);
214214
}
215215

216-
public static function sumFunc(float|array ...$values): float {
216+
public static function sumFunc(float|int|array ...$values): float {
217217
$arr = DefaultScope::mergeArraysRecursive($values);
218218
$res = 0;
219219
foreach ($arr as $value) {
@@ -225,7 +225,7 @@ public static function sumFunc(float|array ...$values): float {
225225
return $res;
226226
}
227227

228-
public static function avgFunc(float|array ...$values): float {
228+
public static function avgFunc(float|int|array ...$values): float {
229229
$sum = self::sumFunc($values);
230230
return $sum / self::sizeofFunc($values);
231231
}

0 commit comments

Comments
 (0)