You are here

protected function PropertyMetadata::newReflectionMember in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/validator/Mapping/PropertyMetadata.php \Symfony\Component\Validator\Mapping\PropertyMetadata::newReflectionMember()

Creates a new reflection instance for accessing the member's value.

Must be implemented by subclasses.

Parameters

object|string $objectOrClassName The object or the class name:

Return value

\ReflectionMethod|\ReflectionProperty The reflection instance

Overrides MemberMetadata::newReflectionMember

File

vendor/symfony/validator/Mapping/PropertyMetadata.php, line 59

Class

PropertyMetadata
Stores all metadata needed for validating a class property.

Namespace

Symfony\Component\Validator\Mapping

Code

protected function newReflectionMember($objectOrClassName) {
  $class = new \ReflectionClass($objectOrClassName);
  while (!$class
    ->hasProperty($this
    ->getName())) {
    $class = $class
      ->getParentClass();
  }
  $member = new \ReflectionProperty($class
    ->getName(), $this
    ->getName());
  $member
    ->setAccessible(true);
  return $member;
}