Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:78821 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 57501 invoked from network); 6 Nov 2014 15:08:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Nov 2014 15:08:29 -0000 Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 209.85.218.45 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.218.45 mail-oi0-f45.google.com Received: from [209.85.218.45] ([209.85.218.45:33999] helo=mail-oi0-f45.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5C/A7-28384-CEE8B545 for ; Thu, 06 Nov 2014 10:08:29 -0500 Received: by mail-oi0-f45.google.com with SMTP id v63so871555oia.18 for ; Thu, 06 Nov 2014 07:08:25 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=5fLz3RR7FCnp3IyBx4IcqgOWM+WcMhJc5MsdsRAIsjk=; b=J5buLv7tzFux+e1tPEvNiLoYNT+WYt01DRyVxGyQYhLJqvfS9231ws6HB4L8WozVpS BLi3jxCaQwEsnTSNVvAfvpNCiGoFLCphPdk5SfZWks8z00fnXbE2zh8hlkpB2Lv+0c8z GeM+CW7csO8U3KLXdad8lHCLPHsCjLHWu4PVBdZuzzfZ4KvFCqKJn+axyUdAfKroA8Gq qlRR4E/09zXYMQyMalwGXy1I5+tSPLLc4uP2rGgnxqxGs6dMcT9eyD0ysEsERTp8tBRB glBul6o4MZ1x8TyB9zsxuV0LkaMRwqpuh0zxFGbHZUbQRmhWNrz4/ezN6RU+LGQPaGIi By7A== X-Gm-Message-State: ALoCoQnbPXeWNV+ysw67UrehWWaX7iaWfWwP6appWHEP0lL636X75j/bvBBaSU6iOFtz19fw6GaOZkGe1IZPtws9si91ayaifgit/OOJ4JqqsL1S9wtuNa4RBP6jHNyhbzwxJD/XoloEZvtctlpivSiKdE0pU5tezA== MIME-Version: 1.0 X-Received: by 10.202.220.195 with SMTP id t186mr2141853oig.86.1415286505755; Thu, 06 Nov 2014 07:08:25 -0800 (PST) Received: by 10.60.70.41 with HTTP; Thu, 6 Nov 2014 07:08:25 -0800 (PST) In-Reply-To: References: <5B1B375C-328B-40BD-B715-8EDA158B44CE@ajf.me> <545A912A.2050202@sugarcrm.com> <545AA193.6060606@sugarcrm.com> <3E396F3F-CD59-4198-8FD2-1A8C4ED3B87A@ajf.me> <5BB43ECD-089D-4DDD-AD95-1263B05279CB@ajf.me> Date: Thu, 6 Nov 2014 19:08:25 +0400 Message-ID: To: Andrea Faulds Cc: Levi Morrison , Stas Malyshev , internals , Nikita Popov Content-Type: multipart/alternative; boundary=001a113d3e206e6d0005073211c4 Subject: Re: [PHP-DEV] [RFC][Vote] Return Types From: dmitry@zend.com (Dmitry Stogov) --001a113d3e206e6d0005073211c4 Content-Type: text/plain; charset=UTF-8 Use A or B for return type in B::foo(). It'll lead to compile error anyway (Class C is not defined). It's not possible to compile this by design. Thanks. Dmitry. On Thu, Nov 6, 2014 at 6:00 PM, Andrea Faulds wrote: > > > On 6 Nov 2014, at 07:43, Dmitry Stogov wrote: > > > > It may be a serious new problem. For example you won't be able to compile > > the following code at all? > > > > > class A { > > function foo(): C {} > > } > > class B extends A { > > function foo(): C {} > > } > > class C extends B { > > function foo(): C {} > > } > > ?> > > > > The similar code with argument type hinting works fine. > > It's just a first example I could imagine, I believe, we will get more... > > I can't see any reason that example wouldn't work. The types didn't > change, so there's no class loading needed for the covariance check. > > -- > Andrea Faulds > http://ajf.me/ > --001a113d3e206e6d0005073211c4--