/**
  * Checks if the passed value is valid.
  *
  * @param PropertyDescriptor $value      The value that should be validated
  * @param Constraint         $constraint The constraint for the validation
  *
  * @throws ConstraintDefinitionException if this is not a constraint on a PropertyDescriptor object.
  */
 public function validate($value, Constraint $constraint)
 {
     if (!$value instanceof PropertyDescriptor) {
         throw new ConstraintDefinitionException('The Property\\HasSummary validator may only be used on property objects');
     }
     $var = $value->getVar();
     if (!$value->getSummary() && ($var->count() == 0 || !current($var->getAll())->getDescription())) {
         $this->context->addViolationAt('summary', $constraint->message);
     }
 }
 /**
  * @covers phpDocumentor\Descriptor\PropertyDescriptor::getVar
  */
 public function testVarTagsInheritWhenNoneArePresent()
 {
     // Arrange
     $varTagDescriptor = new VarDescriptor('var');
     $varCollection = new Collection(array($varTagDescriptor));
     $this->fixture->getTags()->clear();
     $parentProperty = $this->whenFixtureHasPropertyInParentClassWithSameName($this->fixture->getName());
     $parentProperty->getTags()->set('var', $varCollection);
     // Act
     $result = $this->fixture->getVar();
     // Assert
     $this->assertSame($varCollection, $result);
 }