Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:91467 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 9154 invoked from network); 1 Mar 2016 11:46:06 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Mar 2016 11:46:06 -0000 Authentication-Results: pb1.pair.com header.from=leedavis81@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=leedavis81@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.42 as permitted sender) X-PHP-List-Original-Sender: leedavis81@gmail.com X-Host-Fingerprint: 74.125.82.42 mail-wm0-f42.google.com Received: from [74.125.82.42] ([74.125.82.42:36651] helo=mail-wm0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D7/B0-04147-CF085D65 for ; Tue, 01 Mar 2016 06:46:05 -0500 Received: by mail-wm0-f42.google.com with SMTP id n186so32518530wmn.1 for ; Tue, 01 Mar 2016 03:46:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to; bh=GPOoGArQrJ39gHjS27SE7Ez00BvlGFh7tv/C0u1vT80=; b=B94LusYFXmIZqBKSxFrEzcszxMLbXoYEDfwzVskEiFcOw9PNMq9llE5+I3HbLoDvte vlyvBDVqOtM3VdzpyrFyHhpvGT+ZAtNvpBsOAsRBTkKZjLanMPAr9zid5kIecbYZoD9F u/As0DeidUmpZmlym4QA9M13aI4za2xmkCCO0LadRDEMGXB9BEtaOsDVR6OZsCmpU1K8 IB5XFDaNvfj/pkwQqK6wDFQpa29I8IqkOuxyUdkLXDrflrtRe/uDKNAucsiov0WFsd8i ihIqU33yHrxP/YQrDXmll8Mar8vCk1bh52OD42zTkWvikuSLJ6Rb1mRhfLeTwH4bY4LR oPKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to; bh=GPOoGArQrJ39gHjS27SE7Ez00BvlGFh7tv/C0u1vT80=; b=QsNunWROqoTMntSkAdJwJ6XsySP5IKvIujO2vVVMwanikIK0r0m7bXJ4zEpkgBhD6w 8mGKHWqIwLevb1bqYRGhDvwME2nlBHONiq59kqivc0FBnGL/KPQMMTH+In96TGPNaUJR +G29UI9qCfYdMFK/EOmr5ybstCLfZztyTghTZhBQiqmIrprGhUV1BHeagsJ2I+mDuAJ8 rLvu4bJN8Wu3SHbVWz2zZqEmNLuuuyHRvzHhsfCNw/PfrAtukTOwNFU95HpT50kTPaEt sbkeq8jsWgd/RrILifIsRH3VejBWH8PtVlUtE55fIVMdfYYQtKm4hktXc3Uo095pVBM8 I6/A== X-Gm-Message-State: AD7BkJIrU65CmfCNVNUeHp0tuX7rAgtXDle83px3lici3EFLS7C5SEm/her8wm7j2nvWbjX6Py3Q6vW6oDAFbw== MIME-Version: 1.0 X-Received: by 10.28.184.137 with SMTP id i131mr3109406wmf.96.1456832761824; Tue, 01 Mar 2016 03:46:01 -0800 (PST) Received: by 10.27.132.70 with HTTP; Tue, 1 Mar 2016 03:46:01 -0800 (PST) Date: Tue, 1 Mar 2016 11:46:01 +0000 Message-ID: To: "internals@lists.php.net" Content-Type: multipart/alternative; boundary=001a114b30d2440c76052cfb4fb1 Subject: Allowing static as a return type From: leedavis81@gmail.com (Lee Davis) --001a114b30d2440c76052cfb4fb1 Content-Type: text/plain; charset=UTF-8 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 fairly 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 to 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? --001a114b30d2440c76052cfb4fb1--