1: <?php declare(strict_types=1);
2:
3: namespace Salient\PHPDoc\Tag;
4:
5: use Salient\Core\Concern\HasMutator;
6:
7: /**
8: * A "@var" tag
9: */
10: class VarTag extends AbstractTag
11: {
12: use HasMutator;
13:
14: /**
15: * Creates a new VarTag object
16: *
17: * @param class-string|null $class
18: */
19: public function __construct(
20: string $type,
21: ?string $name = null,
22: ?string $description = null,
23: ?string $class = null,
24: ?string $member = null
25: ) {
26: parent::__construct('var', $name, $type, $description, $class, $member);
27: }
28:
29: /**
30: * @inheritDoc
31: */
32: public function getType(): string
33: {
34: return $this->Type;
35: }
36:
37: /**
38: * Get an instance with the given name
39: *
40: * @return static
41: */
42: public function withName(?string $name)
43: {
44: if ($name === null) {
45: return $this->without('Name');
46: }
47: return $this->with('Name', $this->filterString($name, 'name'));
48: }
49: }
50: