Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:91263 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 28553 invoked from network); 18 Feb 2016 10:35:04 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Feb 2016 10:35:04 -0000 Authentication-Results: pb1.pair.com smtp.mail=larry@garfieldtech.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=larry@garfieldtech.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain garfieldtech.com from 66.111.4.27 cause and error) X-PHP-List-Original-Sender: larry@garfieldtech.com X-Host-Fingerprint: 66.111.4.27 out3-smtp.messagingengine.com Received: from [66.111.4.27] ([66.111.4.27:50988] helo=out3-smtp.messagingengine.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BC/31-13277-65E95C65 for ; Thu, 18 Feb 2016 05:35:03 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 6A7A0207CB for ; Thu, 18 Feb 2016 05:35:00 -0500 (EST) Received: from web2 ([10.202.2.212]) by compute4.internal (MEProxy); Thu, 18 Feb 2016 05:35:00 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=EkWs1h2GaQJLHc/ xNycnOYEUrSw=; b=iaxqEO3WBNMMD16vIGFIPo0+gJ5pEsElB+kmPy/n8mnBjnW ImElqGCRfbEoiqwZ2vYumsuPSACc3Uw5LCx5NoGrpmCNPDXxJp9xTtkfvF56k5lV ZC10iu2WMG+RoHv08gGVdPpsn2WeFjRMTs5TjQOLJJe8CZc82Vk1Ryo3ynYA= Received: by web2.nyi.internal (Postfix, from userid 99) id 3BD71540118; Thu, 18 Feb 2016 05:35:00 -0500 (EST) Message-ID: <1455791700.2381299.524770354.2D139723@webmail.messagingengine.com> X-Sasl-Enc: 3xl+Cre26okCRZ+vkVc900fELY9DJ2YLm+sWUGYIUmBZ 1455791700 To: internals@lists.php.net MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain X-Mailer: MessagingEngine.com Webmail Interface - ajax-aeec9b65 In-Reply-To: References: Date: Thu, 18 Feb 2016 04:35:00 -0600 Subject: Re: [PHP-DEV] Re: [RFC] Traits with interfaces From: larry@garfieldtech.com (Larry Garfield) On Wed, Feb 17, 2016, at 01:05 PM, Kevin Gessner wrote: > On Wed, Feb 17, 2016 at 9:25 AM, Kevin Gessner wrote: > > > Hello internals team! I'd like to propose an RFC to allow traits to > > implement interfaces. > > > > I've created a proper RFC wiki page here with the draft: > https://wiki.php.net/rfc/traits-with-interfaces > > It includes more detail and several example code snippets. Thanks all > for > your feedback so far. Thanks, Kevin. At the risk of a "me too" post, I would also be in favor of allowing traits to declare an interface but NOT in favor of a use-ing class implicitly implementing the interface as a result. I'd rather the class still need to self-declare the interface; that it uses a trait to fulfill that contract is irrelevant to the outside world. At that point, the benefit becomes two-fold: 1) Communicate to users of the trait what the intent of the trait is: To provide the boilerplate for some interface, or portion thereof. This could be covered by PHPDoc, potentially, and I've suggested the same for PSR-5 before. 2) Ask the engine to do a syntax check on the class to make sure I did not forget something or screwed up in some way. That is, not fulfilling the interface on the trait would cause a parse error (or an error in my IDE), forcing me to fix my bug before I even try running it. PHPDoc would NOT have this benefit. Thus I feel this addition does have value that a PHPDoc alternative would not. --Larry Garfield