Re: RFC: Return Types Update

From: Date: Thu, 16 Oct 2014 13:52:14 +0000
Subject: Re: RFC: Return Types Update
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-78113@lists.php.net to get a copy of this message
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 <ajf@ajf.me> wrote: > > 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/ > > > > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.internals (#78113) next »