Examples for Trait generator
I had requested traits back in zendframework/zendframework#4876 which is now closed. It appears this support was added via TraitGenerator. Would be great to see some examples included in the docs.
Originally posted by @RSully at https://github.com/zendframework/zend-code/issues/73
$traitclass = new TraitGenerator();
$traitclass->addMethod('MethodOne');
$traitclass->addConstant('VERSION','1.0.0');
echo $traitclass->generate();
trait
{
public const VERSION = '1.0.0';
public function MethodOne()
{
}
}
@weierophinney You can close this issue as I am sharing code for the user. Ping :- @RSully
You can close this issue as I am sharing code for the user.
Is it part of the docs though? The original issue is indeed about expanding in the RST docs...
@Ocramius I am thinking to contribute into doc but it was not original into doc so I am not sure about this.
Perhaps adding a section to https://github.com/laminas/laminas-code/blob/ab0d54d8cb8b9ca1f6a8c3287e83724fbc61edbf/docs/book/generator/examples.md ?