Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:116830 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 75693 invoked from network); 6 Jan 2022 14:13:50 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 6 Jan 2022 14:13:50 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 612B91804B1 for ; Thu, 6 Jan 2022 07:21:33 -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=-0.3 required=5.0 tests=BAYES_20,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS57367 213.189.55.0/24 X-Spam-Virus: No X-Envelope-From: Received: from cache4.mydevil.net (cache4.mydevil.net [213.189.55.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 ; Thu, 6 Jan 2022 07:21:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=korulczyk.pl; s=devil; h=Content-Transfer-Encoding:Content-Type:In-Reply-To :MIME-Version:Date:Message-ID:From:References:To:Subject:Sender:Reply-To:Cc: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=N8UF2JoJibXYzzjdwLdpmidRPeNo7G+L1J9xFJl6jI0=; b=Q1kG8rXZEraWoM+yXoPLKk7g4r qP3SkJyT52h3A2TQBT2H6Oh0FWUJawFByeFdd6hj2BC7jlaZQlqjMbbIngbR4VqxEPqO/wbOJW75R ktJM8bGVe8Q9RE6NY4D3bb7H4e4klyi6Qor+26v+nILWTwKnGNFyBmHxHn2ccSfiCqpg=; To: internals@lists.php.net References: <1641335738.195767637@f174.i.mail.ru> <5a4aebf8-e592-4517-8930-d18b112ef1fd@www.fastmail.com> Message-ID: <5a99809d-afda-546c-5a11-a4f0f821aa37@korulczyk.pl> Date: Thu, 6 Jan 2022 16:21:28 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <5a4aebf8-e592-4517-8930-d18b112ef1fd@www.fastmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-System-Sender: robert@korulczyk.pl X-System-UID: 1534 Subject: Re: [PHP-DEV] RFC: Trait expects interface From: robert@korulczyk.pl (Robert Korulczyk) > For point 1, we already have that. It's called abstract methods in traits. This is a solved problem that requires no further resolution. At best it would be a shorthand to copying a few methods from an interface into the trait and sticking "abstract" in front of them. I really don't see a need for that. You can say exactly the same about traits in general - you don't need traits at all, since you can copy method implementation into multiple classes, in the same way as you're proposing to copy abstract methods declarations. But traits are implemented and they're useful - they reduce the amount of code duplication, which means less work and a smaller surface for errors. It is the same case for this proposal - if you don't need to copy&paste method declarations from an interface, that means less code duplication and possible errors. It should also make it easier for SCA tools to understand the code since they no longer need to know the whole project to understand that method from trait is implementation of method from interface (which is really tricky right now since it depends on context - trait can at the same implement and not implement the interface, because it depends on class where it is used). And finally, you could use `{@inheritdoc}` in some meaningful way in traits - right now there is no straightforward way to inherit phpdoc from the interface, and often this is what you want to do. -- Regards, Robert Korulczyk