Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:109811 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 26406 invoked from network); 23 Apr 2020 15:36:14 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 23 Apr 2020 15:36:14 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 97D4A1804F2 for ; Thu, 23 Apr 2020 07:08:11 -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=-1.8 required=5.0 tests=BAYES_00,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-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-il1-f196.google.com (mail-il1-f196.google.com [209.85.166.196]) (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 ; Thu, 23 Apr 2020 07:08:11 -0700 (PDT) Received: by mail-il1-f196.google.com with SMTP id e8so5621390ilm.7 for ; Thu, 23 Apr 2020 07:08:11 -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=IHpmfPCDbuFynWH/IAF5+hxUqG8gF7ClU9jEyZLVkx8=; b=p/7hwXMUtSvhDa77eQPsjCgw2IZl/Wi/KPyVI/kfmCxP5rW+09tHh38kUDLHj1m0Ne 9otlzTypdNONSlOCSBvOOQ+LigOKPLPOrmcAj3i4M/0GLSyvPSQGvA7jLcX0kyE6Ij0O Mq6DOvZSgEQsptCy8mEFSSdfC+ArIk5DIQDj2XTRsSV3xMfNfo11917HXLoN5FK7N6RP H4zoMGhJxG5D5SyT3GI9ia3YIp46mndeuXqqYEY88wmBGXftIAzMuGIfpTvwj/oSJfdX 6WqoquVR4BCGr7dj9rNUm+swIy3e82WkRhPaeipmrUPWIuOXgxgycUY8hWW1O9xXK01z thrw== 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=IHpmfPCDbuFynWH/IAF5+hxUqG8gF7ClU9jEyZLVkx8=; b=Fdc9RcTlssyhbte3oV7WR/vzjbYpLmcRXl23RKiYVBU6nnvO1VNBv1mRqK9RhDHDuN XBOdz4BMorqipxghQtRvuuJDSn8oHB+LHiht1+wMnqv+WOYUeS2x1KHOm+fNCiVLZxVx zcGXbKQorU25BdXlrIA7y0m9LWqTpxgKAiqWbss2bKzD/tjWHOQ9/bUbxd6x+p8ngT8k UCJ2xwPpIn83C2WKrWHtIrLaM86sYWXJZZGPviXN3gFCgvwTI9YWtEWO+E4aglGJCCbe g9huUfbWpjBwizSOrmmsd0KW3LKREKYJFI8Wsi/q2r+FkWzqgdAlnPf2KPPZI5DgAYvz fIBg== X-Gm-Message-State: AGi0PuapysuCgMV5cR4h1w8a80r3ceWam7WwStqXdj9tBGVeY0OU8+23 fpiqYb3/iDw/rhDTJ+pBs79+C5tpkhuArsyXZuE= X-Google-Smtp-Source: APiQypIhXay3pFB/xZLFqlUvL3Px0pt1hSImdkf0eHXiBRNgLXiUeWV7gIDE19YX9zdh3YIG1sJGcGNP2ZTF0g/mgls= X-Received: by 2002:a92:d406:: with SMTP id q6mr3547071ilm.299.1587650889650; Thu, 23 Apr 2020 07:08:09 -0700 (PDT) MIME-Version: 1.0 References: <90F4B395-F010-4196-9C40-7896D4F3F2F4@gmail.com> <0A374409-6FA6-4E02-A7E6-EACA3E42451C@gmail.com> <436FD800-A316-4C99-8793-C6EF4BD15BE3@gmail.com> In-Reply-To: Date: Thu, 23 Apr 2020 16:07:58 +0200 Message-ID: To: tyson andre Cc: Nikita Popov , Claude Pache , Nicolas Grekas , PHP Internals Content-Type: multipart/alternative; boundary="0000000000004e16b805a3f5c7a2" Subject: Re: [PHP-DEV] [RFC] [DISCUSSION] Ensure correct magic methods' signatures when typed From: carusogabriel34@gmail.com (Gabriel Caruso) --0000000000004e16b805a3f5c7a2 Content-Type: text/plain; charset="UTF-8" On Thu, 16 Apr 2020 at 18:46, tyson andre wrote: > > Ah, so that's what this is about! In that case, I'd be happy to simply > > always enforce that __construct() cannot return a value, in the same way > we > > do for ": void" functions. (If we have backwards compatibility concerns, > we > > can add this as a warning instead of hard error.) > > I'd approve of that. It'd also be useful to enforce that __construct and > other magic methods aren't generators, > and that methods from traits renamed to __construct have the same > restrictions. > > ``` > php > class X{ public function __construct() { yield 2; }} > php > new X(); // nonsense > php > trait T1 { public function f() { echo "In f\n"; return 2; }} > php > class Z { use T1{ f as __construct; } } > php > new Z(); > In f > ``` > > - Tyson Hello Tyson, This falls under the `Future Scope` of the RFC ( https://wiki.php.net/rfc/magic-methods-signature#future-scope) as checking for the actual return value of these magic methods would be a larger BC. For now, only the signatures will be checked. --0000000000004e16b805a3f5c7a2--