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