Re: Nullable types and strict type-hinting with default null value
| From: | Rowan Collins | Date: | Thu, 23 Feb 2017 13:50:25 +0000 |
| Subject: | Re: Nullable types and strict type-hinting with default null value | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-98346@lists.php.net to get a copy of this message | ||
On 23 February 2017 09:15:27 GMT+00:00, "Michał" <aaatoja@o2.pl> wrote:
>And what about situation when someone is forcing
>declare(strict_types=1)? I think, it's really a good place to force
>proper types. Including nulls.
strict_types controls the behaviour of *calling* functions, but the check here would have to be when
*defining* the function: it would give an error that the function definition is invalid, like if you
say function foo(int $bar='hello')
Unless you had some other behaviour in mind?
Regards,
--
Rowan Collins
[IMSoP]