You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I do agree that the sentence structure is strange. It reads: No non-x can be implicitly converted to x. which is equivalent to: No value can be implicitly converted to a value of type x.
The sentence All other conversions to type x must be explicit. could then be written as: Converting a value to a value of type x must be done explicitly.
The comment about needing an explicit conversion is correct though. function takes_bool(bool $b): void; can not be called with an int without an explicit conversion. takes_bool((bool) 0) or takes_bool(boolval(0)).
Implicit conversion from classname to string is an example where no explicit conversion is required.
In the section on boolean conversions:
https://docs.hhvm.com/hack/types/type-conversion#conversion-to-bool
The first sentence says "No non-bool type can be converted implicitly to bool. All other conversions must be explicit.".
But then the proceeds proceeds to give a long list of implicit conversions.
The text was updated successfully, but these errors were encountered: