Re: RFC: Return Types Update
| From: | Andrea Faulds | Date: | Thu, 16 Oct 2014 10:58:23 +0000 |
| Subject: | Re: RFC: Return Types Update | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-78110@lists.php.net to get a copy of this message | ||
On 16 Oct 2014, at 05:39, Levi Morrison <levi_morrison@byu.edu> wrote:
> - There is a new section about disallowing return types on certain methods[4].
Perhaps, along the same lines, we could error if you use a nonsensical type hint for magic methods?
For example, allow this:
class FooBar {
public function __debugInfo(): array {
return [’test’];
}
}
But not this:
class FooBar {
public function __debugInfo(): callable {
return [’test’];
}
}
It’s not strictly necessary, but it would catch out bugs at “compile-time” (i.e. script
startup) rather than call-time.
--
Andrea Faulds
http://ajf.me/