Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:109588 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 22650 invoked from network); 11 Apr 2020 22:12:17 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 11 Apr 2020 22:12:17 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id D5D161804D0 for ; Sat, 11 Apr 2020 13:41:14 -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,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-f170.google.com (mail-il1-f170.google.com [209.85.166.170]) (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 ; Sat, 11 Apr 2020 13:41:14 -0700 (PDT) Received: by mail-il1-f170.google.com with SMTP id f16so5177433ilj.9 for ; Sat, 11 Apr 2020 13:41:14 -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=rCqnJaE4mm/4Ai/srqOxtsVPukYFNAQ0z0KVFZA0zHc=; b=ltyOruoQ+UeGQ6xH9A3VAZi58r1l2BSzAAFf9/0a1r9psdVWtpJzzsoIQCgUt+7aEt iNITQCq8ynn/b443SvrNroReR7avnHkMOWQBnOyO53+NYHrQI5cBcXdOhxvMeWmbKWlg u626AAVcNuR7ZZXCYLu/UXnh2iovXzBBsOU0TCLSy05m+Pk7t4sHm0uCGcElU4GqDPOr G0miG5KAbFuc8lwVjZZ8O2rHWkFcJTbIAgWjng5RMdfL0qFPgLxzgWavMtlgs5hLdWgF u0GLZMGbbIg+WmHkn4T++QLUbZ4epaft7w36N/UthfUhO20gdYSc6HgAQJXcWGfXH/FD 1CCw== 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=rCqnJaE4mm/4Ai/srqOxtsVPukYFNAQ0z0KVFZA0zHc=; b=Gx0oWq4ujZcIS0VBsOzSw5yvbdtobU4zlGrSBCE4jg1Su97aWjdytADAJMsyFeMsGP 1+4kVwwDhhwCuFYe83+VmPkfMjk+GakRu8jTuXwYucqjgbaFXHooBxZqXcF6wyQ7heVr l2+XCZ7IwZC+67EnsPNLbHsISaUpAJE9MDzggel4RzauIsAyFb4xF/Vtpbu39Lq3WrwO y30HneDpQSAY85nkewHjRFkN6GaStVPzGcZDoEkljuUNT1/HfhrLaBEWE0vSJDnXabDv MS9uBMHSeN3MnpfnuNZXblIWBdZDrJsfMTroklb2qJczUeTCjc/HmcJhWPxyWfc461Q6 Ea9Q== X-Gm-Message-State: AGi0PuYi/DCwRhO9UnDJ51w3bwNwrNef0hxZRIEmGvaBWIw4ycIlzPT3 HiCak/uYBHctlVDa3jG3pwIROWPjFtLt2RTXol4= X-Google-Smtp-Source: APiQypJaFCk/mQGAlZrhUKXqB6/bTA85N2dPh60WMhoPaOrOahNfmRTBeqse7l0BLYnvuPTnBkpznp3J6J8x0R+FWrQ= X-Received: by 2002:a92:409a:: with SMTP id d26mr10666025ill.153.1586637670756; Sat, 11 Apr 2020 13:41:10 -0700 (PDT) MIME-Version: 1.0 References: <90F4B395-F010-4196-9C40-7896D4F3F2F4@gmail.com> In-Reply-To: <90F4B395-F010-4196-9C40-7896D4F3F2F4@gmail.com> Date: Sat, 11 Apr 2020 22:40:59 +0200 Message-ID: To: Claude Pache Cc: PHP Internals Content-Type: multipart/alternative; boundary="000000000000c0b8b305a309de0a" Subject: Re: [PHP-DEV] [RFC] [DISCUSSION] Ensure correct magic methods' signatures when typed From: carusogabriel34@gmail.com (Gabriel Caruso) --000000000000c0b8b305a309de0a Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, 7 Apr 2020 at 12:55, Claude Pache wrote: > > Le 5 avr. 2020 =C3=A0 16:01, Gabriel Caruso a > =C3=A9crit : > > Hello, internals. > > 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: > > https://wiki.php.net/rfc/magic-methods-signature > > Best regards, > > -- Gabriel Caruso > > > Hi, > Hello Claude, > > 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 anythin= g=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. > > I'll add to the RFC adding the possibility of typing the `__construct()` as `: void` as one of the changes. > ------------ > > 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.) > > 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 f= or > you). Concrete example here: https://3v4l.org/hTMvA > > This RFC does not cover analyzing the return of magic methods nor adding simplicity types. I'll add a note about it in the RFC. > =E2=80=94Claude > Thanks! --000000000000c0b8b305a309de0a--