public function testParamProducesCorrectDocBlockLine() { $this->tag->setPropertyName('property'); $this->tag->setTypes('string[]'); $this->tag->setDescription('description'); $this->assertEquals('@property string[] $property description', $this->tag->generate()); }
private function handleProperty(Generator\ClassGenerator $class, PHPProperty $prop) { $generatedProp = new PropertyGenerator($prop->getName()); $generatedProp->setVisibility(PropertyGenerator::VISIBILITY_PRIVATE); $class->addPropertyFromGenerator($generatedProp); if ($prop->getType() && (!$prop->getType()->getNamespace() && $prop->getType()->getName() == "array")) { // $generatedProp->setDefaultValue(array(), PropertyValueGenerator::TYPE_AUTO, PropertyValueGenerator::OUTPUT_SINGLE_LINE); } $docBlock = new DocBlockGenerator(); $generatedProp->setDocBlock($docBlock); if ($prop->getDoc()) { $docBlock->setLongDescription($prop->getDoc()); } $tag = new PropertyTag($prop->getName(), 'mixed'); $type = $prop->getType(); if ($type && $type instanceof PHPClassOf) { $tt = $type->getArg()->getType(); $tag->setTypes($this->getPhpType($tt) . "[]"); if ($p = $this->isOneType($tt)) { if ($t = $p->getType()) { $tag->setTypes($this->getPhpType($t) . "[]"); } } } elseif ($type) { if ($this->isNativeType($type)) { $tag->setTypes($this->getPhpType($type)); } elseif (($p = $this->isOneType($type)) && ($t = $p->getType())) { $tag->setTypes($this->getPhpType($t)); } else { $tag->setTypes($this->getPhpType($prop->getType())); } } $docBlock->setTag($tag); }