Hi,

> One thing is clear is that "strict types" may be a bit of poor word
> choice and gives people a false sense of security that it is "safe" or
> "more correct" when this obviously isn't true. Thus, I'd like to
> propose, for PHP 9, simply renaming it from strict_types to
> scalar_type_coercion and flipping the value:
> 
> <?php declare(strict_types=1);
> 
> to
> 
> <?php declare(scalar_type_coercion=0);

This not better. Even with `declare(scalar_type_coercion=0)`, there will be 
scalar type conversions between string and int/float when you add numeric 
strings or when you concatenate a string with an int.

IMO, the real problem with the current name, is that there is no clue that this 
directive is specifically about arguments and return values in function/method 
calls.

> Perhaps it might even be worth adding a secondary vote to flip the
> default, such that if you want to "old" behavior back:
> 
> <?php declare(scalar_type_coercion=1);

That would force to edit thousands of files, ... for exactly zero gain. Have 
you heard about the Red Queen's race?

Moreover, there are many places where it is not possible to add such a 
declaration. For instance, `array_map(...)`, etc., always use `strict_types=0` 
when invoking the callback. Changing that would also be a big BC break.

—Claude

Reply via email to