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 | 76 | public function __construct(private readonly string $name, TypeDeclaration $type) |
|
|
|||
21 | { |
||
22 | 76 | $this->type = $type; |
|
23 | } |
||
24 | |||
25 | /** @return Name[] */ |
||
26 | 25 | public function references(): array |
|
27 | { |
||
28 | 25 | return $this->type->references(); |
|
29 | } |
||
30 | |||
31 | 21 | public function __toString(): string |
|
32 | { |
||
33 | 21 | return sprintf( |
|
34 | '%s%s', |
||
35 | 21 | $this->name, |
|
36 | 21 | $this->type->isPresent() ? ": {$this->type}" : '' |
|
37 | ); |
||
40 |