Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:116804 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 19071 invoked from network); 4 Jan 2022 22:18:38 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 4 Jan 2022 22:18:38 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 877E11804F8 for ; Tue, 4 Jan 2022 15:25:57 -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.5 required=5.0 tests=BAYES_05,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS63949 74.207.252.0/24 X-Spam-Virus: No X-Envelope-From: Received: from malamute.woofle.net (woofle.net [74.207.252.100]) (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, 4 Jan 2022 15:25:56 -0800 (PST) Received: by malamute.woofle.net (Postfix) with ESMTPSA id 93A421EF90; Tue, 4 Jan 2022 15:25:55 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 15.0 \(3693.40.0.1.81\)) X-Priority: 3 (Normal) In-Reply-To: <1641335738.195767637@f174.i.mail.ru> Date: Tue, 4 Jan 2022 15:25:53 -0800 Cc: internals Content-Transfer-Encoding: quoted-printable Message-ID: <88D3FB3B-7466-480B-9F6A-700E4B9DCFE9@woofle.net> References: <1641335738.195767637@f174.i.mail.ru> To: Kirill Nesmeyanov X-Mailer: Apple Mail (2.3693.40.0.1.81) Subject: Re: [PHP-DEV] RFC: Trait expects interface From: dusk@woofle.net (Dusk) On Jan 4, 2022, at 14:35, Kirill Nesmeyanov wrote: > Since =C2=ABtraits=C2=BB are often an indicator of not very good code = and many may not use them quite correctly, for example, as helpers, I = suggest adding support for the `expects` keyword to indicate that the = trait is part of the code decomposition taking into account ISP. I like this idea, but I think it'd be even more useful if it could be = used with classes as well as interfaces. This would allow traits to = reject their use outside an intended class hierarchy. (And, while we're at it: could it be useful for a trait to expect = another trait?)=