Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108833 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 37750 invoked from network); 3 Mar 2020 23:20:47 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 3 Mar 2020 23:20:47 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 7EA111804D3 for ; Tue, 3 Mar 2020 13:40:03 -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,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-f179.google.com (mail-il1-f179.google.com [209.85.166.179]) (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:40:03 -0800 (PST) Received: by mail-il1-f179.google.com with SMTP id w69so64005ilk.6 for ; Tue, 03 Mar 2020 13:40:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=datadoghq.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=0dM0UNK2o5iSS1TbAi6q82lH8eB3G31YD3YX0BSja4Q=; b=AAlGp0FOrYHdcthkK8+5Z+kUkTyqgqLo25iqnDV6rD95Zv7VoIU0kK8yfyeAOLIBdZ u+1uEHMm6iyuqGPcG9ItBP/vA04aG0hxuQiTHehsRgqNqeYVkHOcymUfxja3ZnN8WfvV 8w1vkuPweTGkKPE2kGsR9FBXMPD2MFNLY5dGk= 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=0dM0UNK2o5iSS1TbAi6q82lH8eB3G31YD3YX0BSja4Q=; b=CyTTMeDe5J60PdaETP1mY3O8V/uB2EDbALRj/n2dUz29uLT77Pp7UO78qTr6DjjLFM C7gHfnwGG8HHieJiqj4LkgcZYEz4cMNYaWzuUDPq0FVch2fAGgC4YB3hDXEqxe+xJnX+ 5hv9elHUW1DxyeI9sN9xWCKqt0EORjmaKAhaGz6IXpH7zkD6irEFzW/ny2AceClP6/63 eYU2fvU5rNyYcKgPpNZyFtNRpUce0KT7fQpLI+XpsNX5KF+pjk//B2qnLg/PizPOisft 207aVn4NJ3BFr+Imrx74p2LqvzDjfFsJiS0oB4TyZYkDcGTBJWzE3YMuVURx6W4Fxuii +Omg== X-Gm-Message-State: ANhLgQ1NwbOM39VImN+A6GjFW3N/8bHDobYjlI+5mGVQuqNV/HqQl+9e kRpsG47CMW0fCgo9YFWuy8+PS2FMMoTaxEg/dEnYTw== X-Google-Smtp-Source: ADFU+vttzCWIZUlbBR0x/2T0ZAKA81xeXSdSp082xWITdBvp1e+/bmnBX/krY/7S3meBu6xIYrnw8AXVVBv1N3yn1Xg= X-Received: by 2002:a05:6e02:4c:: with SMTP id i12mr7142134ilr.112.1583271600855; Tue, 03 Mar 2020 13:40:00 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Reply-To: Levi Morrison Date: Tue, 3 Mar 2020 14:39:50 -0700 Message-ID: To: Nikita Popov Cc: PHP internals Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] Re: [RFC] Validation for abstract trait methods From: internals@lists.php.net ("Levi Morrison via internals") 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.