class Target
Same name in this branch
- 11.1.x vendor/symfony/dependency-injection/Attribute/Target.php \Symfony\Component\DependencyInjection\Attribute\Target
Annotation that can be used to signal to the parser to check the annotation target during the parsing process.
@Annotation
Hierarchy
- class \Doctrine\Common\Annotations\Annotation\Target
Expanded class hierarchy of Target
3 files declare their use of Target
- AnnotationReader.php in vendor/
doctrine/ annotations/ lib/ Doctrine/ Common/ Annotations/ AnnotationReader.php - DocParser.php in vendor/
doctrine/ annotations/ lib/ Doctrine/ Common/ Annotations/ DocParser.php - DocParser.php in core/
lib/ Drupal/ Component/ Annotation/ Doctrine/ DocParser.php - This class is a near-copy of Doctrine\Common\Annotations\DocParser, which is part of the Doctrine project: <http://www.doctrine-project.org>. It was copied from version 1.2.7.
14 string references to 'Target'
- ContentTranslationController::overview in core/
modules/ content_translation/ src/ Controller/ ContentTranslationController.php - Builds the translations overview page.
- ConvertLogTypes::migrate in vendor/
phpunit/ phpunit/ src/ TextUI/ Configuration/ Xml/ Migration/ Migrations/ ConvertLogTypes.php - CoverageCloverToReport::toReportFormat in vendor/
phpunit/ phpunit/ src/ TextUI/ Configuration/ Xml/ Migration/ Migrations/ CoverageCloverToReport.php - CoverageCrap4jToReport::toReportFormat in vendor/
phpunit/ phpunit/ src/ TextUI/ Configuration/ Xml/ Migration/ Migrations/ CoverageCrap4jToReport.php - CoverageHtmlToReport::toReportFormat in vendor/
phpunit/ phpunit/ src/ TextUI/ Configuration/ Xml/ Migration/ Migrations/ CoverageHtmlToReport.php
1 class is annotated with Target
- NamedArgumentConstructor in vendor/
doctrine/ annotations/ lib/ Doctrine/ Common/ Annotations/ Annotation/ NamedArgumentConstructor.php - Annotation that indicates that the annotated class should be constructed with a named argument call.
File
-
vendor/
doctrine/ annotations/ lib/ Doctrine/ Common/ Annotations/ Annotation/ Target.php, line 22
Namespace
Doctrine\Common\Annotations\AnnotationView source
final class Target {
public const TARGET_CLASS = 1;
public const TARGET_METHOD = 2;
public const TARGET_PROPERTY = 4;
public const TARGET_ANNOTATION = 8;
public const TARGET_FUNCTION = 16;
public const TARGET_ALL = 31;
/** @var array<string, int> */
private static $map = [
'ALL' => self::TARGET_ALL,
'CLASS' => self::TARGET_CLASS,
'METHOD' => self::TARGET_METHOD,
'PROPERTY' => self::TARGET_PROPERTY,
'FUNCTION' => self::TARGET_FUNCTION,
'ANNOTATION' => self::TARGET_ANNOTATION,
];
/** @phpstan-var list<string> */
public $value;
/**
* Targets as bitmask.
*
* @var int
*/
public $targets;
/**
* Literal target declaration.
*
* @var string
*/
public $literal;
/**
* @phpstan-param array{value?: string|list<string>} $values
*
* @throws InvalidArgumentException
*/
public function __construct(array $values) {
if (!isset($values['value'])) {
$values['value'] = null;
}
if (is_string($values['value'])) {
$values['value'] = [
$values['value'],
];
}
if (!is_array($values['value'])) {
throw new InvalidArgumentException(sprintf('@Target expects either a string value, or an array of strings, "%s" given.', is_object($values['value']) ? get_class($values['value']) : gettype($values['value'])));
}
$bitmask = 0;
foreach ($values['value'] as $literal) {
if (!isset(self::$map[$literal])) {
throw new InvalidArgumentException(sprintf('Invalid Target "%s". Available targets: [%s]', $literal, implode(', ', array_keys(self::$map))));
}
$bitmask |= self::$map[$literal];
}
$this->targets = $bitmask;
$this->value = $values['value'];
$this->literal = implode(', ', $this->value);
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
Target::$literal | public | property | Literal target declaration. |
Target::$map | private static | property | @var array<string, int> |
Target::$targets | public | property | Targets as bitmask. |
Target::$value | public | property | @phpstan-var list<string> |
Target::TARGET_ALL | public | constant | |
Target::TARGET_ANNOTATION | public | constant | |
Target::TARGET_CLASS | public | constant | |
Target::TARGET_FUNCTION | public | constant | |
Target::TARGET_METHOD | public | constant | |
Target::TARGET_PROPERTY | public | constant | |
Target::__construct | public | function | @phpstan-param array{value?: string|list<string>} $values |