google_forms/vendor/slevomat/coding-standard/SlevomatCodingStandard/Helpers/Annotation.php

67 lines
1.1 KiB
PHP
Raw Permalink Normal View History

2024-08-21 06:34:30 +00:00
<?php declare(strict_types = 1);
namespace SlevomatCodingStandard\Helpers;
use PHPStan\PhpDocParser\Ast\PhpDoc\InvalidTagValueNode;
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode;
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode;
/**
* @internal
* @template T of PhpDocTagValueNode
*/
class Annotation
{
/** @var PhpDocTagNode */
private $node;
/** @var int */
private $startPointer;
/** @var int */
private $endPointer;
public function __construct(PhpDocTagNode $node, int $startPointer, int $endPointer)
{
$this->node = $node;
$this->startPointer = $startPointer;
$this->endPointer = $endPointer;
}
public function getNode(): PhpDocTagNode
{
return $this->node;
}
public function getName(): string
{
return $this->node->name;
}
/**
* @return T
*/
public function getValue(): PhpDocTagValueNode
{
/** @phpstan-ignore-next-line */
return $this->node->value;
}
public function getStartPointer(): int
{
return $this->startPointer;
}
public function getEndPointer(): int
{
return $this->endPointer;
}
public function isInvalid(): bool
{
return $this->node->value instanceof InvalidTagValueNode;
}
}