Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:64656 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 66198 invoked from network); 8 Jan 2013 08:11:55 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 Jan 2013 08:11:55 -0000 Authentication-Results: pb1.pair.com header.from=lars.schultz@toolpark.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=lars.schultz@toolpark.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain toolpark.com from 195.49.42.12 cause and error) X-PHP-List-Original-Sender: lars.schultz@toolpark.com X-Host-Fingerprint: 195.49.42.12 mail1.screenlight.ch Received: from [195.49.42.12] ([195.49.42.12:51345] helo=mail1.screenlight.ch) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 66/D2-37176-9C4DBE05 for ; Tue, 08 Jan 2013 03:11:54 -0500 Received: from [192.168.1.112] ([192.168.1.112]) (authenticated user lars.schultz@toolpark.com) by mail1.screenlight.ch (Kerio Connect 7.0.2 patch 1) (using TLSv1/SSLv3 with cipher AES256-SHA (256 bits)) for internals@lists.php.net; Tue, 8 Jan 2013 09:11:48 +0100 Message-ID: <50EBD4C4.8090703@toolpark.com> Date: Tue, 08 Jan 2013 09:11:48 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: internals@lists.php.net References: <4ED7146272E04A47B986ED49E771E347BB3D6ABCB3@Ikarus.ameusgmbh.intern> In-Reply-To: <4ED7146272E04A47B986ED49E771E347BB3D6ABCB3@Ikarus.ameusgmbh.intern> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC] Alternative typehinting syntax for accessors From: lars.schultz@toolpark.com (Lars Schultz) Am 08.01.2013 08:56, schrieb Christian Stoller: > But the way 'nullable' properties are defined is not very intuitive and unclean, in my opinion. Stas has already mentioned that. > `public DateTime $date = NULL;` // this looks like the property is initialized with null, but it does not show that the property is 'nullable' To me this makes perfect sense. It takes up the syntax php has been using for method-definitions. A syntax we would be using to create a classic setter method if there wasn't a fancy new one. public function setDate(DateTime $date = NULL) { $this->date = $date; } Anything other than this would result in an inconsistency. Having accepted that syntax previously and now introducing yet another one, would be confusing and unnecessary. Although, as Stas has pointed out, *not* allowing NULL for a property will not prevent it from being NULL...depending on wether it has been initalized.