Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:109633 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 22274 invoked from network); 14 Apr 2020 16:24:47 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 14 Apr 2020 16:24:47 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id C53091804C3 for ; Tue, 14 Apr 2020 07:54:28 -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_H3,RCVD_IN_MSPIKE_WL,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-ot1-f41.google.com (mail-ot1-f41.google.com [209.85.210.41]) (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, 14 Apr 2020 07:54:28 -0700 (PDT) Received: by mail-ot1-f41.google.com with SMTP id g14so4826973otg.10 for ; Tue, 14 Apr 2020 07:54:28 -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=9j8mS73PuDXzu8lUvXKgwJHc4lU6j/uq8ScPnODtZAg=; b=vDwfItNh9fKDxgU9+MfezAHJesTsOG7P9pvkywJb6PM5MORw+ufor1p+ja35G2FvT4 E5FKI1yPMfDAu+RE6Ta/9Dsiha6WMLQcPS9s927RIP9DKogbSHDb/EKGD0t/6CQfytmH gyTellA9p0CrOq2UR3cAfdB0+89tFIP52atcdhbSkm+kKew39YcobfHXZkT2tlIjlfdQ yxQk5a+QDgJEb7FsWNQhNpm/jyPebcWN79Ww5ebkogJ3U1lrb+jr3Hl2IIsjHz2IVe0Y 79VIAP6rDxbqKAeFXgj2GLrA1rAGQn33q51BLNdgo7zAzLQlUDBbhHiApU476Eh6gR6s d4jQ== 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=9j8mS73PuDXzu8lUvXKgwJHc4lU6j/uq8ScPnODtZAg=; b=BFX+Eh1YCppyotMV5FPPwsUNrIhXuKIJBcBR2123bL3JKE+HDK1+VLgwYOgk55XCQt ylrjQKm93lEp9/uyalMPOQZyIZnxzsK22rclIemJuaPDS1TO8VmUhHSwmbkz1zSA7Y3F Ib2AIHf11XV3+nlC1Ody9WSHYUSGiYt8q/gKrTHvI50R1QAsSRie/is0ikk1FxgMM35H 3xGgFKW0p6BbCkqBByi9IUbrU7hYUORes5AoCvy4pvMwdySJu6wTsCsjbElgrk7zKlLh dPx5y96pxwhHAY96DVcnytiL0PBL3ce8W4uGt1t21ZbT1u3ytPp1ZihG/6mO85d++6Z9 sDTg== X-Gm-Message-State: AGi0PubzMR0bGsQ/FZxnTLqd7FDOSk0xoBmKfJMfTR2aQ5pH8d7Dp6Kb G4tr6QvBR2nP0uegV7ElYncrAfwXXVi8xtDsbyA= X-Google-Smtp-Source: APiQypK0hDAhaYuQbfup2JHWdiSRlaAMQc77AE4bRYB2gO+24aX3xKbDB6Gmv/gBnHT+Tm93d6Y6yBV+/le3ezfSGno= X-Received: by 2002:a05:6830:1190:: with SMTP id u16mr19688314otq.83.1586876066715; Tue, 14 Apr 2020 07:54:26 -0700 (PDT) MIME-Version: 1.0 References: <90F4B395-F010-4196-9C40-7896D4F3F2F4@gmail.com> In-Reply-To: Date: Tue, 14 Apr 2020 16:54:13 +0200 Message-ID: To: Gabriel Caruso Cc: Claude Pache , PHP Internals Content-Type: multipart/alternative; boundary="000000000000425b4c05a3416081" Subject: Re: [PHP-DEV] [RFC] [DISCUSSION] Ensure correct magic methods' signatures when typed From: nicolas.grekas+php@gmail.com (Nicolas Grekas) --000000000000425b4c05a3416081 Content-Type: text/plain; charset="UTF-8" > No, *nothing* is gonna be mandatory. > > As per the RFC: > > > This RFC proposes to introduce the following signatures checks when > magic methods are typed: > > These checks are only gonna be performed when you type your signatures and > *only when you type*. So, your example: `__call($name, $arguments)` will > work just fine, same as if you don't type `__clone` with `: void`. > > Is there a better way to phrase that in the RFC? > OH, good news then. This should be formulated with more sentences I think, e.g: > When any of the listed magic method use type hints, this RFC will enforce that only the supported types are used. > When they don't declare a type, nothing specific will happen. Also, add this somewhere maybe: > This limits the BC break to methods that declare a wrong type. Because this is what this is about, right? > Thanks for raise this. Nowadays, you can't: https://3v4l.org/pPJDt. But, > if you call as a method, yes: https://3v4l.org/0VmYQ. > > So this should be documented in the RFC as a BC Break. > Yes, the BC break is bigger when the magic methods are used directly, that's true and should be mentioned to. > And the BIG question: is all this worth the BC break? >> > > My main motivation is to make sure that developers are using the magic > methods with the correct type, nothing else. If everyone then agrees that > not having these checks is better for the language, no problem on closing > this RFC :) > Now that I understand that the scope of the BC break is quite narrow, I think you answered the question on my side. I'm just not sold on allowing "void" on __construct, because the very concept of a return type on a constructor is ... void, and also because of the code style choices this will open (and the CS "wars" I mentioned). Thanks, Nicolas --000000000000425b4c05a3416081--