/** * {@inheritDoc} */ public function generate(GenerateableInterface $model) { $content = "<?php\n"; $comment = $this->config->getHeaderComment(); if (!empty($comment)) { $docblock = new Docblock(); $docblock->setLongDescription($comment); $content .= str_replace('/**', '/*', $docblock->toString()) . "\n"; } if ($this->config->getHeaderDocblock() instanceof Docblock) { $content .= $this->config->getHeaderDocblock()->toString() . "\n"; } if ($this->config->getDeclareStrictTypes()) { $content .= "declare(strict_types=1);\n\n"; } $content .= parent::generate($model); if ($this->config->getBlankLineAtEnd()) { $content .= "\n"; } return $content; }
public function testEmpty() { $doc = new Docblock(); $this->assertTrue($doc->isEmpty()); $doc->setLongDescription('bla'); $this->assertFalse($doc->isEmpty()); $doc->setLongDescription(null); $this->assertTrue($doc->isEmpty()); $doc->setShortDescription('bla'); $this->assertFalse($doc->isEmpty()); $doc->setShortDescription(null); $this->assertTrue($doc->isEmpty()); $doc->appendTag(new SeeTag()); $this->assertFalse($doc->isEmpty()); }