generateDocblock() публичный Метод

public generateDocblock ( )
Пример #1
0
 /**
  * @return PhpTrait
  */
 private function createDummyTrait()
 {
     $trait = new PhpTrait('DummyTrait');
     $trait->setNamespace('gossi\\codegen\\tests\\fixture');
     $trait->setDescription('Dummy docblock');
     $trait->setMethod(PhpMethod::create('foo')->setVisibility('public'));
     $trait->setProperty(PhpProperty::create('iAmHidden')->setVisibility('private'));
     $trait->addUseStatement('gossi\\codegen\\tests\\fixture\\VeryDummyTrait');
     $trait->addTrait('VeryDummyTrait');
     $trait->generateDocblock();
     return $trait;
 }
Пример #2
0
 public function testFromReflection()
 {
     $trait = new PhpTrait('DummyTrait');
     $trait->setNamespace('gossi\\codegen\\tests\\fixture');
     $trait->setDescription('Dummy docblock');
     $trait->setMethod(PhpMethod::create('foo')->setVisibility('public'));
     $trait->setProperty(PhpProperty::create('iAmHidden')->setVisibility('private'));
     // @TODO: this alias is only a workaround
     $trait->addUseStatement('gossi\\codegen\\tests\\fixture\\VeryDummyTrait');
     $trait->addTrait('VeryDummyTrait');
     $trait->generateDocblock();
     $this->assertEquals($trait, PhpTrait::fromReflection(new \ReflectionClass('gossi\\codegen\\tests\\fixture\\DummyTrait')));
 }
Пример #3
0
 public function testEmptyTrait()
 {
     $trait = new PhpTrait();
     $trait->generateDocblock();
     $this->assertTrue($trait->getDocblock()->isEmpty());
 }