Re: RFC: Traits for PHP

From: Date: Wed, 20 Feb 2008 08:28:37 +0000
Subject: Re: RFC: Traits for PHP
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-35641@lists.php.net to get a copy of this message
Hi Lars, > What 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() > { > return str_replace("foo", "bar", $this->_getString()); > } > abstract protected _getString(); > } > > class Consumer > { > use Foo; > protected function _getString() > { > return "foo"; > } > } > > What do you think? 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. Kind Regards Stefan

« previous php.internals (#35641) next »