Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113622 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 97702 invoked from network); 19 Mar 2021 17:00:02 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 19 Mar 2021 17:00:02 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 5A737180504 for ; Fri, 19 Mar 2021 09:54:34 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.1 required=5.0 tests=BAYES_20,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-lj1-f173.google.com (mail-lj1-f173.google.com [209.85.208.173]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 19 Mar 2021 09:54:33 -0700 (PDT) Received: by mail-lj1-f173.google.com with SMTP id r20so12822920ljk.4 for ; Fri, 19 Mar 2021 09:54:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=aahXdaXhzkDDhgg5I3KWc/1V0O/SUAOIv6+QaEiQorQ=; b=qhGJY8bam44rbLckQ6d9S0HjMkI3VfSjlnYIOzgmfg0SxzSGM6KciEW0d/JBN2DwEq eGm07b0g7cKy6UwJCeUY/0Z80r4XRntTwjk71pVQOkrNWJAbD2H0a7F4evSIRthPOyKv 5m3pKQwP57L7zFx+Elq3hNd91NEw8WYdEOUQTLPSaPF9quD8BU5JYPUyMhY8ZxvJSmfN mx8LqTJOxijCHcMPNjNnXkKd7eVN5QOMu3wFp1B0QuMKAlHY78W/ggLFkoM4bBiebqIl Tw0tTBtDjBBMjznjXdF/hyvbH3tvRTKa/M/ch3LLNAiAYpWkGxnfspC61bGqM+ISoKNR l4JQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=aahXdaXhzkDDhgg5I3KWc/1V0O/SUAOIv6+QaEiQorQ=; b=I93i5sp+A0h0IR1wlEmMnLMwNRaX8sX5A5B+1b5mczZC+d642+JIkfBSLl0iQZO2TD 7LbC8eU7gZ0Zu7cfdDyHYOeWZPcvO/LdvQa9i2XQR+MuvYVR7iBp14hScKO08Y2hvGhg GdJvgAfnBRjgCMtkiWxTRdkilg2sM0N01iQTAm0oX884VpXfEef2F93NGn+o5FrvZz4L aV+hZ0ceVdj+vVcI6SkbkB8FumeGyeUqw6C22mongWCNySA4Q2pYC0JacNe0HRfPrP+I kP1b+8Yi2OscCPEwZjew7w6BnWTJIbu+aaz5N0zrjw0OPK3WCjanNT7Yc9g5mZ5FhzY/ RFmg== X-Gm-Message-State: AOAM531+mI0JxZsRum8jJV+SooOQQjbZnUClaZDECankqFUPz5VZfecC BKTooJPEaxag+EGBRXg4KwmlH/apQR3u6A8I7p4= X-Google-Smtp-Source: ABdhPJzHbXtwGgIRhNsOei1nMQaczIG+6zHGPhO5aU4LdmXzY0gH/nuJTyhv6bl3ohGIsz1LFF+OwVJO0WKFLO+09Dc= X-Received: by 2002:a05:651c:1189:: with SMTP id w9mr1482576ljo.377.1616172869909; Fri, 19 Mar 2021 09:54:29 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Fri, 19 Mar 2021 17:54:18 +0100 Message-ID: To: Nicolas Grekas Cc: Nikita Popov , PHP Internals List Content-Type: multipart/alternative; boundary="000000000000ce81ef05bde69193" Subject: Re: [PHP-DEV] [RFC] [Discussion] Adding return types to internal methods From: kocsismate90@gmail.com (=?UTF-8?B?TcOhdMOpIEtvY3Npcw==?=) --000000000000ce81ef05bde69193 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Nicolas, > Oh, I didn't get this at first: you're telling that this native return > type would not be enforced when the attribute is declared? This should > answer my previous comment. > Yes, that's the case. On one hand, this solution IMO has the advantage that its syntax integrates into the ecosystem much better, including php-src itself (as I mentioned in my previous mail). On the other hand, it might be a little bit deceptive at first that the type declaration is not enforced when the attribute is present. Nonetheless, I still prefer this solution over storing types as a list of strings. I'm not sure yet this is a good idea, because it would prevent userland > libs from using this attribute in an effective way until they bump to 8.1= ... The main proposal is about adding return types to internal methods, and the SuppressReturnTypeNotice attribute can already be added to any libraries. But you are right in connection with the TentativeReturnType attribute, libraries would have to bump their minimum PHP version requirement to 8.1 in order to be able to add return types without a BC impact on PHP <8.1. I think it's still the less bad option. As this RFC's primary motivation is to prepare for adding return types to internal methods, I'm planning to add a secondary vote about exposing tentative return types to userland, since I'm not 100% confident that this concept is worth the special care in PHP itself. M=C3=A1t=C3=A9 --000000000000ce81ef05bde69193--