Skip to content

Commit

Permalink
Refactored to use new features of PHPStan PHPDoc parser
Browse files Browse the repository at this point in the history
  • Loading branch information
kukulich committed Jun 1, 2023
1 parent 145677c commit 02fd982
Show file tree
Hide file tree
Showing 97 changed files with 1,450 additions and 4,987 deletions.
66 changes: 66 additions & 0 deletions SlevomatCodingStandard/Helpers/Annotation.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?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;
}

}
65 changes: 0 additions & 65 deletions SlevomatCodingStandard/Helpers/Annotation/Annotation.php

This file was deleted.

80 changes: 0 additions & 80 deletions SlevomatCodingStandard/Helpers/Annotation/AssertAnnotation.php

This file was deleted.

68 changes: 0 additions & 68 deletions SlevomatCodingStandard/Helpers/Annotation/ExtendsAnnotation.php

This file was deleted.

48 changes: 0 additions & 48 deletions SlevomatCodingStandard/Helpers/Annotation/GenericAnnotation.php

This file was deleted.

Loading

0 comments on commit 02fd982

Please sign in to comment.