Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:109547 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 35918 invoked from network); 7 Apr 2020 12:28:10 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 7 Apr 2020 12:28:10 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 4E13E1804F2 for ; Tue, 7 Apr 2020 03:56:02 -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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) (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 ; Tue, 7 Apr 2020 03:56:01 -0700 (PDT) Received: by mail-wr1-f53.google.com with SMTP id h15so3325760wrx.9 for ; Tue, 07 Apr 2020 03:56:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=z8wVnRrjs5HOdBjt9szvTxmXlLzXydKjLprBQWE8YQc=; b=AlzVn8Ux5UfcTxRZ/UWYSyaZ95y2Wt6pTKQQOY3PzPlkmwqrcx+fuIDSG+IZ87U1Tm CbnEL3AEKMhfnpCMYMuWl8pYJebtAOs2JuGM37DTMH3rCZBfJaEOmMhyG+H9RCNA7oIK 4MOz9LVCf1uTzITNLoIUhKTxzNd6BmJ7v9ht0YeoxmVAftLviIn9bMFVvGD+POr0c+EQ IEIwa6Y12tHgjwtqB2cc/zbv4X8DYIBWKJ4dvKqVT2CfeVtlA0uf78b0U5SyN9Qt+eZ7 IJuj45rPEBNxcqRGha9COR4/urxjiQw3PYoKBS9+IzMcQrfz6lk17u+hbAXR4Lu197M1 PhXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=z8wVnRrjs5HOdBjt9szvTxmXlLzXydKjLprBQWE8YQc=; b=NzCXm09o+6vfCksLKUCf5/4m3dF9to6wQXzf7WoaA/b6aSi1aXz0RDIV0CqWsmc/Wa 9PtPoXE9DvKKX84ixEQnWZgSKNTClfaDqrOJO6qPTrnjJ1VBf45OgrqUO/qDRRNuKj0t ddIzxS3e17zL3Ew4jRcyca6G3so3W9fAVz2YQSxg3m6kShiEitKDrQeqj4SyqGZJ/Rg3 BZhuT/hKpA5H5k0zzF+q9JzNqd2Hu+s5ge+CGgX5z3P5D6CHPEiE8bpt9+NuhUdQrWET 9zWlkygW7iyGT1Hcptr/3rTs0pbXDqiZQ0inpWoZUrVbceNwafFw4KOh68EmXKO+xS/B Vmug== X-Gm-Message-State: AGi0PuaYLWgLTLx/j1VIAyyax+2iuKCZHzbnW9ooRM4doM0WzBx7CP3a MUmRqPgaY/tRJZZ5BlxvVPQ= X-Google-Smtp-Source: APiQypKX/mUxPpN8eDz2IHjddujgpOi9+YWapYzwzqCaShgM+cC6iYUNtjtZPrvfYhFpciBPZs3Ppw== X-Received: by 2002:adf:a1d6:: with SMTP id v22mr2175029wrv.416.1586256958944; Tue, 07 Apr 2020 03:55:58 -0700 (PDT) Received: from claude.fritz.box ([185.129.54.212]) by smtp.gmail.com with ESMTPSA id v7sm3220849wmg.3.2020.04.07.03.55.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Apr 2020 03:55:57 -0700 (PDT) Message-ID: <90F4B395-F010-4196-9C40-7896D4F3F2F4@gmail.com> Content-Type: multipart/alternative; boundary="Apple-Mail=_30FF7173-581F-499D-A308-72BDC1F52307" Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) Date: Tue, 7 Apr 2020 12:55:56 +0200 In-Reply-To: Cc: PHP Internals To: Gabriel Caruso References: X-Mailer: Apple Mail (2.3608.80.23.2.2) Subject: Re: [PHP-DEV] [RFC] [DISCUSSION] Ensure correct magic methods' signatures when typed From: claude.pache@gmail.com (Claude Pache) --Apple-Mail=_30FF7173-581F-499D-A308-72BDC1F52307 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > Le 5 avr. 2020 =C3=A0 16:01, Gabriel Caruso = a =C3=A9crit : >=20 > Hello, internals. >=20 > Hereby you can find the RFC Document that I want to discuss as = suggested > via https://externals.io/message/109416 and > https://externals.io/message/107990: >=20 > https://wiki.php.net/rfc/magic-methods-signature >=20 > Best regards, >=20 > -- Gabriel Caruso Hi, Regarding __construct(), etc. Since those methods are not supposed to = return anything, they ought to accept the `void` return pseudo-type in = their signature, which means exactly that: =E2=80=9Cdo not return = anything=E2=80=9D. I consider that the current behaviour (i.e., not = accepting the `: void` signature) as a bug, and was very surprised when = I stumbled on it. ------------ Also, I raise the following question: Should omitted types be added implicitly? I.e., if I write: `function = __toString() { }` should the compiler interpret it as `function = __toString(): string { }` ? (Currently, it is not the case.)=20 Doing so would raise BC concerns for some, uh, creative uses of magic = methods. On the other hand, that may help to add progressively type = informations on magic methods, since there is no need to synchronise = manually classes and subclasses (the compiler would do it automatically = for you). Concrete example here: https://3v4l.org/hTMvA = =20 =E2=80=94Claude --Apple-Mail=_30FF7173-581F-499D-A308-72BDC1F52307--