Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:99225 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 20164 invoked from network); 29 May 2017 10:02:28 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 May 2017 10:02:28 -0000 Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.47 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.47 mail-wm0-f47.google.com Received: from [74.125.82.47] ([74.125.82.47:35931] helo=mail-wm0-f47.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3A/22-34073-3B1FB295 for ; Mon, 29 May 2017 06:02:28 -0400 Received: by mail-wm0-f47.google.com with SMTP id 7so49334116wmo.1 for ; Mon, 29 May 2017 03:02:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=H5oFGsv0PyPv8MCsZdFLlHxH14yjbZkS71AFMIgwLvY=; b=hjLM5MXTAZu8Ljo5wAJmrJp2X7MnQ35lDdtZvipx/SAm1QHxMFAXsioaDVObu9mdYT UL4tGXPEo5pC9pOJxiJ/xN8LTI6aGtn3RATz1HGKjigiUVgq+3ARA/M3caVQ2QjuzTth CWzv4U+/3xN+G4BurlOs+d6uc0krWPXTBEDODx5lC58fggKH+Bcy6MyLNSJKqEXfw80J T9ymH09tSrjSJoUessl0H2JfpYmO8dfG0dhIZmrXjTO417MNeYDS3jRZV939OYn/mKZL eqMorUIC9Itw6ZA75p+pNRQs97k3xvIr1q2pVK0DlvfNqsusbHAjGXMV81Oe18eXcRwB TSaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=H5oFGsv0PyPv8MCsZdFLlHxH14yjbZkS71AFMIgwLvY=; b=awKKmee48Xnrg08tqmGHGVsq53vGHIkHOQxAr9yrA/nb+ZpFobEcFnlmpXaNE7lIJ0 /0OqMx9lmdZHxFejFRucJ4t5UCmHBVVBZQ+k00wg2IR9yjqdWSIuCxskJyxDK+lqdWOZ 4TTDV3b5EIUaVplS396IRsHhpF5Yuz+E75IQiPtJJkCdNiqfpFI4t0WGyRp8OjwYanPM Tk9radHRx0CKfr97wUV4bSwyOKb23CDMyes7czz+uLIpHomebcPKGvUUQXuTPZRP/Rxw aniIPdhJ8Xd6A9TGp5YzJwZkbsr9g+OCwTjY3qRUw2/IP8qzFzJ5Ei2OW3DrMU/ddGiH 6D+g== X-Gm-Message-State: AODbwcBVrqxkOkI2K3LIXxnU6QwikEO8TH4UE9Rv34RX0NH15YgjLg/9 TVgUwTDgxFdwwFAb X-Received: by 10.28.15.14 with SMTP id 14mr9273945wmp.51.1496052144580; Mon, 29 May 2017 03:02:24 -0700 (PDT) Received: from ?IPv6:2a00:23c4:4bd2:6e00:6014:61d9:df8d:5974? ([2a00:23c4:4bd2:6e00:6014:61d9:df8d:5974]) by smtp.googlemail.com with ESMTPSA id 8sm8393047wrb.55.2017.05.29.03.02.23 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 29 May 2017 03:02:23 -0700 (PDT) To: internals@lists.php.net References: <8de6a2ef-9602-e489-f19c-001005626b87@gmail.com> Message-ID: Date: Mon, 29 May 2017 11:02:19 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Parameter type widening RFC From: rowan.collins@gmail.com (Rowan Collins) On 28/05/2017 18:06, Aidan Woods wrote: > So, if I understand everything here correctly > > ``` > interface Foo > { > public function bar(Boo $Boo); > } > ``` > > and > > ``` > interface Foo > { > /* > * @param $Boo, pretty please accept type Boo here > */ > public function bar($Boo); > } > ``` > > will be equivalent in 7.2? :( No, what's being proposed is that this will be allowed: interface Foo { public function bar(Boo $Boo); } class Bar implements Foo { public function bar($Boo) { ... } } Whereas currently, the class would have to look like this: class Bar implements Foo { public function bar(Boo $Boo) { ... } } An interface's job is to provide guarantees to calling code about where and how an object can be used. It doesn't place any limits on what *else* the class can do - class Bar might have extra methods, public properties, be written in a completely different style, etc. Accepting extra types *as well as* the one specified in the interface is in the same category: the class is doing *more than* the interface, and that's none of the interface's business. I think some of the examples here are approaching interfaces as a broader contract, that allows a library author to say "you must implement the library this way". It's similar to the debate about whether strict type hints should be the choice of the caller or the callee. If you treat each module of the program as a black box, then all that matters is the guarantees of what's acceptable, which type hints and interfaces provide; but if you want more control over *how* somebody meets those guarantees, then I can see that this RFC, and the caller-selected type hint modes, would feel like a step in the wrong direction. Regards, -- Rowan Collins [IMSoP]