Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:109589 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 28596 invoked from network); 11 Apr 2020 23:00:36 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 11 Apr 2020 23:00:36 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 5ABE61804D0 for ; Sat, 11 Apr 2020 14:29:37 -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-f195.google.com (mail-il1-f195.google.com [209.85.166.195]) (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 14:29:36 -0700 (PDT) Received: by mail-il1-f195.google.com with SMTP id d2so4950815ilc.0 for ; Sat, 11 Apr 2020 14:29:36 -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=YtjAC48qZodutaGH9diwmkF5qhOK5kwOFg6A7st1cVQ=; b=RLP0QtM68PKw8zM/MpOQtUhfGC6Q2vmSRliL0gZUHv6Fiee1LpdLG3W4R2RYTbb3T4 2yMtiHJSXNgJhbBZDgzSEEhZzaKU+igSDsZedAZwnQfnNjFWnwgOvmrxDO1sosR+3NHL pQCaH163uAf2MzXQZS05x/gimLIy96sj92y0WeOSb+ctskZYUxi0Kj7wsPj8NH/Ni7MA RpH2GYCdcU2eKYOobOWRwihpmVtTcoPgFXrQ3CWtgEclJlPQ0V0UUGytQmC+V58MKYJg +TvWGOFL/lOJDJ4iBcUIRqi4P54RbjQIa6oMUQ3910E0qFsUVlZnhjCC3hE/4kLdQjRc +EXw== 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=YtjAC48qZodutaGH9diwmkF5qhOK5kwOFg6A7st1cVQ=; b=RxO7VdbPvm8DCqngyF6wfD3N8eWUI+NQsD5VfTEnWbllxND4ZmALb5yfIq7uxUdL7z DjNjpHqK316jZiPbs2oa8BRN8vQ2M8kxMutDmE1P3/o7qBvvmrHQg6r6kkyzND5YldUv RnVM9JQOKL8EPECfhzQMODOVBiX99mc9T7Z1eRZf5BZF8EGYq+brqBiYf/nBynByMaat Cqz96oWjMmxsse9jNsnvakTpSyzVy7MqDa3vDPTuMEpwZRsEUhqDS7qpckqPl3JRBVzX lf3FZB6zFUmgy1q84sctwqTReTnWY7HhRW35UUhFAU62ZgLPXR8/umuqTbOTIcLIEFF1 Ttrg== X-Gm-Message-State: AGi0PuYdlqRo0cy+UO4LOtmblUledNpNjov3dOD2R6UNZYpND24z+9aM x7Z8GsmjDJ70wnHENSVaNDObUE7EpH5tkUBiwUQ= X-Google-Smtp-Source: APiQypKvRxc7WQzBm5F9rne5joQwBU1allDOnrcIiHGs34cy46/lXdoDR2lSoVp7L8WAXWl3MQH9+1ZQfzYY1ANEje8= X-Received: by 2002:a92:49da:: with SMTP id k87mr10585758ilg.149.1586640574130; Sat, 11 Apr 2020 14:29:34 -0700 (PDT) MIME-Version: 1.0 References: <90F4B395-F010-4196-9C40-7896D4F3F2F4@gmail.com> In-Reply-To: Date: Sat, 11 Apr 2020 23:29:22 +0200 Message-ID: To: Claude Pache Cc: PHP Internals Content-Type: multipart/alternative; boundary="000000000000ceae4105a30a8b18" Subject: Re: [PHP-DEV] [RFC] [DISCUSSION] Ensure correct magic methods' signatures when typed From: carusogabriel34@gmail.com (Gabriel Caruso) --000000000000ceae4105a30a8b18 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sat, 11 Apr 2020 at 22:40, Gabriel Caruso wrote: > 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 anythi= ng=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 = for >> 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! > Btw, the problem that you reported about incompatible signatures will be fixed on PHP 8: https://3v4l.org/hTMvA/rfc#git-php-master. I've also added a test on the implementation ensuring the following: https://3v4l.org/5010J/rfc#git-php-master. Thanks! -- Gabriel Caruso --000000000000ceae4105a30a8b18--