| Total Complexity | 4 |
| Total Lines | 21 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php declare(strict_types=1); |
||
| 16 | final class Variable implements HasType, Stringable |
||
| 17 | { |
||
| 18 | use WithTypeDeclaration; |
||
| 19 | |||
| 20 | public function __construct(private readonly string $name, TypeDeclaration $type) |
||
|
|
|||
| 21 | { |
||
| 22 | $this->type = $type; |
||
| 23 | } |
||
| 24 | |||
| 25 | /** @return Name[] */ |
||
| 26 | public function references(): array |
||
| 27 | { |
||
| 28 | return $this->type->references(); |
||
| 29 | } |
||
| 30 | |||
| 31 | public function __toString(): string |
||
| 32 | { |
||
| 33 | return sprintf( |
||
| 34 | '%s%s', |
||
| 35 | $this->name, |
||
| 36 | $this->type->isPresent() ? ": {$this->type}" : '' |
||
| 37 | ); |
||
| 40 |