Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:79173 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 8393 invoked from network); 25 Nov 2014 18:14:37 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Nov 2014 18:14:37 -0000 Authentication-Results: pb1.pair.com smtp.mail=morrison.levi@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=morrison.levi@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.173 as permitted sender) X-PHP-List-Original-Sender: morrison.levi@gmail.com X-Host-Fingerprint: 209.85.214.173 mail-ob0-f173.google.com Received: from [209.85.214.173] ([209.85.214.173:59887] helo=mail-ob0-f173.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 2C/1B-40624-B07C4745 for ; Tue, 25 Nov 2014 13:14:36 -0500 Received: by mail-ob0-f173.google.com with SMTP id uy5so890380obc.32 for ; Tue, 25 Nov 2014 10:14:32 -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:date:message-id:subject :from:to:cc:content-type; bh=q9OdVEmlJp1LLewsT+ZMzY7l14imyQpNKklxCmQqANg=; b=lrz+2KEoTJeI1RmL25a4n6/7V40fUNrKoBwQY824HXNwRv9r4fijP6m98y/tHxT9fE 6Xi0MYvS3932brhHGc1KLXj/P60jxObllvh7Fb+KDgQfsdxH1NC/0G2SeHWzIlKdSAAK TkmNjN48CpQxdvApYWj8LqI4vwoPW10x93c7xFeXXbOb3bbTcWGJpSHLzc8I8vFwdItk CB22AToAdmXHnb46CYuETKIBQNk9UoBMC69RJEcWiuvctiNRuSNlkSHIBm+DP6PX7jRc PGJL74BWJKM4AQYCeXbsEtZy662FiS+84XAZ6HlTnxEYx1tNXtHd/0Z8M4z8yTnue2tM 3u8g== MIME-Version: 1.0 X-Received: by 10.202.74.198 with SMTP id x189mr16283031oia.50.1416939272402; Tue, 25 Nov 2014 10:14:32 -0800 (PST) Sender: morrison.levi@gmail.com Received: by 10.76.89.237 with HTTP; Tue, 25 Nov 2014 10:14:32 -0800 (PST) In-Reply-To: <003701d008da$0c60d630$25228290$@tutteli.ch> References: <003701d008da$0c60d630$25228290$@tutteli.ch> Date: Tue, 25 Nov 2014 11:14:32 -0700 X-Google-Sender-Auth: wABiumi8fQCwH3LfoJKkor2NN1w Message-ID: To: Robert Stoll Cc: internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] [RFC][Discussion] Return Type Variance Checking From: levim@php.net (Levi Morrison) > It should be mentioned for Option 3 that covariant return types are not supported just at the definition level . Even with invariant return types the following is perfectly fine: > class A { > function foo(): B { return new B; } > } > > class B extends A { > function foo(): B { return new C; } > } Yes, this is correct; thank you for the clarification. The phrase "covariant return types" in the RFC and in my message above refers to the declared type in the function signature, not the type returned by the method. The value that is returned can always be subtype of the declared type.