Newsgroups: php.internals,php.internals Path: news.php.net Xref: news.php.net php.internals:97222 php.internals:97223 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 12227 invoked from network); 29 Nov 2016 11:57:12 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Nov 2016 11:57:12 -0000 X-Host-Fingerprint: 217.240.243.255 pD9F0F3FF.dip0.t-ipconnect.de Received: from [217.240.243.255] ([217.240.243.255:1295] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 37/D8-19217-51D6D385 for ; Tue, 29 Nov 2016 06:57:11 -0500 To: internals@lists.php.net,Niklas Keller , "Christoph M. Becker" References: <05c849b4-5d84-f77b-7fdb-09ecbe9dc07e@gmx.de> Cc: PHP Internals Message-ID: <75558afa-c44d-b968-99ee-f9260ac2a4e5@stricted.net> Date: Tue, 29 Nov 2016 12:57:05 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Antivirus: avast! (VPS 161128-1, 28.11.2016), Outbound message X-Antivirus-Status: Clean X-Posted-By: 217.240.243.255 Subject: Re: [RFC] Parameter No Type Variance From: info@stricted.net (Jan Altensen) no please no "mixed" keyword my idea to this is having something like this: class Foo { public function test (int $a) : int { return $a; } } class Bar extends Foo { override public function test (string $a) : string { return $a; } } class FooBar extends Foo { override public function test ($a) { return $a; } } or maybe this too class Bar extends Foo { override private function test (string $a) : string { return $a; } } so you have to mark the override explicitly if you leave the override keyword it still throws a fatal error dunno if this is a good idea or not, just my 2 cents Regards, Jan Altensen (Stricted) Am 26.11.2016 um 16:54 schrieb Niklas Keller: > 2016-11-21 12:59 GMT+01:00 Christoph M. Becker : > >> On 21.11.2016 at 10:39, Niklas Keller wrote: >> >>> I'd like to announce a RFC to allow omitting the type declarations for >>> parameters in subclasses: >>> https://wiki.php.net/rfc/parameter-no-type-variance >>> >>> PHP doesn't currently allow variance for parameters as checking these for >>> compatibility isn't possible on compile time. >>> This limitation is caused by autoloading and doesn't allow widening the >>> accepted parameters. >>> >>> This RFC proposes to allow ommiting the type entirely in a subclass, as >>> dropping all parameter constraints is >>> always valid according to the LSP principle. >> >> Have you considered that instead of simply omitting the type >> declaration, one would have to mark the omission explicitly, to still >> get a compile time warning in case of unintended omission >> > > No, not really. While we could use "mixed" there, those signatures _are_ > compatible without it and shouldn't throw a warning. > > Anyone else interested in the usage of "mixed" as an explicit type > declaration? >