private function processProperty(\PhpParser\Node\Stmt\Property $node) {
     $property = $node->props[0];
     $member = $this->unit->addMember($property->name);
     $this->setVariableType($member, $property->type);
     $this->setVariableDefaultValue($member, $property->default);
     $visibility = 'public';
     if ($node->isPrivate()) {
         $visibility = 'private';
     } elseif ($node->isProtected()) {
         $visibility = 'protected';
     }
     $member->setVisibility($visibility);
     $docComment = $node->getDocComment();
     if ($docComment !== NULL) {
         $block = $this->dockblocParser->parse($docComment, $this->aliasMap);
         $member->setDocBlock($block);
     }
     $member->setLine($node->getLine());
 }
示例#2
0
 /**
  * @param Property $node
  *
  * @return RefProperty
  */
 private function createProperty(Property $node)
 {
     $ref = new RefProperty();
     $ref->class = $this->class;
     $ref->name = $node->props[0]->name;
     $ref->default = $this->getValue($node->props[0]->default);
     if ($node->isPrivate()) {
         $ref->visibility = Visibility::IS_PRIVATE;
     } elseif ($node->isProtected()) {
         $ref->visibility = Visibility::IS_PROTECTED;
     } elseif ($node->isPublic()) {
         $ref->visibility = Visibility::IS_PUBLIC;
     }
     $ref->isStatic = $node->isStatic();
     $ref->line = $node->getLine();
     $ref->docComment = $this->createDocComment($node);
     return $ref;
 }
 /**
  * @return int
  */
 public function getLine()
 {
     return $this->propertyBefore->getLine();
 }
 /**
  * @param Node\Stmt\Property $node
  */
 protected function parseClassPropertyNode(Node\Stmt\Property $node)
 {
     foreach ($node->props as $property) {
         $this->structuralElements[$this->currentStructuralElement->namespacedName->toString()]['properties'][] = ['name' => $property->name, 'startLine' => $node->getLine(), 'isPublic' => $node->isPublic(), 'isPrivate' => $node->isPrivate(), 'isStatic' => $node->isStatic(), 'isProtected' => $node->isProtected(), 'docComment' => $node->getDocComment() ? $node->getDocComment()->getText() : null];
     }
 }
 /**
  * @return int
  */
 public function getLine()
 {
     return $this->propertyAfter->getLine();
 }