Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:101696 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 57463 invoked from network); 26 Jan 2018 14:43:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Jan 2018 14:43:29 -0000 Authentication-Results: pb1.pair.com header.from=cmbecker69@gmx.de; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=cmbecker69@gmx.de; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmx.de designates 212.227.17.20 as permitted sender) X-PHP-List-Original-Sender: cmbecker69@gmx.de X-Host-Fingerprint: 212.227.17.20 mout.gmx.net Received: from [212.227.17.20] ([212.227.17.20:53680] helo=mout.gmx.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 34/93-35287-E8E3B6A5 for ; Fri, 26 Jan 2018 09:43:28 -0500 Received: from [192.168.2.101] ([79.243.122.205]) by mail.gmx.com (mrgmx101 [212.227.17.168]) with ESMTPSA (Nemesis) id 0MFgxF-1ebSCi09rx-00EfIA; Fri, 26 Jan 2018 15:43:21 +0100 To: Larry Garfield , internals@lists.php.net References: <4895296.I5cF5gV8b7@vulcan> Message-ID: <7207dd2d-f315-74ed-d5cb-073afe49a978@gmx.de> Date: Fri, 26 Jan 2018 15:43:20 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <4895296.I5cF5gV8b7@vulcan> Content-Type: text/plain; charset=utf-8 Content-Language: de-DE Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:n/RMkNUPGfbZfig4OArzzTfNd4DYbXByKOMjlKR6pDQ7LmYvsed BgEPCYqaw308/NR4P/JHFt9E+7RxUdIiDGsZOlVIANX8XBzQWAv+KTu9QXGL+NeXc9MKWXV 8rlkq1zI98NVKE7JWxeD1Za46ogzVMR3R+S7wlLd3273Pf5KVUIz8TOWyI6TtFk3H17tqQj wYHbrsucDX9hlTwTK4vFg== X-UI-Out-Filterresults: notjunk:1;V01:K0:m/sFm/GafzM=:bZO/VzDJuBu2K8v4b+Y20s OABF4q7Zcj8gFJIO3pRZjAidAFJd+NAf6PgxTYldBuRoB/1N+NRwZepZ+mNGt/N0ei+aSKq/r i7q9wyTgQJghVSawDjXdconLxU+sW4XGTZVK2ZBL6lypnc5WwR74AVXiGDvR48sFnVKKzKTUq 4KYSHWxA1HPytfAeNFMpt+CZpHWCHBMyJWcTbgop6M3aQ++jOD25HbmpONH822O9nVOThjb1U jNEAgB2STHZHtl6oNfuBZ6NaAZmI+Ij9QjmsDTGfVGKhdj+JZ97r3yMCcD0MTKnlZVAGHxZNh 3mRd9G6mQOI4e09KCRBVmjwUwoszdKABUPjih2vL31hEUCN4NESyTFFgY1lIdKlXoOQOWcZbH B0MgU4lH7FJ6NFLJE/yKq4oQZuThWr6TfETCA0zxrwG1ls0ZPkSUmL9mQSojCkJAgcLTZdG8W 39ikQa7IO2vEzeW7l4Vr9AJIAT3D6nv5v9RXBOc5vTF3rdp1thqmlu12FY/LjdYJjgLskOWZu knmRj1lcR47ZTKyPK5beyrGi6p9QGZkwcy8dCuUts9oDY4/R3Env+tE7Qf9852CZp4DHvZMQv 1pFN7Bf7KVWf42Q04ZEFaYSGQpbMgS+s0rcckUpmbowIISdOPrLQl40zwXES68Q09kpkJVTEV aPE72yRXAT9euYKdCDNYg0eEl9p+kqbkiYUuwBdJpXGmECq5XZSDZwlEbzE+RY9+SbdBUd8TG f66Arowho+E4+iGESINuOEd5Ll0da7wpQUFb4NKeCoqJLa0bpT1wPbUdXxEzl8ITOdownYZtw HzzMUvY Subject: Re: [PHP-DEV][RFC][DISCUSSION] Collection Inspection From: cmbecker69@gmx.de ("Christoph M. Becker") On 26.01.2018 at 00:28, Larry Garfield wrote: > On the read side (which you'd want for a generator or similar), the logic > you'd want is essentially: > > class Ints extends ArrayObject { > public function current() : int { > return parent::current(); > } > } > > Which lints fine, but when I tested it just now returns strings quite happily > without a type error, which seems wrong to me. (Why is it doing that, and is > it a bug?) ArrayObject does not have a `current` method[1] (it does not implement Iterator, but rather IteratorAggregate), so it is never called, and therefore the `parent::current()` call doesn't error, from what I can tell. For what it's worth, overriding the `offsetGet` method works as expected[2]. [1] [2] -- Christoph M. Becker