@@ -29,7 +29,7 @@ public static function isManBool(mixed $value): bool
2929 *
3030 * @return bool
3131 */
32- public static function isManFiniteFloat (mixed $ value ): bool
32+ public static function isManFloat (mixed $ value ): bool
3333 {
3434 switch (gettype ($ value ))
3535 {
@@ -60,13 +60,13 @@ public static function isManFiniteFloat(mixed $value): bool
6060
6161 //--------------------------------------------------------------------------------------------------------------------
6262 /**
63- * Returns whether a value is not null and can be cast to a float.
63+ * Returns whether a value is not null and can be cast to a float including NaN, -INF, and INF .
6464 *
6565 * @param mixed $value The value.
6666 *
6767 * @return bool
6868 */
69- public static function isManFloat (mixed $ value ): bool
69+ public static function isManFloatInclusive (mixed $ value ): bool
7070 {
7171 switch (gettype ($ value ))
7272 {
@@ -169,22 +169,22 @@ public static function isOptBool(mixed $value): bool
169169 *
170170 * @return bool
171171 */
172- public static function isOptFiniteFloat (mixed $ value ): bool
172+ public static function isOptFloat (mixed $ value ): bool
173173 {
174- return $ value ===null || static ::isManFiniteFloat ($ value );
174+ return $ value ===null || static ::isManFloat ($ value );
175175 }
176176
177177 //--------------------------------------------------------------------------------------------------------------------
178178 /**
179- * Returns whether a value is null or can be cast to a float.
179+ * Returns whether a value is null or can be cast to a float including NaN, -INF, and INF .
180180 *
181181 * @param mixed $value The value.
182182 *
183183 * @return bool
184184 */
185- public static function isOptFloat (mixed $ value ): bool
185+ public static function isOptFloatInclusive (mixed $ value ): bool
186186 {
187- return $ value ===null || static ::isManFloat ($ value );
187+ return $ value ===null || static ::isManFloatInclusive ($ value );
188188 }
189189
190190 //--------------------------------------------------------------------------------------------------------------------
@@ -255,7 +255,7 @@ public static function toManBool(mixed $value, ?bool $default = null): bool
255255 *
256256 * @throws InvalidCastException
257257 */
258- public static function toManFiniteFloat (mixed $ value , ?float $ default = null ): float
258+ public static function toManFloat (mixed $ value , ?float $ default = null ): float
259259 {
260260 if ($ value ===null && $ default !==null )
261261 {
@@ -267,7 +267,7 @@ public static function toManFiniteFloat(mixed $value, ?float $default = null): f
267267 return $ default ;
268268 }
269269
270- if (static ::isManFiniteFloat ($ value )===false )
270+ if (static ::isManFloat ($ value )===false )
271271 {
272272 throw new InvalidCastException ('Value can not be converted to finite float ' );
273273 }
@@ -277,7 +277,8 @@ public static function toManFiniteFloat(mixed $value, ?float $default = null): f
277277
278278 //--------------------------------------------------------------------------------------------------------------------
279279 /**
280- * Converts a value to a float. If the value can not be safely cast to a float throws an exception.
280+ * Converts a value to a float including NaN, -INF, and INF. If the value can not be safely cast to a float throws an
281+ * exception.
281282 *
282283 * @param mixed $value The value.
283284 * @param float|null $default The default value. If the value is null and the default is not null the default value
@@ -287,14 +288,14 @@ public static function toManFiniteFloat(mixed $value, ?float $default = null): f
287288 *
288289 * @throws InvalidCastException
289290 */
290- public static function toManFloat (mixed $ value , ?float $ default = null ): float
291+ public static function toManFloatInclusive (mixed $ value , ?float $ default = null ): float
291292 {
292293 if ($ value ===null && $ default !==null )
293294 {
294295 return $ default ;
295296 }
296297
297- if (static ::isManFloat ($ value )===false )
298+ if (static ::isManFloatInclusive ($ value )===false )
298299 {
299300 throw new InvalidCastException ('Value can not be converted to float ' );
300301 }
@@ -393,7 +394,7 @@ public static function toOptBool(mixed $value, ?bool $default = null): ?bool
393394 *
394395 * @return float|null
395396 */
396- public static function toOptFiniteFloat (mixed $ value , ?float $ default = null ): ?float
397+ public static function toOptFloat (mixed $ value , ?float $ default = null ): ?float
397398 {
398399 if ($ value ===null )
399400 {
@@ -405,26 +406,27 @@ public static function toOptFiniteFloat(mixed $value, ?float $default = null): ?
405406 return $ default ;
406407 }
407408
408- return static ::toManFiniteFloat ($ value );
409+ return static ::toManFloat ($ value );
409410 }
410411
411412 //--------------------------------------------------------------------------------------------------------------------
412413 /**
413- * Converts a value to a float. If the value can not be safely cast to a float throws an exception.
414+ * Converts a value to a float including NaN, -INF, and INF. If the value can not be safely cast to a float throws an
415+ * exception.
414416 *
415417 * @param mixed $value The value.
416418 * @param float|null $default The default value. If the value is null the default value will be returned.
417419 *
418420 * @return float|null
419421 */
420- public static function toOptFloat (mixed $ value , ?float $ default = null ): ?float
422+ public static function toOptFloatInclusive (mixed $ value , ?float $ default = null ): ?float
421423 {
422424 if ($ value ===null )
423425 {
424426 return $ default ;
425427 }
426428
427- return static ::toManFloat ($ value );
429+ return static ::toManFloatInclusive ($ value );
428430 }
429431
430432 //--------------------------------------------------------------------------------------------------------------------
0 commit comments