Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:71153 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 36393 invoked from network); 15 Jan 2014 20:19:49 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Jan 2014 20:19:49 -0000 Authentication-Results: pb1.pair.com header.from=kristopherwilson@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=kristopherwilson@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.223.170 as permitted sender) X-PHP-List-Original-Sender: kristopherwilson@gmail.com X-Host-Fingerprint: 209.85.223.170 mail-ie0-f170.google.com Received: from [209.85.223.170] ([209.85.223.170:33148] helo=mail-ie0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C5/88-26701-46DE6D25 for ; Wed, 15 Jan 2014 15:19:49 -0500 Received: by mail-ie0-f170.google.com with SMTP id u16so844527iet.29 for ; Wed, 15 Jan 2014 12:19:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=kmEmPsyyK5MKbyQrsG2mpIcGG1xD053TBP9wmUwmPuI=; b=VKc3eyc7GbLjfMWEXAlr4Jjz+8EX4MA4jYka9Tk/4VL6gv+yTK39FR2pM2UI8NsWYq /13XO3D7Gg2aR1R844oN9wVOTRxLvm9Jf6jG/pY/SL7QwCIDTtJGwOUSJHl6YGjcW0F6 Jar+zFlxW7IPBf0qwxdEY1PvVxF+AZPguyVw/m3L/DibJ80HbO0E8zxSmcbbSqkWkia6 UdnL8Pn586ITvwjqpjNh07jkflDfvOKbYDjEgmrgOTNrj1qAwSNCEzLNJGrAahcigpQ5 iionVfA2U4j+Xbk2hOuZVAg1Gisyang4NHfEk9Fkz9ym4kfPKcMRrYmeakDaDCwcgN9t eGjg== MIME-Version: 1.0 X-Received: by 10.42.123.199 with SMTP id t7mr4220110icr.45.1389817185505; Wed, 15 Jan 2014 12:19:45 -0800 (PST) Received: by 10.64.14.161 with HTTP; Wed, 15 Jan 2014 12:19:45 -0800 (PST) In-Reply-To: References: <001301cf1227$6d082ab0$47188010$@tutteli.ch> Date: Wed, 15 Jan 2014 15:19:45 -0500 Message-ID: To: Philip Sturgeon Cc: Robert Stoll , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=20cf301af619a517d704f0080742 Subject: Re: [PHP-DEV] Introducing "Array Of" RFC From: kristopherwilson@gmail.com (Kristopher) --20cf301af619a517d704f0080742 Content-Type: text/plain; charset=ISO-8859-1 On Wed, Jan 15, 2014 at 3:09 PM, Philip Sturgeon wrote: > > Ok, ignoring the int stuff as PHP doesn't generally do that. We don't > want to broach that topic here. > > As for allowing null, this feature is currently intended as a > syntactic representation of: > > foreach ($foos as $foo) { > if (! $foo instanceof Face) { > throw new Exception ('AAAGGGGGHHH!'); > } > } > > You are suggesting: > > foreach ($foos as $foo) { > if (! is_null($foo) and ! $foo instanceof Face) { > throw new Exception ('AAAGGGGGHHH!'); > } > } > > How do people feel about that? > > PHP disallows passing NULL in a function like: function foo(MyClass $obj) {} Unless you explicitly allow it to be null: function foo(MyClass $obj = null) { } The first instance will throw an error: PHP Catchable fatal error: Argument 1 passed to foo() must be an instance of MyClass, null given I think this implementation (MyClass[]) should be consistent this when passing null. --20cf301af619a517d704f0080742--