@@ -18,7 +18,7 @@ class TypedConfig
1818 *
1919 * @var Config
2020 */
21- private $ config ;
21+ private Config $ config ;
2222
2323 //--------------------------------------------------------------------------------------------------------------------
2424 /**
@@ -41,7 +41,7 @@ public function __construct(Config $config)
4141 *
4242 * @return TypedConfigException
4343 */
44- private static function createException (string $ key , string $ type , $ value ): TypedConfigException
44+ private static function createException (string $ key , string $ type , mixed $ value ): TypedConfigException
4545 {
4646 return new TypedConfigException ($ key , $ type , $ value );
4747 }
@@ -114,12 +114,12 @@ public function getManBool(string $key, ?bool $default = null): bool
114114 *
115115 * @throws TypedConfigException
116116 */
117- public function getManFiniteFloat (string $ key , ?float $ default = null ): float
117+ public function getManFloat (string $ key , ?float $ default = null ): float
118118 {
119119 $ value = $ this ->config ->get ($ key , $ default );
120120 try
121121 {
122- return Cast::toManFiniteFloat ($ value );
122+ return Cast::toManFloat ($ value );
123123 }
124124 catch (InvalidCastException $ exception )
125125 {
@@ -129,7 +129,7 @@ public function getManFiniteFloat(string $key, ?float $default = null): float
129129
130130 //--------------------------------------------------------------------------------------------------------------------
131131 /**
132- * Returns the value of a mandatory float configuration setting.
132+ * Returns the value of a mandatory float including NaN, -INF, and INF configuration setting.
133133 *
134134 * @param string $key The key of the configuration setting. The key might be nested using dot notation.
135135 * @param float|null $default The default value.
@@ -138,16 +138,16 @@ public function getManFiniteFloat(string $key, ?float $default = null): float
138138 *
139139 * @throws TypedConfigException
140140 */
141- public function getManFloat (string $ key , ?float $ default = null ): float
141+ public function getManFloatInclusive (string $ key , ?float $ default = null ): float
142142 {
143143 $ value = $ this ->config ->get ($ key , $ default );
144144 try
145145 {
146- return Cast::toManFloat ($ value );
146+ return Cast::toManFloatInclusive ($ value );
147147 }
148148 catch (InvalidCastException $ exception )
149149 {
150- throw self ::createException ($ key , 'float ' , $ value );
150+ throw self ::createException ($ key , 'float inclusive ' , $ value );
151151 }
152152 }
153153
@@ -256,12 +256,12 @@ public function getOptBool(string $key, ?bool $default = null): ?bool
256256 *
257257 * @throws TypedConfigException
258258 */
259- public function getOptFiniteFloat (string $ key , ?float $ default = null ): ?float
259+ public function getOptFloat (string $ key , ?float $ default = null ): ?float
260260 {
261261 $ value = $ this ->config ->get ($ key , $ default );
262262 try
263263 {
264- return Cast::toOptFiniteFloat ($ value );
264+ return Cast::toOptFloat ($ value );
265265 }
266266 catch (InvalidCastException $ exception )
267267 {
@@ -271,7 +271,7 @@ public function getOptFiniteFloat(string $key, ?float $default = null): ?float
271271
272272 //--------------------------------------------------------------------------------------------------------------------
273273 /**
274- * Returns the value of an optional float configuration setting.
274+ * Returns the value of an optional float including NaN, -INF, and INF configuration setting.
275275 *
276276 * @param string $key The key of the configuration setting. The key might be nested using dot notation.
277277 * @param float|null $default The default value.
@@ -280,16 +280,16 @@ public function getOptFiniteFloat(string $key, ?float $default = null): ?float
280280 *
281281 * @throws TypedConfigException
282282 */
283- public function getOptFloat (string $ key , ?float $ default = null ): ?float
283+ public function getOptFloatInclusive (string $ key , ?float $ default = null ): ?float
284284 {
285285 $ value = $ this ->config ->get ($ key , $ default );
286286 try
287287 {
288- return Cast::toOptFloat ($ value );
288+ return Cast::toOptFloatInclusive ($ value );
289289 }
290290 catch (InvalidCastException $ exception )
291291 {
292- throw self ::createException ($ key , 'float ' , $ value );
292+ throw self ::createException ($ key , 'float inclusive ' , $ value );
293293 }
294294 }
295295
0 commit comments