> Le 9 juil. 2019 à 12:09, Andreas Heigl <andr...@heigl.org> a écrit :
> 
> 
> 
> Am 09.07.19 um 12:06 schrieb Christian Schneider:
>> Am 09.07.2019 um 11:30 schrieb Marco Pivetta <ocram...@gmail.com>:
>>> I wasn't sure about the full implications of this, but after some thought,
>>> the worst that can happen is excessive strictness, requiring to drop a
>>> single declaration on top of a file 👍
>> 
>> When you drop the declaration on top of the file the semantics of your 
>> operators suddenly change, e.g.
>>      "42" < "7"
>> changes from true to false and you get subtle bugs.
>> 
>> And if you try to read other people's code (or even try to copy/paste it) 
>> then make sure you keep in mind which mode they are programming in.
> 
> But that's the same for `declare(strict_types=1);`
> 
> Cheers
> 
> Andreas

No, it’s not the same thing as declare(strict_types=1).

With declare(strict_types=1), you just get additional TypeErrors. It will not 
actually change the semantics of code that works in both non-strict-types mode 
and strict-types mode. This is a useful feature when refactoring legacy code.

The worst thing that can happen with declare(strict_types=1), is that code 
won’t work any more.

The worst thing that can happen with declare(strict_operators=1), is that code 
will change semantics.

—Claude
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to