-
Notifications
You must be signed in to change notification settings - Fork 574
Expand file tree
/
Copy pathExtendedNativeParameterReflection.php
More file actions
117 lines (96 loc) · 2.36 KB
/
ExtendedNativeParameterReflection.php
File metadata and controls
117 lines (96 loc) · 2.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<?php declare(strict_types = 1);
namespace PHPStan\Reflection\Native;
use PHPStan\Reflection\AllowedConstantsResult;
use PHPStan\Reflection\AttributeReflection;
use PHPStan\Reflection\ExtendedParameterReflection;
use PHPStan\Reflection\ParameterAllowedConstants;
use PHPStan\Reflection\PassedByReference;
use PHPStan\TrinaryLogic;
use PHPStan\Type\MixedType;
use PHPStan\Type\Type;
final class ExtendedNativeParameterReflection implements ExtendedParameterReflection
{
/**
* @param list<AttributeReflection> $attributes
*/
public function __construct(
private string $name,
private bool $optional,
private Type $type,
private Type $phpDocType,
private Type $nativeType,
private PassedByReference $passedByReference,
private bool $variadic,
private ?Type $defaultValue,
private ?Type $outType,
private TrinaryLogic $immediatelyInvokedCallable,
private ?Type $closureThisType,
private array $attributes,
private ?ParameterAllowedConstants $allowedConstants,
)
{
}
public function getName(): string
{
return $this->name;
}
public function isOptional(): bool
{
return $this->optional;
}
public function getType(): Type
{
return $this->type;
}
public function getPhpDocType(): Type
{
return $this->phpDocType;
}
public function hasNativeType(): bool
{
return !$this->nativeType instanceof MixedType || $this->nativeType->isExplicitMixed();
}
public function getNativeType(): Type
{
return $this->nativeType;
}
public function passedByReference(): PassedByReference
{
return $this->passedByReference;
}
public function isVariadic(): bool
{
return $this->variadic;
}
public function getDefaultValue(): ?Type
{
return $this->defaultValue;
}
public function getOutType(): ?Type
{
return $this->outType;
}
public function isImmediatelyInvokedCallable(): TrinaryLogic
{
return $this->immediatelyInvokedCallable;
}
public function getClosureThisType(): ?Type
{
return $this->closureThisType;
}
public function getAttributes(): array
{
return $this->attributes;
}
public function getAllowedConstants(): ?ParameterAllowedConstants
{
return $this->allowedConstants;
}
public function checkAllowedConstants(array $constants): AllowedConstantsResult
{
if ($this->allowedConstants === null) {
return new AllowedConstantsResult([], [], false);
}
return $this->allowedConstants->check($constants);
}
}