/** * @param PhpConstantElement $constant * @return AbstractComponent */ public function addConstantElement(PhpConstantElement $constant) { if (!$constant->getClass() instanceof PhpClassElement && $this->mainElement instanceof PhpClassElement) { $constant->setClass($this->mainElement); } $this->mainElement->addChild($constant); return $this; }
/** * @return PhpAnnotationBlock */ protected function getConstantAnnotationBlock(PhpConstant $constant) { $block = new PhpAnnotationBlock(array(sprintf('Constant for value \'%s\'', $constant->getValue()))); if (($value = $this->getModel()->getValue($constant->getValue())) instanceof StructValueModel) { $this->defineModelAnnotationsFromWsdl($block, $value); } $block->addChild(new PhpAnnotation(self::ANNOTATION_RETURN, sprintf('string \'%s\'', $constant->getValue()))); return $block; }
public function testGetChildrenTypes() { $constant = new PhpConstant('foo', null, new PhpClass('bar')); $this->assertSame(array(), $constant->getChildrenTypes()); }