Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:72858 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 45664 invoked from network); 28 Feb 2014 09:57:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Feb 2014 09:57:29 -0000 Authentication-Results: pb1.pair.com smtp.mail=cryptocompress@googlemail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=cryptocompress@googlemail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain googlemail.com designates 209.85.215.179 as permitted sender) X-PHP-List-Original-Sender: cryptocompress@googlemail.com X-Host-Fingerprint: 209.85.215.179 mail-ea0-f179.google.com Received: from [209.85.215.179] ([209.85.215.179:34669] helo=mail-ea0-f179.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 77/72-28957-88D50135 for ; Fri, 28 Feb 2014 04:57:29 -0500 Received: by mail-ea0-f179.google.com with SMTP id q10so2500238ead.24 for ; Fri, 28 Feb 2014 01:57:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=ZiM0giBn5CFZs5xWkMIcAM4CJQgEA5r+oMinntF1cSg=; b=gg+JCs+Zm6N+Cdg4v5F9OXxwCAa5ug+XrueaHr5nwC1Y33SsFlGDj2YJt6h/wU77T1 npnh0zCCM44AGShSZfEhDMap95mvzJPM0Jxr/HAMpk3YQtI95KDc0QnFKr0CmI+TCDmt nJVRDGDNQ7xk6/ORicSL0OWzXihFPbiz44VnNkHMLLoZ4gP4bCAA5ZmZxUdeZykUGpKe uE4HZR//zX0w12K+PDifQmGODu0kkKeTrzQ+M9rOLfNkTHDsaNNNoyDXzhjGHYLaHPHq 36rbLyruyvqiK5eeTzR7Zea/Ik8fM0i0avIhsyrCfj8QBDO01GNagFdAs4kj7G9hOQ7s SfQA== X-Received: by 10.15.111.130 with SMTP id cj2mr2599522eeb.102.1393581445758; Fri, 28 Feb 2014 01:57:25 -0800 (PST) Received: from [192.168.1.115] (mnch-5d877c24.pool.mediaWays.net. [93.135.124.36]) by mx.google.com with ESMTPSA id j41sm8441980eeg.10.2014.02.28.01.57.21 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 28 Feb 2014 01:57:24 -0800 (PST) Message-ID: <53105D7F.3030701@googlemail.com> Date: Fri, 28 Feb 2014 10:57:19 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 MIME-Version: 1.0 To: Chris Wright CC: PHP Developers Mailing List References: <52D865C7.4070009@sugarcrm.com> <531044A8.8050002@googlemail.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Introducing "Array Of" RFC From: cryptocompress@googlemail.com (Crypto Compress) > Are you suggesting the following? > > function foo(Bar[] $bars) // required to pass an array of Bar objects > function foo(Bar[] $bars = null) // required to pass an array of Bar > or null members No. This is ambiguous, as you imply. I prefer c# syntax. > ...because if so, how do I specify an optional array of Bar objects? > And how do I specify an optional array of Bar or null? > > The whole concept of allowing null members seems to completely defeat > the purpose of the ArrayOf hint for me. I can understand wanting to > make the parameter optional, but I cannot see a use case for null > members from the point of view of the caller. I never null out members > of an array, I only omit them from the declaration or remove the > member from the array via e.g. unset() or stack operations (pop(), > shift() etc). YMMV of course, but for me allowing null members just > makes the callee's life more difficult and does not gain anything. Have to agree, there is not too much value in this. ;) Usecase: No need to write a mock for third and seventh array element. In fact i can't think of other usecases. It's only a simple logical extension of "function (A $a = null)".