I think the patch already does it (may be not for all magic methods).

Thanks. Dmitry.

On Thu, Oct 16, 2014 at 2:58 PM, Andrea Faulds <a...@ajf.me> wrote:

>
> On 16 Oct 2014, at 05:39, Levi Morrison <levi_morri...@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/
>
>
>
>
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Reply via email to