Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:81905 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 54105 invoked from network); 5 Feb 2015 12:10:59 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Feb 2015 12:10:59 -0000 Authentication-Results: pb1.pair.com smtp.mail=julienpauli@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=julienpauli@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.171 as permitted sender) X-PHP-List-Original-Sender: julienpauli@gmail.com X-Host-Fingerprint: 74.125.82.171 mail-we0-f171.google.com Received: from [74.125.82.171] ([74.125.82.171:59001] helo=mail-we0-f171.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 89/15-27691-2DD53D45 for ; Thu, 05 Feb 2015 07:10:58 -0500 Received: by mail-we0-f171.google.com with SMTP id k11so7329286wes.2 for ; Thu, 05 Feb 2015 04:10:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=lDsf7T15lhRFLDcNlPxpN6Sz/D9ArfC4DBUtsld1jGs=; b=dx2L1IqnQIDAgHF4DAVAYFIIt75SfkQ7o+XiOYCPEuyS7PXtBwG20rFfzi1JJgGHYG FWKXgL1MddVetRJI8GwX7b6e04qcHuTpNL6raMqKMWeqlC0qS5FHatQcGsDms51OfVeA 3asHgVBC9Q7c/qsmbJSe9xLoIlAE+BzzsPUdw8KsObAeEVJikf/XV9gxgZvtg6XEw4VU wM4Z9muB+yw9Arjp0OVlYE/c+R9goCngD++rUdV0S8IXanxOZU5qIYHokAXvg9fUYoGx UAtaZTEARPom3FE2M/PbtAXRCUMrMHXozeVLnwAE2/ZygkdZP629BExf0RHCoxcodZ+D lcBQ== X-Received: by 10.180.75.168 with SMTP id d8mr55753960wiw.74.1423138255220; Thu, 05 Feb 2015 04:10:55 -0800 (PST) MIME-Version: 1.0 Sender: julienpauli@gmail.com Received: by 10.194.94.137 with HTTP; Thu, 5 Feb 2015 04:10:13 -0800 (PST) In-Reply-To: <4A36329B-F17B-4665-A84E-D8CF01F5B29A@ajf.me> References: <4A36329B-F17B-4665-A84E-D8CF01F5B29A@ajf.me> Date: Thu, 5 Feb 2015 13:10:13 +0100 X-Google-Sender-Auth: FmtjmjI8l56OPiohOp6pJOCzeTE Message-ID: To: Andrea Faulds Cc: Hannes Magnusson , Nikita Popov , PHP internals Content-Type: multipart/alternative; boundary=f46d04374ac32b5486050e5632cf Subject: Re: [PHP-DEV] Allow dropping typehints during inheritance From: jpauli@php.net (Julien Pauli) --f46d04374ac32b5486050e5632cf Content-Type: text/plain; charset=UTF-8 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. Julien.P --f46d04374ac32b5486050e5632cf--