Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:98500 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 26527 invoked from network); 12 Mar 2017 09:38:18 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Mar 2017 09:38:18 -0000 Authentication-Results: pb1.pair.com header.from=michael.vostrikov@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=michael.vostrikov@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.161.174 as permitted sender) X-PHP-List-Original-Sender: michael.vostrikov@gmail.com X-Host-Fingerprint: 209.85.161.174 mail-yw0-f174.google.com Received: from [209.85.161.174] ([209.85.161.174:34493] helo=mail-yw0-f174.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 31/69-38004-90715C85 for ; Sun, 12 Mar 2017 04:38:17 -0500 Received: by mail-yw0-f174.google.com with SMTP id p77so45029240ywg.1 for ; Sun, 12 Mar 2017 01:38:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:cc; bh=ZQZaPzkTA35kDhfKEcTIEAQRTeOk6NVYVj0wfrmRKG4=; b=KTamZ0NLUI/5jD/qXXScMFvlGC9Xhd6ic9XE8ctCirUtGyy2E+9I4d+CHuR5UVPLVB wC2TuyQ9YeiSJVdYC15qu3SuPzZyngpBVnLPXwntMyHoJ28+fkYAdxUcIx0apQuAM5Qy kz6Eo2e/bm+Ouq8KJZT9pi4T//g9345ZkPTDpg+s9GyLBNfWe/SchJGfeoDXvFsyUi7K DbCa+bZOdAkaVBATN1Un4NksaQgUdWHvYlGwTHiaXsTXcR3zRk7eXt/sBvEt75VUN9fs 7oSrET2bUgG+kpHdL6QEQk/szMOEyZq2O5AA3QmgBP8jNWkVAouvl5rbLYyaJ+mDLHBZ RXfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:cc; bh=ZQZaPzkTA35kDhfKEcTIEAQRTeOk6NVYVj0wfrmRKG4=; b=ALqc4LvtWkZGrao7nAxrTiqyyWpCl6MzoDEMMuLV6XLFkriE87IFovw7J0BcjMt6sv kK/+++e9KD7yJ+PpnfeQxCSEexhnHw78xd7dwFSncIVLgeReYGTeg7g/f+hyBXTUv0vU I1MMvU4FDUDlANy4FipNA6zwCLRvZ9LPSJytM+mCRvYpdCu0WRXERQIdJQp1kd44Rhsc vHM/pnMc8zTjaieYeMvfl1Xp+JbgeD2e/+NT5wmGjuj/Drw3sOgtiCyickBZ8L9MVlLC A/xNOQSDS6PE0XucwU0gJPMaW/nGB3qRV4kbrr3Uar4BTCQYkOA5zsccadM0jetgjtYQ hlGw== X-Gm-Message-State: AMke39lePgDW2Jn7REj+fFQb8c9GREH/SQxYbt/SNkMNudqrGwOG6gcL48aVFPymFZat3ZZu8WvklGY9ofP/rA== X-Received: by 10.37.201.196 with SMTP id z187mr14462609ybf.161.1489311494665; Sun, 12 Mar 2017 01:38:14 -0800 (PST) MIME-Version: 1.0 Received: by 10.13.224.196 with HTTP; Sun, 12 Mar 2017 01:38:14 -0800 (PST) In-Reply-To: References: Date: Sun, 12 Mar 2017 14:38:14 +0500 Message-ID: Cc: PHP internals Content-Type: multipart/alternative; boundary=001a114d88ea997ff9054a855a5f Subject: Re: [PHP-DEV] Type variants From: michael.vostrikov@gmail.com (Michael Vostrikov) --001a114d88ea997ff9054a855a5f Content-Type: text/plain; charset=UTF-8 2017-03-12 14:14 GMT+05:00 Lester Caine : > My problem here is with the reason for needing a different class for 'Square' when $rectangle->is_square() is a simple additional check on a single Rectangle class. Yes. And we have to call it in all operations with Square manually, and throw exceptions/return errors manually. > drawSquare() seems redundant when $rectangle->draw() does the same job This is just example of external function with type hinting. And I'm not sure that models should know about device contexts, canvases, pixels and other details of presentation layer. > Trying to create 'type's for all the variants of the object is just wrong? int_instock, int_minorder, int_backorder, int_special_production and so on as the types of LineItem so 'instanceof' will work for you? I don't need to create a separate type for every characteristic. I need to create a type for some important operations, which will contain all required restictions of object state and which I could just write in all functions that work with this state. --001a114d88ea997ff9054a855a5f--