Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. PropertyMetadata.php

function PropertyMetadata::newReflectionMember

Overrides MemberMetadata::newReflectionMember

File

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

Class

PropertyMetadata
Stores all metadata needed for validating a class property.

Namespace

Symfony\Component\Validator\Mapping

Code

protected function newReflectionMember(object|string $objectOrClassName) : \ReflectionMethod|\ReflectionProperty {
    $originalClass = \is_string($objectOrClassName) ? $objectOrClassName : $objectOrClassName::class;
    while (!property_exists($objectOrClassName, $this->getName())) {
        $objectOrClassName = get_parent_class($objectOrClassName);
        if (false === $objectOrClassName) {
            throw new ValidatorException(\sprintf('Property "%s" does not exist in class "%s".', $this->getName(), $originalClass));
        }
    }
    return new \ReflectionProperty($objectOrClassName, $this->getName());
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal