Re: [RFC] Strict operators directive
| From: | Benjamin Morel | Date: | Wed, 26 Jun 2019 12:15:51 +0000 |
| Subject: | Re: [RFC] Strict operators directive | ||
| References: | 1 2 3 4 5 6 7 8 9 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-106075@lists.php.net to get a copy of this message | ||
>
> Given that we already have === and !==, could the strict mode simply throw
> an error for *any* use of the non-strict == and != versions?
> declare(strict_operators=1);
> var_dump( "11" == "11.0" ); # TypeError: "Cannot use non-strict
> equality
> operator in strict operator mode."
> var_dump( "11" === "11.0"); # bool(false)
> I'm not sure whether I like the idea or not, but I thought I'd throw it out
> there as a possibility.
That's definitely a possibility, that I'm sure a lot of people will dislike.
I personally don't have a strong opinion about it.
Ben