Re: RFC: Traits for PHP

From: Date: Tue, 19 Feb 2008 23:46:07 +0000
Subject: Re: RFC: Traits for PHP
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-35628@lists.php.net to get a copy of this message
Hi Jochem, Am Mittwoch, den 20.02.2008, 00:06 +0100 schrieb Jochem Maas: [...] > if a trait would could contain all the methods required to implement > an interface and a class uses it (the trait) and implements the > relevant interface would it (the interface) be satified? Yes. The following should work: interface IFoo { public function method(); } trait TFoo { public functin method() { echo "Hello World!"; } } class CFoo implements IFoo { use TFoo; } This would be fine. > also might it be an idea to allow a trait to specify that it > implements an interface for the purposes of development (errors > triggered due to incorrect/incomplete implementation) > BUT not have the interface be carried to any classes that use the > trait? I don't see any sence in it. Why should one generalize an interface of a trait? cu, Lars

Attachment: [application/pgp-signature] Dies ist ein digital signierter Nachrichtenteil signature.asc
« previous php.internals (#35628) next »