Re: About declare(strict_types = 1)
| From: | Yasuo Ohgaki | Date: | Tue, 17 Mar 2015 00:44:09 +0000 |
| Subject: | Re: About declare(strict_types = 1) | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-85108@lists.php.net to get a copy of this message | ||
Hi Mike,
On Tue, Mar 17, 2015 at 5:03 AM, Mike Willbanks <pencap@gmail.com> wrote:
> Let see how it looks if "strict_types" is renamed to "raise_type_error"
>>
>> <?php
>> declare(raise_type_error = 1);
>> function foo(int $a) {
>> // no function call here
>> }
>> ?>
>> The declare here does just nothing.
>>
>> <?php
>> require "lib.php";
>> foo("123"); // will work
>> ?>
>>
>> <?php
>> declare(raise_type_error = 1);
>> require "lib.php";
>> foo("123"); // will give an error
>> ?>
>>
>> Is everyone feel OK with this??
>>
>
>
> That seems far more odd in my opinion. I vastly prefer the first.
>
The name implies what it does.
The reason you think this is odd is because the behavior is odd.
Regards,
--
Yasuo Ohgaki
yohgaki@ohgaki.net