}
}
- $compiler
- ->write("\$this->traits = array_merge(\n")
- ->indent()
- ;
+ if ($countTraits > 1) {
+ $compiler
+ ->write("\$this->traits = array_merge(\n")
+ ->indent()
+ ;
+
+ for ($i = 0; $i < $countTraits; $i++) {
+ $compiler
+ ->write(sprintf("\$_trait_%s_blocks".($i == $countTraits - 1 ? '' : ',')."\n", $i))
+ ;
+ }
- for ($i = 0; $i < $countTraits; $i++) {
$compiler
- ->write(sprintf("\$_trait_%s_blocks".($i == $countTraits - 1 ? '' : ',')."\n", $i))
+ ->outdent()
+ ->write(");\n\n")
+ ;
+ } else {
+ $compiler
+ ->write("\$this->traits = \$_trait_0_blocks;\n\n")
;
}
$compiler
- ->outdent()
- ->write(");\n\n")
->write("\$this->blocks = array_merge(\n")
->indent()
->write("\$this->traits,\n")