Re: [PHP-DEV] Closures and type hinting

2012-10-13 Thread Christian Kaps
Hi Now if you pass a closure to the scan method which doesn't follow the signature of the __invoke method, the engine should throw an error. What do you think? You are trying to take typing way beyond what PHP (or probably any mainstream dynamic language that exists now) provides. There are

Re: [PHP-DEV] Closures and type hinting

2012-10-13 Thread Christian Kaps
Am 12.10.2012 23:06, schrieb Nikita Popov: On Fri, Oct 12, 2012 at 10:58 AM, Christian Kaps christian.k...@mohiva.com wrote: At the moment it isn't possible to restrict/define the arguments for a closure which is defined as parameter for a method. Please look at this small example. interface

[PHP-DEV] Closures and type hinting

2012-10-12 Thread Christian Kaps
At the moment it isn't possible to restrict/define the arguments for a closure which is defined as parameter for a method. Please look at this small example. interface Broker { public function scan(Request $request, Closure $onFound); } An implementation of the interface could be as

Re: [PHP-DEV] Closures and type hinting

2012-10-12 Thread Anthony Ferrara
On Oct 12, 2012 10:59 AM, Christian Kaps christian.k...@mohiva.com wrote: At the moment it isn't possible to restrict/define the arguments for a closure which is defined as parameter for a method. Please look at this small example. interface Broker { public function scan(Request

Re: [PHP-DEV] Closures and type hinting

2012-10-12 Thread Stas Malyshev
Hi! Now if you pass a closure to the scan method which doesn't follow the signature of the __invoke method, the engine should throw an error. What do you think? You are trying to take typing way beyond what PHP (or probably any mainstream dynamic language that exists now) provides. There

Re: [PHP-DEV] Closures and type hinting

2012-10-12 Thread Nikita Popov
On Fri, Oct 12, 2012 at 10:58 AM, Christian Kaps christian.k...@mohiva.com wrote: At the moment it isn't possible to restrict/define the arguments for a closure which is defined as parameter for a method. Please look at this small example. interface Broker { public function scan(Request