/**
  * 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\DescriptorAbstract::getSummary
  */
 public function testSummaryInheritsWhenNoneIsPresent()
 {
     // Arrange
     $summary = 'This is a summary';
     $this->fixture->setSummary(null);
     $parentProperty = $this->whenFixtureHasPropertyInParentClassWithSameName($this->fixture->getName());
     $parentProperty->setSummary($summary);
     // Act
     $result = $this->fixture->getSummary();
     // Assert
     $this->assertSame($summary, $result);
 }