Re: [RFC][Accepted] Scalar Type Declarations V0.5
| From: | Sebastian B.-Hagensen | Date: | Wed, 18 Mar 2015 22:46:27 +0000 |
| Subject: | Re: [RFC][Accepted] Scalar Type Declarations V0.5 | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-85204@lists.php.net to get a copy of this message | ||
Hi,
2015-03-18 20:42 GMT+01:00 Lazare Inepologlou <linepogl@gmail.com>:
> However, it seems that the second form is possible to fail, and that
> depends on the mode (strict or not) of the library that contains the
> function a. It does not depend on the mode that I have chosen to work with.
> The two closures will not work in the same way and that's a kind of a WTF
> moment.
If the library documents that it is passing an int or an intable value
in non-strict to the callback and it does not do so it has a bug. If
the library does not declare a type and you hint an int and it passes
something else, you created a bug. However, to work in a real code
base some discipline and clean documentation from the library author
is required. But I agree that this is currently fragile. Having a way
to hint a callables signature may not solve the issue , but make it
easier to catch and shift most, if not all, responsibility to the
library author.