Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:98503 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 33167 invoked from network); 12 Mar 2017 10:34:41 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Mar 2017 10:34:40 -0000 Authentication-Results: pb1.pair.com smtp.mail=yohgaki@ohgaki.net; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=yohgaki@ohgaki.net; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ohgaki.net designates 180.42.98.130 as permitted sender) X-PHP-List-Original-Sender: yohgaki@ohgaki.net X-Host-Fingerprint: 180.42.98.130 ns1.es-i.jp Received: from [180.42.98.130] ([180.42.98.130:38410] helo=es-i.jp) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FB/7A-38004-D3425C85 for ; Sun, 12 Mar 2017 05:34:38 -0500 Received: (qmail 26170 invoked by uid 89); 12 Mar 2017 10:34:33 -0000 Received: from unknown (HELO mail-qt0-f172.google.com) (yohgaki@ohgaki.net@209.85.216.172) by 0 with ESMTPA; 12 Mar 2017 10:34:33 -0000 Received: by mail-qt0-f172.google.com with SMTP id i34so15484924qtc.0 for ; Sun, 12 Mar 2017 03:34:33 -0700 (PDT) X-Gm-Message-State: AMke39nS8fiFq1YjmrPpM1YyMbniUhDvkP66UD+PiwUgJbopLY9i5tVdmY1lTR1fMsUHMgmyRv+XWeXvC3q6vw== X-Received: by 10.237.51.131 with SMTP id v3mr26766314qtd.152.1489314867552; Sun, 12 Mar 2017 03:34:27 -0700 (PDT) MIME-Version: 1.0 Received: by 10.140.19.232 with HTTP; Sun, 12 Mar 2017 03:33:47 -0700 (PDT) In-Reply-To: References: Date: Sun, 12 Mar 2017 19:33:47 +0900 X-Gmail-Original-Message-ID: Message-ID: To: Michael Vostrikov Cc: PHP Internals Content-Type: multipart/alternative; boundary=94eb2c12567ca3af15054a8623c3 Subject: Re: [PHP-DEV] Type variants From: yohgaki@ohgaki.net (Yasuo Ohgaki) --94eb2c12567ca3af15054a8623c3 Content-Type: text/plain; charset=UTF-8 Hi Michael, On Sat, Mar 11, 2017 at 3:36 PM, Michael Vostrikov < michael.vostrikov@gmail.com> wrote: > > class Square variant of Rectangle > { > public function __match() > { > if ($this->width != $this->height) { > return ['width' => 'Width and height have to be the same']; > } > > return true; > } > } > DbC allows this kind of validation at development time. I suppose you would like to check requirement at runtime always. It would be nice to have feature, but I think something like __requrie() is better name for the method. IMO, C# like getter/setter is better though. http://stackoverflow.com/questions/11159438/looking-for-a-short-simple-example-of-getters-setters-in-c-sharp Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net --94eb2c12567ca3af15054a8623c3--