Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108834 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 40780 invoked from network); 3 Mar 2020 23:37:52 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 3 Mar 2020 23:37:52 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 86A9B180210 for ; Tue, 3 Mar 2020 13:57:06 -0800 (PST) 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,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-lj1-f169.google.com (mail-lj1-f169.google.com [209.85.208.169]) (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, 3 Mar 2020 13:57:06 -0800 (PST) Received: by mail-lj1-f169.google.com with SMTP id a12so5313907ljj.2 for ; Tue, 03 Mar 2020 13:57:06 -0800 (PST) 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=f9AMrS6p86CeHcE7/HumQjME/AKKU1d17C8gP6OR+bg=; b=G5fq/HnEWrJVbAp48OE4WP3wW6v27RezQPLFGIPQmthUZ5TiEnPSk2Qybz+qyqGGgv BHNl5uU4l71lCdL/Ym4h0aIigI0+DR4Tpt1cV6iehjOW4wcDfasqgOWCWq3U7gPxdAb6 rm4Nm7ywYE24FJOWjyqgNpQqDU8vFUH3GB6klqkNaYTyL6hx4jsxl+Zf2NGFPmwLMcYx mokA0N12TglGP4m7BjMCa5DYtGdSZcaPvg6XMgfljszuAjkUp19N4ECcw6Zf+iZKMonW FYsFxGl4qfm5zwD1o4QXtmU4s1cot4Amt/YaftXmVMhVEp0qIcEtmRkKpROzRfGZteaq 40ZA== 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=f9AMrS6p86CeHcE7/HumQjME/AKKU1d17C8gP6OR+bg=; b=ROHr656jdVD5y5RVPo7xj9HALjfMnkiUxpCBwz8bmUenxSlXurf+LqhAYi593wh983 yfno9FYzUSCrRLLRZ7rF7QIH0qImIBMrk6P7hEAcuZBovcoOqybklMw9KJEgL7O2FPgA T6IbkKOBn1+6WO3lx1e4gG6W2CmIllScugL02t1Fr61rr6h7vRaI2VDII0zd9CdfW/+J J8tRM4pW55xbO7dnFuAzplB25MZGddz/OH85LVeWtGvjL/RlNMWySSO+h30EjFOIHtac rPaNmFJqK3TD3540nAW9Pj83ccyPq9s76jxWqazyJ2l1KpMY3NTEXWKAZMEP6I/S6+31 wkwA== X-Gm-Message-State: ANhLgQ0QTWj0wuKcVUx8j+/uNiBiD380D4Ip5YjY39NfGXyX8+4HCv4Z 70ucB561TDDMb1kd7MbpJB4zjZm1I23hKTuz6iE= X-Google-Smtp-Source: ADFU+vva9YfJ1DGoi7pPS6QFIQ4dr5IyYCdveKslaDeN6WtWOZK70xG79PXUH5cEClE/uuK1NIJAfRUWaO5SKzPzyWU= X-Received: by 2002:a2e:b04b:: with SMTP id d11mr6954ljl.267.1583272623128; Tue, 03 Mar 2020 13:57:03 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 3 Mar 2020 22:56:47 +0100 Message-ID: To: Levi Morrison Cc: PHP internals Content-Type: multipart/alternative; boundary="00000000000048c3e3059ffa6286" Subject: Re: [PHP-DEV] Re: [RFC] Validation for abstract trait methods From: nikita.ppv@gmail.com (Nikita Popov) --00000000000048c3e3059ffa6286 Content-Type: text/plain; charset="UTF-8" On Tue, Mar 3, 2020 at 10:40 PM Levi Morrison wrote: > On Tue, Mar 3, 2020 at 8:01 AM Nikita Popov wrote: > > > > On Fri, Feb 7, 2020 at 11:32 AM Nikita Popov > wrote: > > > > > Hi internals, > > > > > > I've sent a mail about this before, but as this turned into a bit of a > > > larger change (also allowing "abstract private" methods in traits) and > > > there's some backwards compatibility impact, I've created a proper RFC > for > > > this: > > > > > > https://wiki.php.net/rfc/abstract_trait_method_validation > > > > > > > Based on Nicolas' feedback, I've adjusted the RFC to not validate the > > visibility of the method (only the signature and "static-ness"). The > reason > > is outlined in the last paragraph of the Proposal section. > > > > With that done, I plan to open voting on this tomorrow, unless something > > new comes up. > > > > Regards, > > Nikita > > To clarify, this the signature enforcement is only applied to abstract > methods that come from traits, correct? This code will remain valid? > > ``` > trait CompareHelper { > function compareTo($obj): bool {} > } > > class C1 { > use CompareHelper; > function compareTo(self $obj) {} > } > ``` > > Notably, non-abstract methods will be able to change argument counts, > their type, the return type, all without restriction. Correct? I don't > particularly like code like this, but I've seen it out there on more > than one occasion. > That's right, this RFC is exclusively about abstract methods. No validation is performed for non-abstract methods. Nikita --00000000000048c3e3059ffa6286--