Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:74073 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 28220 invoked from network); 8 May 2014 22:22:23 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 May 2014 22:22:23 -0000 Authentication-Results: pb1.pair.com header.from=tjerk.meesters@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=tjerk.meesters@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.41 as permitted sender) X-PHP-List-Original-Sender: tjerk.meesters@gmail.com X-Host-Fingerprint: 209.85.220.41 mail-pa0-f41.google.com Received: from [209.85.220.41] ([209.85.220.41:53905] helo=mail-pa0-f41.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1B/77-15882-D930C635 for ; Thu, 08 May 2014 18:22:21 -0400 Received: by mail-pa0-f41.google.com with SMTP id lj1so3471249pab.0 for ; Thu, 08 May 2014 15:22:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=references:mime-version:in-reply-to:content-type :content-transfer-encoding:message-id:cc:from:subject:date:to; bh=oH7gLZWN66SwO+kLVp9ZqYPjsPsU3Wp352l6ktqbsOo=; b=ZaMLPiaEwHWmqf2nZ0xCzeN7EUJpg5xMlzKn7EsG3Mn9dLPQzlORiiXC0dkhF5HwCA ASnVvpbcKdo+A/QJj/G8+imjchr+NIHTDqU/dpyjzTRZDCMKtJ2LBR8UN2wWigveaHOg m/Q0Elhzz9GWmoR3MbgLTz3LKpDKnRH6696BgRCYM2IpCIhFddp5G1EoQU2IGwWE8Ge0 bwIMQDXYQJrEE8b3FzWz+e0mx7thFmvzZsdhX7aVIydmQtxmlIZI4c+VrPorbSr/dVOH ZHan3uRrk/S2Vj/cfn0f5qmXAbCdRcx4gs4B0N5H2NBJvtvmz/AB8wg/eSe/9we6fX23 mX+Q== X-Received: by 10.66.186.238 with SMTP id fn14mr12483437pac.135.1399587738959; Thu, 08 May 2014 15:22:18 -0700 (PDT) Received: from [192.168.1.105] (bb121-7-198-24.singnet.com.sg. [121.7.198.24]) by mx.google.com with ESMTPSA id pb7sm9710984pac.10.2014.05.08.15.22.16 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 08 May 2014 15:22:17 -0700 (PDT) References: Mime-Version: 1.0 (1.0) In-Reply-To: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Message-ID: <11C7CA9B-2E1D-40B7-8AED-5E039DF87B8C@gmail.com> Cc: internals X-Mailer: iPhone Mail (11D201) Date: Fri, 9 May 2014 06:22:14 +0800 To: Levi Morrison Subject: Re: [PHP-DEV] Anonymous functions inside static methods. From: tjerk.meesters@gmail.com (Tjerk Meesters) Hi > On 9 May, 2014, at 6:02 am, Levi Morrison wrote: >=20 > See this 3v4l (contents at bottom of the message): http://3v4l.org/pHkf7 >=20 > I think Bar::bar() should definitely return 'Bar' (currently returns 'Foo'= ) > but what about the Bar::Baz() call? >=20 > Until today I didn't even know you could declare a static anonymous > function, so I'm not really sure what the expected behavior is. >=20 > Script contents: > =20 > class Foo { > static function bar() { > $foo =3D static function() { > return get_called_class(); > }; =46rom what I gather, the use of static on closures only limits as to what y= ou can bind it to, i.e. ->bindTo() will not accept an instance to bind to. >=20 > return $foo(); > } > static function baz() { > $foo =3D function() { > return get_called_class(); > }; >=20 > return $foo(); > } > } >=20 > class Bar extends Foo { >=20 > } >=20 >=20 > assert(Bar::bar() =3D=3D=3D 'Bar'); > assert(Bar::baz() =3D=3D=3D 'Bar');