class Annotation

Annotations class.

Hierarchy

  • class \Drupal\Component\Annotation\Doctrine\Annotation

Expanded class hierarchy of Annotation

2 string references to 'Annotation'
DocParserTest::getAnnotationVarTypeProviderInvalid in core/tests/Drupal/Tests/Component/Annotation/Doctrine/DocParserTest.php
DocParserTest::getAnnotationVarTypeProviderValid in core/tests/Drupal/Tests/Component/Annotation/Doctrine/DocParserTest.php

File

core/lib/Drupal/Component/Annotation/Doctrine/Annotation.php, line 35

Namespace

Drupal\Component\Annotation\Doctrine
View source
class Annotation {
  
  /**
   * Value property. Common among all derived classes.
   *
   * @var mixed
   */
  public $value;
  /** @param array<string, mixed> $data Key-value for properties to be defined in this class. */
  final public function __construct(array $data) {
    foreach ($data as $key => $value) {
      $this->{$key} = $value;
    }
  }
  
  /**
   * Error handler for unknown property accessor in Annotation class.
   *
   * @throws BadMethodCallException
   */
  public function __get(string $name) : mixed {
    throw new BadMethodCallException(sprintf("Unknown property '%s' on annotation '%s'.", $name, static::class));
  }
  
  /**
   * Error handler for unknown property mutator in Annotation class.
   *
   * @param mixed $value Property value.
   *
   * @throws BadMethodCallException
   */
  public function __set(string $name, $value) {
    throw new BadMethodCallException(sprintf("Unknown property '%s' on annotation '%s'.", $name, static::class));
  }

}

Members

Title Sort descending Modifiers Object type Summary
Annotation::$value public property Value property. Common among all derived classes.
Annotation::__construct final public function
Annotation::__get public function Error handler for unknown property accessor in Annotation class.
Annotation::__set public function Error handler for unknown property mutator in Annotation class.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.