| 1 |
<?php declare(strict_types = 1); |
| 2 |
|
| 3 |
namespace PHPStan\PhpDocParser\Ast; |
| 4 |
|
| 5 |
use function trim; |
| 6 |
|
| 7 |
class Comment |
| 8 |
{ |
| 9 |
|
| 10 |
public string $text; |
| 11 |
|
| 12 |
public int $startLine; |
| 13 |
|
| 14 |
public int $startIndex; |
| 15 |
|
| 16 |
public function __construct(string $text, int $startLine = -1, int $startIndex = -1) |
| 17 |
{ |
| 18 |
$this->text = $text; |
| 19 |
$this->startLine = $startLine; |
| 20 |
$this->startIndex = $startIndex; |
| 21 |
} |
| 22 |
|
| 23 |
public function getReformattedText(): string |
| 24 |
{ |
| 25 |
return trim($this->text); |
| 26 |
} |
| 27 |
|
| 28 |
/** |
| 29 |
* @param array<string, mixed> $properties |
| 30 |
*/ |
| 31 |
public static function __set_state(array $properties): self |
| 32 |
{ |
| 33 |
return new self($properties['text'], $properties['startLine'], $properties['startIndex']); |
| 34 |
} |
| 35 |
|
| 36 |
} |