1: | <?php declare(strict_types = 1); |
2: | |
3: | namespace PHPStan\PhpDoc\Tag; |
4: | |
5: | use PHPStan\Type\Type; |
6: | |
7: | /** |
8: | * @api |
9: | */ |
10: | final class PropertyTag |
11: | { |
12: | |
13: | public function __construct( |
14: | private ?Type $readableType, |
15: | private ?Type $writableType, |
16: | ) |
17: | { |
18: | } |
19: | |
20: | public function getReadableType(): ?Type |
21: | { |
22: | return $this->readableType; |
23: | } |
24: | |
25: | public function getWritableType(): ?Type |
26: | { |
27: | return $this->writableType; |
28: | } |
29: | |
30: | /** |
31: | * @phpstan-assert-if-true !null $this->getReadableType() |
32: | */ |
33: | public function isReadable(): bool |
34: | { |
35: | return $this->readableType !== null; |
36: | } |
37: | |
38: | /** |
39: | * @phpstan-assert-if-true !null $this->getWritableType() |
40: | */ |
41: | public function isWritable(): bool |
42: | { |
43: | return $this->writableType !== null; |
44: | } |
45: | |
46: | } |
47: |