Re: RFC: Traits for PHP
| From: | Lukas Kahwe Smith | Date: | Wed, 20 Feb 2008 08:44:31 +0000 |
| Subject: | Re: RFC: Traits for PHP | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-35642@lists.php.net to get a copy of this message | ||
On 20.02.2008, at 09:28, Stefan Marr wrote:
Hi Lars,Maybe its best to first leave out interfaces/abstract etc. Start simple, see how things get used, get more comfortable with the feature and then see about potentially expanding it. regards, LukasWhat about abstract methods in traits? I think this could be handy to enforce the user class implement a data getter. trait Foo { public function doSomething() {I am sorry :) This part has been missing in the RFC. But is already implemented in the patch and supposed to work exactly like you has described it.return str_replace("foo", "bar", $this->_getString());} abstract protected _getString(); } class Consumer { use Foo; protected function _getString() {return "foo";} } What do you think?