Re: Renaming "strict types" to "scalar type coercion"
| From: | Rowan Tommins [IMSoP] | Date: | Wed, 19 Jun 2024 22:40:38 +0000 |
| Subject: | Re: Renaming "strict types" to "scalar type coercion" | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-123689@lists.php.net to get a copy of this message | ||
On 19/06/2024 09:30, Robert Landers wrote:
Essentially, an int could become a float (within some limits), but a float can only become an int if it is an int itself. The same concept of a string, where "123test" couldn't become a number because "test" would be lost.Both of these are already covered, at least as far as parameter/return types, which is what "strict_types" controls... '123test' is rejected, not coerced to int, as of 8.0: https://3v4l.org/nvbML Losing precision on a float-to-int is deprecated, so will presumably error as of 9.0: https://3v4l.org/vvD2e -- Rowan Tommins [IMSoP]