Re: [RFC] Callable Types

From: Date: Sat, 23 Apr 2016 07:46:38 +0000
Subject: Re: [RFC] Callable Types
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-92651@lists.php.net to get a copy of this message
This is great. The gaps in PHP's type annotations are slowly being filled. :) Are the rules for compatibility between callables the same rules for compatibility between methods in classes/interfaces? Because presently, this is allowed: interface Test { public function testMethod(); } function foo1(Test $x) { } foo1(new class implements Test { public function testMethod(int $extraParam = 0) { } }); but, according to the RFC, this would not be: function foo2(callable():void $x) { } foo2(function (int $extraParam = 0) { }); I don't see why they should be different. I also didn't see anything mentioning reference parameters/returns. I assume it just follows the rules for method compatibility? On Fri, Apr 22, 2016 at 2:12 PM, Marcio Almada <marcio.web2@gmail.com> wrote: > Hello everyone, > > We just completed the draft for the "Callable Types" RFC. This RFC has been > recently mentioned during other type related threads on this mailing list, > so it feels to be the right time to put the proposal in context: > > The proposal is at https://wiki.php.net/rfc/callable-types > > The W.I.P patch is available for testing through > http://3v4l.org under the > RFC tab. > > We count with your detailed feedback and insights. Let's have a nice, > respectful and > constructive conversation about the RFC and work on possible improvements! > > Thanks > Nikita Nefedov > Márcio Almada >

« previous php.internals (#92651) next »