Skip to content

Commit 02fd982

Browse files
committed
Refactored to use new features of PHPStan PHPDoc parser
1 parent 145677c commit 02fd982

File tree

97 files changed

+1450
-4987
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+1450
-4987
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<?php declare(strict_types = 1);
2+
3+
namespace SlevomatCodingStandard\Helpers;
4+
5+
use PHPStan\PhpDocParser\Ast\PhpDoc\InvalidTagValueNode;
6+
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode;
7+
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode;
8+
9+
/**
10+
* @internal
11+
* @template T of PhpDocTagValueNode
12+
*/
13+
class Annotation
14+
{
15+
16+
/** @var PhpDocTagNode */
17+
private $node;
18+
19+
/** @var int */
20+
private $startPointer;
21+
22+
/** @var int */
23+
private $endPointer;
24+
25+
public function __construct(PhpDocTagNode $node, int $startPointer, int $endPointer)
26+
{
27+
$this->node = $node;
28+
$this->startPointer = $startPointer;
29+
$this->endPointer = $endPointer;
30+
}
31+
32+
public function getNode(): PhpDocTagNode
33+
{
34+
return $this->node;
35+
}
36+
37+
public function getName(): string
38+
{
39+
return $this->node->name;
40+
}
41+
42+
/**
43+
* @return T
44+
*/
45+
public function getValue(): PhpDocTagValueNode
46+
{
47+
/** @phpstan-ignore-next-line */
48+
return $this->node->value;
49+
}
50+
51+
public function getStartPointer(): int
52+
{
53+
return $this->startPointer;
54+
}
55+
56+
public function getEndPointer(): int
57+
{
58+
return $this->endPointer;
59+
}
60+
61+
public function isInvalid(): bool
62+
{
63+
return $this->node->value instanceof InvalidTagValueNode;
64+
}
65+
66+
}

SlevomatCodingStandard/Helpers/Annotation/Annotation.php

Lines changed: 0 additions & 65 deletions
This file was deleted.

SlevomatCodingStandard/Helpers/Annotation/AssertAnnotation.php

Lines changed: 0 additions & 80 deletions
This file was deleted.

SlevomatCodingStandard/Helpers/Annotation/ExtendsAnnotation.php

Lines changed: 0 additions & 68 deletions
This file was deleted.

SlevomatCodingStandard/Helpers/Annotation/GenericAnnotation.php

Lines changed: 0 additions & 48 deletions
This file was deleted.

0 commit comments

Comments
 (0)