Re: [VOTE] Scalar Type Hints
| From: | Andrea Faulds | Date: | Sun, 08 Feb 2015 02:55:16 +0000 |
| Subject: | Re: [VOTE] Scalar Type Hints | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-82110@lists.php.net to get a copy of this message | ||
Hi,
> On 8 Feb 2015, at 02:51, Andrea Faulds <ajf@ajf.me> wrote:
>
> Yes, the RFC is somewhat inaccurate in that respect. It is per-file in one sense (like
> encoding, but unlike ticks, it has no effect on the including or included files). However, it
> technically affects the remainder of the file, not the whole file.
A minor follow-up: the RFC does actually mention this specific point about declare()’s behaviour:
> By default, all PHP files are in weak type-checking mode. A new declare() directive is added,
> strict_types, which takes either 1 or 0. If 1, strict type-checking mode is used for function calls
> and return statements in the remainder of the file. If 0, weak type-checking mode is used.
>
> This directive also supports the declare() block syntax (e.g. declare(strict_types=1) { foo();
> }), in which case it will only affect function calls and return statements within the block.
--
Andrea Faulds
http://ajf.me/