File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -24,15 +24,15 @@ isTruthy = getBool . castToBool
24
24
where getBool (PHPBool b) = b
25
25
26
26
castToInt :: PHPValue -> PHPValue
27
- castToInt (PHPString _ ) = error " string to int behavior is not implemented "
27
+ castToInt (PHPString a ) = PHPInt $ read a :: PHPValue
28
28
castToInt a@ (PHPInt _) = a
29
29
castToInt (PHPFloat a) = PHPInt $ floor a
30
30
castToInt (PHPBool a) | a == True = PHPInt 1
31
31
| a == False = PHPInt 0
32
32
castToInt PHPNull = PHPInt 0
33
33
34
34
castToFloat :: PHPValue -> PHPValue
35
- castToFloat (PHPString _ ) = error " undefined behavior for string to float "
35
+ castToFloat (PHPString a ) = PHPFloat $ read a :: PHPValue
36
36
castToFloat (PHPInt a) = PHPFloat $ fromInteger a
37
37
castToFloat a@ (PHPFloat _) = a
38
38
castToFloat PHPNull = PHPFloat 0
You can’t perform that action at this time.
0 commit comments