Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:93603 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 73820 invoked from network); 27 May 2016 09:44:10 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 May 2016 09:44:10 -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.22 as permitted sender) X-PHP-List-Original-Sender: cmbecker69@gmx.de X-Host-Fingerprint: 212.227.17.22 mout.gmx.net Received: from [212.227.17.22] ([212.227.17.22:63095] helo=mout.gmx.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 33/16-37127-8E618475 for ; Fri, 27 May 2016 05:44:09 -0400 Received: from [192.168.2.102] ([79.243.127.41]) by mail.gmx.com (mrgmx101) with ESMTPSA (Nemesis) id 0M8ZtH-1bTEyl2uKh-00wBxC; Fri, 27 May 2016 11:44:04 +0200 To: Rowan Collins , internals@lists.php.net References: <20160525215208.034FC1A801B3@dd1730.kasserver.com> <5fd54aa0-4fdf-c1e7-eae8-765aa89c8498@fleshgrinder.com> <08963b03-8394-6d62-4e5b-393f3fcb5647@fleshgrinder.com> <9e9db70d-d72d-d93e-0c81-18c2aa228618@gmail.com> <409002d8-b5e3-5990-7358-246adc7e3cab@fleshgrinder.com> <57474A08.80807@lsces.co.uk> <6f7403b6-bf22-a12b-dfb2-43fe82983e7d@fleshgrinder.com> <57474F9C.6080104@lsces.co.uk> <1733cfce-001b-1079-e929-88f7dde0f2dd@gmail.com> <57475F27.3090306@lsces.co.uk> <34edcbd1-2d6a-cd52-7bbb-c393ab62d32d@gmail.com> <574772BA.3030305@lsces.co.uk> Message-ID: Date: Fri, 27 May 2016 11:45:07 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:Zftilkrf701F9Y8A6lpLOxcRHr54LaiU/Cu4ZitDn8Yo3Hc3AST v7wKJ7JN501O4+48HJF6JxNlXbpGjXz9rMrB5noItKtlS01PF4glrz8SlB9DUl1h8InW1wV AZE3G26+1gLtFKrW+2n/mcx9imEgQtfvh+P5Bm2TavKsUyPyVnH4AfN40nK80tA64loXSQf 7Lc1hnnQOyfuxaO3l0Mxg== X-UI-Out-Filterresults: notjunk:1;V01:K0:DrXVgrzEqaQ=:Xc+SCVqROU6/ovtRGc80Y4 y3IsFfTA/34nszcZ8BlpFdE90iHXgyYqs5N3JA8z17JzvYOoJrCjM+ArUoZGwNjLrzcBya9qN adtDoIL1PvaDaUO4UYSHzeVLiggMxpt/s2w5elUlDpS9/RQlAb6yvvuCHSve0qIic37WAvNAS oWZQA5FV7DPnOycEhVaGgBtyu9llgP+ka/FbaFCqAN8c1vLDBRxBeuRZ361/AQ6q4PFpWVA9W aSdKAqyk9x9KMuBfzBgdxSPacCFAaEGFp5+hv75wGNelFKQ2xZcnoo/xLx/9rj/8YSRXlHUO2 CLwjFxB9l2eQhwR3hGDIQB23R4U+Qt/ouk+f6inKwO2KeOM8ni8CzrZjyVlpQ0SBGX1QULu1I fsvy7+LVv276Ck8/4V0cmzA+D3ljUqb4rZlLgtv9LxZnyA2w/PqVdVK5M/naA06e1Zv/esb0k lNQYkpGRW08OIagynYBC0uUzpFUwSn3STluwCheJkGOzWGllyDBCinFlUQED1DAzMwJxQfCtu 7Z04sC3eqNxKHDhXGDrLHyQVY31kc02D6p+0xp2ZgMpz3TkaHFzAcIY8jsmoykMy6XprsXlpN S7WWD5QRYj+rExWzilsSqA7mMgpheKXNDfe38pzAvGvrWrgWs2IXFgmvbAktQiVEllRDkZHTx 46VyePoh22KlxDw3U5cDMVgp2jAvk6qSs2J4S6pxfcNKJZki5T4LnvCYUCg3Pd5cYzqnmOGm2 136JDb4SB0yGAe7OGmmtr3AwfddKW+ufHjANJo1ULKLhiN2uCbEryJhFsxe8BbMGV/d8p6qlO 9Hr7Wir Subject: Re: [PHP-DEV] [RFC][Vote] Typed Properties From: cmbecker69@gmx.de (Christoph Becker) On 27.05.2016 at 10:27, Rowan Collins wrote: > On 26/05/2016 23:03, Lester Caine wrote: >> On 26/05/16 22:38, Rowan Collins wrote: >>>>> // accessing $me->marriage or $me->death returns NULL (because they >>>>>> allow nulls) but raises E_NOTICE >>>> BUT DateTime currently will not store 'null' - it returns 'now' >>>> instead. >>>> We end up having to store string or integer values because we can't >>>> store a null date :( >>> >>> That's exactly what ?DateTime is for - "either DateTime or Null", just >>> like in a database. >>> >>> In most type systems, there is no such thing as "a null date" - if it's >>> null, it's not a date, it's a null value. >> >> The exact question here then is in relation to just how one uses >> 'DateTime' in this situation? Or more accurately how one maintains the >> 'or Null' state when the type does not allow null itself? > > I don't understand the question. > > class Foo { ?DateTime $d } > $f = new Foo; > $f->d = null; > $f->d = new DateTime; > > It's either a DateTime, or it's null. ACK. However, an alternative might be: class NullDateTime extends DateTime {...} class Foo { DateTime $d } $f = new Foo; $f->d = new NullDateTime; $f->d = new DateTime; -- Christoph M. Becker