Skip to content

Commit

Permalink
Merge pull request #50 from riccardonar/master
Browse files Browse the repository at this point in the history
DocBlockGenerator by default wordwrap to true
  • Loading branch information
goetas authored Jan 3, 2018
2 parents 285b99d + 088634e commit d7e40e3
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/Php/ClassGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ private function handleValueMethod(Generator\ClassGenerator $generator, PHPPrope
$type = $prop->getType();

$docblock = new DocBlockGenerator('Construct');
$docblock->setWordWrap(false);
$paramTag = new ParamTag("value", "mixed");
$paramTag->setTypes(($type ? $type->getPhpType() : "mixed"));

Expand All @@ -74,6 +75,7 @@ private function handleValueMethod(Generator\ClassGenerator $generator, PHPPrope
$generator->addMethodFromGenerator($method);

$docblock = new DocBlockGenerator('Gets or sets the inner value');
$docblock->setWordWrap(false);
$paramTag = new ParamTag("value", "mixed");
if ($type && $type instanceof PHPClassOf) {
$paramTag->setTypes($type->getArg()->getType()->getPhpType() . "[]");
Expand Down Expand Up @@ -109,6 +111,7 @@ private function handleValueMethod(Generator\ClassGenerator $generator, PHPPrope
$generator->addMethodFromGenerator($method);

$docblock = new DocBlockGenerator('Gets a string value');
$docblock->setWordWrap(false);
$docblock->setTag(new ReturnTag("string"));
$method = new MethodGenerator("__toString");
$method->setDocBlock($docblock);
Expand All @@ -120,6 +123,7 @@ private function handleSetter(Generator\ClassGenerator $generator, PHPProperty $
{
$methodBody = '';
$docblock = new DocBlockGenerator();
$docblock->setWordWrap(false);

$docblock->setShortDescription("Sets a new " . $prop->getName());

Expand Down Expand Up @@ -183,6 +187,7 @@ private function handleGetter(Generator\ClassGenerator $generator, PHPProperty $

if ($prop->getType() instanceof PHPClassOf) {
$docblock = new DocBlockGenerator();
$docblock->setWordWrap(false);
$docblock->setShortDescription("isset " . $prop->getName());
if ($prop->getDoc()) {
$docblock->setLongDescription($prop->getDoc());
Expand All @@ -201,6 +206,7 @@ private function handleGetter(Generator\ClassGenerator $generator, PHPProperty $
$generator->addMethodFromGenerator($method);

$docblock = new DocBlockGenerator();
$docblock->setWordWrap(false);
$docblock->setShortDescription("unset " . $prop->getName());
if ($prop->getDoc()) {
$docblock->setLongDescription($prop->getDoc());
Expand All @@ -221,6 +227,7 @@ private function handleGetter(Generator\ClassGenerator $generator, PHPProperty $
// ////

$docblock = new DocBlockGenerator();
$docblock->setWordWrap(false);

$docblock->setShortDescription("Gets as " . $prop->getName());

Expand Down Expand Up @@ -264,6 +271,7 @@ private function handleAdder(Generator\ClassGenerator $generator, PHPProperty $p
$propName = $type->getArg()->getName();

$docblock = new DocBlockGenerator();
$docblock->setWordWrap(false);
$docblock->setShortDescription("Adds as $propName");

if ($prop->getDoc()) {
Expand Down Expand Up @@ -328,6 +336,7 @@ private function handleProperty(Generator\ClassGenerator $class, PHPProperty $pr
}

$docBlock = new DocBlockGenerator();
$docBlock->setWordWrap(false);
$generatedProp->setDocBlock($docBlock);

if ($prop->getDoc()) {
Expand Down Expand Up @@ -363,6 +372,7 @@ public function generate(PHPClass $type)
{
$class = new \Zend\Code\Generator\ClassGenerator();
$docblock = new DocBlockGenerator("Class representing " . $type->getName());
$docblock->setWordWrap(false);
if ($type->getDoc()) {
$docblock->setLongDescription($type->getDoc());
}
Expand All @@ -381,8 +391,7 @@ public function generate(PHPClass $type)

if ($extends->getNamespace() != $type->getNamespace()) {
if ($extends->getName() == $type->getName()) {
$class->addUse($type->getExtends()
->getFullName(), $extends->getName() . "Base");
$class->addUse($type->getExtends()->getFullName(), $extends->getName() . "Base");
$class->setExtendedClass($extends->getName() . "Base");
} else {
$class->addUse($extends->getFullName());
Expand Down

0 comments on commit d7e40e3

Please sign in to comment.