Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:97261 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 90131 invoked from network); 2 Dec 2016 14:55:57 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Dec 2016 14:55:57 -0000 Authentication-Results: pb1.pair.com header.from=bowersbros@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=bowersbros@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.46 as permitted sender) X-PHP-List-Original-Sender: bowersbros@gmail.com X-Host-Fingerprint: 74.125.82.46 mail-wm0-f46.google.com Received: from [74.125.82.46] ([74.125.82.46:34026] helo=mail-wm0-f46.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E8/2C-01781-C7B81485 for ; Fri, 02 Dec 2016 09:55:57 -0500 Received: by mail-wm0-f46.google.com with SMTP id u144so4171726wmu.1 for ; Fri, 02 Dec 2016 06:55:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=5c0ZzNpJj9BMAedN8y5nRiSHiMlUmYSVahecbIp0XMQ=; b=sklU7Pwk7Qc/fRMOwjT7v8PD0wJPk3YXNWOAvWZpXzowSIxaf2OoH1B5SH1qWcawcs GdrqhsZGpdjLMfKoHWMVlweR/eRtjzXuvvUsqemSxJ+1Z230nZgqurdmRmn+6bDC+bIA YlYVPESGkHJ4PMeVu4nIxZt1rG92n+GKuF504vBV/bm0cg+nTMFI6zFuJcWBAZN+V1sQ EiQXkmehnqU/pW9qZiHR/6PE3FHvD9tT8c8FgsjRchhkc9s08w0dCA9O7HGDs+nmVn5B l3PCvEf6+zs0sZtPx5UqwtUqgx8DrmZ0CyCTem9r8jdRRwjolAGiFoLbkKF7k2WFIo1W MCbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=5c0ZzNpJj9BMAedN8y5nRiSHiMlUmYSVahecbIp0XMQ=; b=NFaohNYrhlkj7unrOu5kI+sWvm0soowzNm+jlJZUyZ8npSRKLRc6tDK/f48+WkudRK rgqgyhY5OlQmFKJ2WqgwR57D3Sayw+CQ2XlrD9SbB3/3zyS7XWbgv/cqhQcUqB0+NSBy R0VwVij1zQigfs0Oh81eiq8VG4nlf7fRYICJzcS7yWFCXQEoW57yFFK7QCfC2JsLJnzi rfAB5m8N4+EMg0KM4+ES1LTJUN/79yLiCpRPshv3HNis0OY8LZxBAzDA4ssD3H98kkoH /gOj9QGdKaD6EnOEr8F9wze5EchMh4wWCsJZG7cPpDtmQZ+BkCFU9c5VQAawQmyu+uMJ Pu8w== X-Gm-Message-State: AKaTC02AV+0ubb0q5yRA3pIAj9g8fcfkW5aMdAjy8kWCjbUA4thcjRjmSwebNgtLz7WvELRGj93VyB79dm6sAg== X-Received: by 10.28.137.193 with SMTP id l184mr3171216wmd.88.1480690553855; Fri, 02 Dec 2016 06:55:53 -0800 (PST) MIME-Version: 1.0 Received: by 10.28.232.77 with HTTP; Fri, 2 Dec 2016 06:55:53 -0800 (PST) In-Reply-To: References: Date: Fri, 2 Dec 2016 14:55:53 +0000 Message-ID: To: Andrey Andreev Cc: "internals@lists.php.net" Content-Type: multipart/alternative; boundary=001a114417647c24490542ae22a4 Subject: Re: [PHP-DEV] Re: [Concept] Magic Casting From: bowersbros@gmail.com (Alex Bowers) --001a114417647c24490542ae22a4 Content-Type: text/plain; charset=UTF-8 On 2 December 2016 at 14:46, Andrey Andreev wrote: > It enables magic behavior, that's the opposite of enforcement ... If you > want to enFORCE something, you force the developer to do something, you > don't auto-magically do the thing for them. This magic behaviour would be for enforcement, because you are now enforcing that the passed in type is acceptable to the contract of Collection. It can be an array, because arrays can be converted to a Collection, and it is down to the __cast() method to determine whether that is a suitable conversion, but it allows you to enforce a suitable parameter is passed in. Currently, to accept bot ha Collection and an array, you would have to not enforce anything, and inside of the method handle the conversion or exceptions. --001a114417647c24490542ae22a4--