Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114065 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 55439 invoked from network); 18 Apr 2021 13:49:53 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 18 Apr 2021 13:49:53 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 4C1E91804DD for ; Sun, 18 Apr 2021 06:51:52 -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_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.52]) (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 ; Sun, 18 Apr 2021 06:51:51 -0700 (PDT) Received: by mail-pj1-f52.google.com with SMTP id f6-20020a17090a6546b029015088cf4a1eso1204177pjs.2 for ; Sun, 18 Apr 2021 06:51:51 -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=qsS6mSYkqyWYpfQRcoGnI401hmXT3/5ESoit5oAb7M0=; b=YG5t1xVBiNqZK8KG+TtJXbKIyiD5zQ2JINErfAzxXyk3enrf+bjspdKdYj4XicE5Yz Wmhj7BW7Hvv0UugpfzRmHgsib8B/4De0Q9fKuCu/tfNWey/TR3JMnVCaL7b3Ugn+KkMg Yljnu+I/wDbZPOwGOGb21hZxo320RWlw0RVskYhwG8fRv5KT7jcEa7NdRNv000+f5KHO AaGgHKnFPstTxVrTeGXEnbKivZ6UflN011cpGkUvZLW0SltdUgA9RpanLRhKuaTgbVY8 qEc5QCASwtH0ew9c4nO2UzIfcds0XtROf0lWIKFG+rjsEOMh1PfsmptjoDYRbLPqaw/a /NGg== 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=qsS6mSYkqyWYpfQRcoGnI401hmXT3/5ESoit5oAb7M0=; b=U5uiQ5KSXQFr+AXdJODqVA1K105wPYpseA8oGXcf4buPN+AiFp6+N2r8iWa3kwoed2 tOT3TTh6aBiKe+SIj6v6JuA4T2GrKNqRxHC9A33oNqlRDCdENkbwGnZEgkPG+7vn+AQK R9xrRbLmrXjlDIL3Bl+yH7NrVuFSt/1E185WaWi3howEcp963rNS77bk3tTVn4QgEc+n F2JYxRoR7m8hXxKzp0XUQzCkwi1876Y/YwuCcg4sn30Bx4hfsIdmDSzpo8n6DnxMndQ0 wIq8K4ZsK0A6h5J074u2EWnL6UijURUwE6USJ6dIDjeBFLultSidksOAYTGKmmrsMo+2 RlZQ== X-Gm-Message-State: AOAM533OyE4wVBlBuvMqHoQNPH+wChR6xahReMOXn+TQMK9+E0fJYhmI 4ADGJ0F4/oinuaT1pRrNjyFjf15WglM64Ci+ymw= X-Google-Smtp-Source: ABdhPJwOPPnZ3/AH7UCPPBO2OyKMJGVD2L67fXCGfdFGpTV3j0x/wGfaJW2LinViTm1fThny7jRGJAHodfCRWWW+L34= X-Received: by 2002:a17:902:8ec1:b029:e9:998d:91f3 with SMTP id x1-20020a1709028ec1b02900e9998d91f3mr18276134plo.59.1618753910682; Sun, 18 Apr 2021 06:51:50 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Sun, 18 Apr 2021 15:51:39 +0200 Message-ID: To: Nikita Popov Cc: PHP Internals List Content-Type: multipart/alternative; boundary="000000000000d336d605c03f832e" Subject: Re: [PHP-DEV] [RFC] [Discussion] Adding return types to internal methods From: kocsismate90@gmail.com (=?UTF-8?B?TcOhdMOpIEtvY3Npcw==?=) --000000000000d336d605c03f832e Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Thank you, Nikita, for the wise wrap-up about the general problem and the possible solutions! I think as far as the original motivation is concerned (adding return types > to internal methods), the RFC as proposed does well. The only thing I wou= ld > change is to add the ReflectionMethod::getTentativeReturnType() part > independently of the userland aspect. I believe it's important that this = is > exposed in reflection, even if the more general userland functionality is > not provided. For example, if you have a mock generator, you'll probably > want to either add the tentative return type as a real return type to > mocks, or at least automatically add the #[SuppressReturnTypeNotice] > attribute. > Initially, the reflection-related changes were a core part of the RFC, but since I didn't find a really good use-case for ReflectionMethod::getTentativeReturnType(), I moved it to the secondary part. I think your example highlights really well that it's needed indeed, I've just put it back to the core proposal. > I'm more ambivalent about the userland side of this proposal. As Nicolas > has already pointed out, the RFC as proposed requires the library to have= a > PHP 8.1 minimum version requirement to make use of this functionality. An= d > libraries requiring PHP 8.1 are likely not the target audience for this > feature -- at least not when it comes to adding return types at all, ther= e > might still be a use when it comes to changing them in the future, as > typesystem capabilities are expanded. > I agree here as well, as neither I am a fan of the current implementation. Especially after you made me realize that it doesn't even solve the general problem completely... That being said, I've just got rid of the userland-related part of the RFC, since this is something somebody can implement later after giving some more thought for the feature. Now that the controversial part has been removed from the RFC, I'd like to start the vote shortly (late next week), in case there is not any more feedback. Finally, I didn't rename the SuppressReturnTypeNotice attribute, but I'm open to do so if you strongly prefer TentativeReturnType of ReturnTypeWillChange (although I like the latter one more). M=C3=A1t=C3=A9 --000000000000d336d605c03f832e--