Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:81907 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 56571 invoked from network); 5 Feb 2015 12:14:23 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Feb 2015 12:14:23 -0000 Authentication-Results: pb1.pair.com header.from=mike.php.net@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=mike.php.net@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.173 as permitted sender) X-PHP-List-Original-Sender: mike.php.net@gmail.com X-Host-Fingerprint: 209.85.212.173 mail-wi0-f173.google.com Received: from [209.85.212.173] ([209.85.212.173:59717] helo=mail-wi0-f173.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BE/95-27691-D9E53D45 for ; Thu, 05 Feb 2015 07:14:23 -0500 Received: by mail-wi0-f173.google.com with SMTP id r20so38447995wiv.0 for ; Thu, 05 Feb 2015 04:14:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=lYVS0v8bubWTZKyCWo4YTrGkND4gxnYbw6cVjHbWzhA=; b=DrmGiiF/k2uMDYAtFdQxi4ma4RDPFYRc07qc3vxb8Xh7zwzHcL96+kssegERW5A6/L xEJiLcHeO9QSmBbjpAyf147cUIHSmbSXtmm62Ls1beZviKJ4Vo0j5TN16/Ts8eoATYl+ o2A6Vc5cgL/iG4xNztdDWN0v5SvlP4X5U5pFPwcl8UMUMnNQnogn1kAYBZ24AZbQ/jgg vtZa6TXAmiwYHVS/wf+c/3bcv8xfSMwwde/gtWiecKXPLsyLuQfEs9k7V2Atsac+HpWA smZWwPZpnqm8+OlFrzN1v91MxTvKbRpKBasiOzKPav1rN9b58OXiEBSVgu/Bwm7mFffq s8pg== X-Received: by 10.180.104.34 with SMTP id gb2mr13571149wib.7.1423138458537; Thu, 05 Feb 2015 04:14:18 -0800 (PST) Received: from [192.168.2.120] (89-104-28-113.customer.bnet.at. [89.104.28.113]) by mx.google.com with ESMTPSA id r7sm843396wjw.23.2015.02.05.04.14.17 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Feb 2015 04:14:17 -0800 (PST) Sender: Michael Wallner Message-ID: <54D35E98.1090107@php.net> Date: Thu, 05 Feb 2015 13:14:16 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: internals@lists.php.net References: <4A36329B-F17B-4665-A84E-D8CF01F5B29A@ajf.me> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Allow dropping typehints during inheritance From: mike@php.net (Michael Wallner) On 05/02/15 13:10, Julien Pauli wrote: > On Thu, Feb 5, 2015 at 2:08 AM, Andrea Faulds wrote: > >> Hi Hannes, >> >>> On 4 Feb 2015, at 23:58, Hannes Magnusson >> wrote: >>> >>> So what it supports "more inputs"? >>> It does constitute an LSP violation. "more inputs" is not what the >>> guarantee is at all, if that is what you want you'd typehint on a >>> interface. >>> >>> >>> It is a LSP failure to allow a string, or any other scalar value, when >>> the parent requires a specific type/object. >>> >>> It sucks that we fail our arginfo very frequently, but this is the way >> it is :] >> >> An interface requires only a minimum standard for accepted input. If a >> class implementing that interface allows a wider range of values, but still >> allows at least what the interface requires it to, it is not an LSP >> violation. Scalars are not special. >> > > If we allow larger type, why doesn't such code work ? > > interface A { } > interface B extends A { } > > class C { > public function foo(A $a) { } > } > > class D extends C { > public function foo(B $a) { } // E_STRICT > } > > This is wrong IMO. > This is not "larger" but *more* specific. -- Regards, Mike