Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:91469 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 27006 invoked from network); 1 Mar 2016 17:32:08 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Mar 2016 17:32:08 -0000 Authentication-Results: pb1.pair.com smtp.mail=me@kelunik.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=me@kelunik.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain kelunik.com from 81.169.146.220 cause and error) X-PHP-List-Original-Sender: me@kelunik.com X-Host-Fingerprint: 81.169.146.220 mo4-p00-ob.smtp.rzone.de Received: from [81.169.146.220] ([81.169.146.220:45583] helo=mo4-p00-ob.smtp.rzone.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 31/31-16874-612D5D65 for ; Tue, 01 Mar 2016 12:32:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1456853523; l=3004; s=domk; d=kelunik.com; h=Content-Type:To:Subject:Date:From:In-Reply-To:References: MIME-Version; bh=4+RTHuzbAg8YLT03K5OYeWQYAuAyr9Lekud1zkjY0bY=; b=QaEvMJX6AY1Uvepi/Bvyia7miabD0xe1V1RS/icBwt94SQaojtNONKl6SILA+OjLAlU 4T3TJTr5Z+jjCnxVgEloc4xqGXO6D3u0qPJGYMpdDnXt22kJRgs8ICusEEtDuDiwUfOyN LmUisJy5QC5i6b1bVM5GTO5P3ClygLYAK1I= X-RZG-AUTH: :IWkkfkWkbvHsXQGmRYmUo9mls2vWuiu+7SLGvomb4bl9EfHtO3Q6 X-RZG-CLASS-ID: mo00 Received: from mail-wm0-f47.google.com ([74.125.82.47]) by smtp.strato.de (RZmta 37.20 AUTH) with ESMTPSA id g059afs21HW32v5 (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA (curve secp384r1 with 384 ECDH bits, eq. 7680 bits RSA)) (Client did not present a certificate) for ; Tue, 1 Mar 2016 18:32:03 +0100 (CET) Received: by mail-wm0-f47.google.com with SMTP id p65so43773859wmp.0 for ; Tue, 01 Mar 2016 09:32:03 -0800 (PST) X-Gm-Message-State: AD7BkJIu3ej165rKlxaBrObrCZuz3e/FzSvMPsn0+W7kDHp04nIg674QzI1ss77KbSQwtFdZ63aZ6ruReZ4YwA== X-Received: by 10.28.88.15 with SMTP id m15mr213798wmb.60.1456853523033; Tue, 01 Mar 2016 09:32:03 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 01 Mar 2016 17:31:53 +0000 X-Gmail-Original-Message-ID: Message-ID: To: Lee Davis , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=001a1144294cbaf722052d0024b5 Subject: Re: [PHP-DEV] Allowing static as a return type From: me@kelunik.com (Niklas Keller) --001a1144294cbaf722052d0024b5 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable The reason is probably that return types are currently invariant, so a inheriting class would have to declare the parent as return type anyway. Lee Davis schrieb am Di., 1. M=C3=A4rz 2016 12:46: > Hi Internals, > > whilst recently playing with return type hints on PHP 7 I noticed that > "static" cannot be used as a valid return type. I'm not entirely sure > whether this has been purposely prevented or not. > > https://3v4l.org/LEXis > > The behaviour works it's just a parse error that's stopping it. It's fair= ly > easy to get around this behaviour by using 'self' on the return hint > however I'm not too sure how correct this is considering you might want t= o > have that method be extendable. > > https://3v4l.org/rk4W6 > > I always considered 'self' to represent the class where the definition > lies, and 'static' to mean the caller class (i.e. when using LSB) so it > might be something that you'd want to define on the type hint. > > Do you think this is something we should allow into the type system? > > Thoughts? > --001a1144294cbaf722052d0024b5--