Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:53210 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 67570 invoked from network); 8 Jun 2011 13:31:30 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 Jun 2011 13:31:30 -0000 Authentication-Results: pb1.pair.com header.from=ircmaxell@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=ircmaxell@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.160.42 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: ircmaxell@gmail.com X-Host-Fingerprint: 209.85.160.42 mail-pw0-f42.google.com Received: from [209.85.160.42] ([209.85.160.42:51354] helo=mail-pw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 11/92-48516-1B97FED4 for ; Wed, 08 Jun 2011 09:31:29 -0400 Received: by pwj3 with SMTP id 3so258032pwj.29 for ; Wed, 08 Jun 2011 06:31:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=1ya18RorT0cWfAnsjeJvom8lFCOqT5OlyVYtcd74ibI=; b=AP3g4ggFpz0KzkknwAZAbgKdKd9EJRJz6oJVASB5HpssyxzpZ/ULzqCvuHvcv70qHi DJCGuvfgZD+v6HCOhCwlS+gAn9VYpyzuhu+UvUXavGwR5h3vqg4v52IsB0rJSyzBS2cr gfUrFU5951urGl8OJDDiLyxW1Wf+6xNPzqP2k= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=TGioRiXODtcROSXFxxPwO0lWHD3VQgFz7wRhlz4DWuNhke5CCNap+BUo1v781mHHD4 LW44p/gpbjDwLrdPr/t3GmAoQiHRc+zfqlozzAa9TCC/KgPZE72zhmUN2pGR8a+wAxn/ t2Y8J51DxiOUL6XPx0kWg3rupp5EgaaDzS7xY= MIME-Version: 1.0 Received: by 10.68.57.105 with SMTP id h9mr741564pbq.221.1307539886526; Wed, 08 Jun 2011 06:31:26 -0700 (PDT) Received: by 10.68.58.100 with HTTP; Wed, 8 Jun 2011 06:31:26 -0700 (PDT) In-Reply-To: References: <4DED3D5B.6030307@oracle.com> <4DEE782E.1020605@sugarcrm.com> <1307489981.23373.31.camel@guybrush> Date: Wed, 8 Jun 2011 09:31:26 -0400 Message-ID: To: Hannes Magnusson Cc: =?ISO-8859-1?Q?Johannes_Schl=FCter?= , Stas Malyshev , "Matthew Weier O'Phinney" , internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Callable type From: ircmaxell@gmail.com (Anthony Ferrara) > No default values, other then NULL allowed. > Otherwise we would need to support array("classname", "methodname") > too, and then people would want default array values for array > typehinting etc etc etc. Unless I mis-read what you said, we already have default array values for array type-hinting: function foo(array $array =3D array('bar', 'baz')) { var_dump($array); } foo(); foo(array()); Works perfectly for me on 5.3.6... 2011/6/8 Hannes Magnusson : > 2011/6/8 Johannes Schl=FCter : >> On Tue, 2011-06-07 at 12:12 -0700, Stas Malyshev wrote: >>> Hi! >>> >>> > https://wiki.php.net/rfc/callable >>> >>> It is good there's an RFC. However it seems to lack code examples. I >>> understand it may be obvious to the proposers how it looks like, but >>> it'd be nice to have the actual example there as it is done nearly >>> everywhere else. >> >> The RFC is missing information about what happens in codebases which >> already have a "callable" type declared. Will that be prevented or will >> they hit a runtime error? ("callable expected, callable type found") > > You mean an interface/class with that name? > The error would be 'expected instanceof callable, string/array/closure re= cieved. > > gettype("strpos") will still return a string, not callable. > > A callable wouldn't be fully featured type. > >> What about default values? Will >> =A0 =A0function foo(callback $cb =3D 'strpos') { } >> be valid? > > No default values, other then NULL allowed. > Otherwise we would need to support array("classname", "methodname") > too, and then people would want default array values for array > typehinting etc etc etc. > > > >> The information on reflection is limited. what shall >> Reflection::Parameter::getTypehint() return? Will that method allow to >> differ between a class type and this "magic"? > > There is no such method anymore :) > > >> >> What about ARGINFO? Will internal functions be able to define this type >> via ARGINFO? How will this be reported in `php --rf function`? > > I didn't include arginfo in the patch, but good point. It should > probably be included. > As Felipe pointed out, ext/reflection hasn't been updated. > It should return [ callable $foobar ], just like with any other typehint > > -Hannes > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > >