public function testSetGetModifiers()
 {
     $property = new PropertyReflection('foo', 0);
     $property->setModifiers(0);
     $this->assertTrue($property->isPublic());
     $property->setModifiers(PropertyReflection::MODIFIER_PUBLIC);
     $this->assertTrue($property->isPublic());
     $property->setModifiers(PropertyReflection::MODIFIER_PROTECTED);
     $this->assertTrue($property->isProtected());
     $property->setModifiers(PropertyReflection::MODIFIER_PRIVATE);
     $this->assertTrue($property->isPrivate());
     $property->setModifiers(PropertyReflection::MODIFIER_STATIC);
     $this->assertTrue($property->isPublic());
     $this->assertTrue($property->isStatic());
 }
Example #2
0
 protected function addProperty(\PHPParser_Node_Stmt_Property $node)
 {
     foreach ($node->props as $prop) {
         $property = new PropertyReflection($prop->name, $prop->getLine());
         $property->setModifiers($node->type);
         if ($this->context->getFilter()->acceptProperty($property)) {
             $this->context->getClass()->addProperty($property);
             $property->setDefault($prop->default);
             $comment = $this->context->getDocBlockParser()->parse($node->getDocComment(), $this->context, $property);
             $property->setDocComment($node->getDocComment());
             $property->setShortDesc($comment->getShortDesc());
             $property->setLongDesc($comment->getLongDesc());
             if ($errors = $comment->getErrors()) {
                 $this->context->addErrors((string) $property, $prop->getLine(), $errors);
             } else {
                 if ($tag = $comment->getTag('var')) {
                     $property->setHint($this->resolveHint($tag[0][0]));
                     $property->setHintDesc($tag[0][1]);
                 }
                 $property->setTags($comment->getOtherTags());
             }
         }
     }
 }