-
Notifications
You must be signed in to change notification settings - Fork 507
/
Copy pathScope.php
151 lines (102 loc) · 4.34 KB
/
Scope.php
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
<?php declare(strict_types = 1);
namespace PHPStan\Analyser;
use PhpParser\Node;
use PhpParser\Node\Expr;
use PhpParser\Node\Name;
use PhpParser\Node\Param;
use PHPStan\Php\PhpVersions;
use PHPStan\Reflection\ClassConstantReflection;
use PHPStan\Reflection\ClassMemberAccessAnswerer;
use PHPStan\Reflection\ClassReflection;
use PHPStan\Reflection\ExtendedMethodReflection;
use PHPStan\Reflection\ExtendedPropertyReflection;
use PHPStan\Reflection\FunctionReflection;
use PHPStan\Reflection\MethodReflection;
use PHPStan\Reflection\NamespaceAnswerer;
use PHPStan\Reflection\ParameterReflection;
use PHPStan\Reflection\ParametersAcceptor;
use PHPStan\Reflection\Php\PhpFunctionFromParserNodeReflection;
use PHPStan\TrinaryLogic;
use PHPStan\Type\Type;
use PHPStan\Type\TypeWithClassName;
/** @api */
interface Scope extends ClassMemberAccessAnswerer, NamespaceAnswerer
{
public const SUPERGLOBAL_VARIABLES = [
'GLOBALS',
'_SERVER',
'_GET',
'_POST',
'_FILES',
'_COOKIE',
'_SESSION',
'_REQUEST',
'_ENV',
];
public function getFile(): string;
public function getFileDescription(): string;
public function isDeclareStrictTypes(): bool;
/**
* @phpstan-assert-if-true !null $this->getTraitReflection()
*/
public function isInTrait(): bool;
public function getTraitReflection(): ?ClassReflection;
public function getFunction(): ?PhpFunctionFromParserNodeReflection;
public function getFunctionName(): ?string;
public function getParentScope(): ?self;
public function hasVariableType(string $variableName): TrinaryLogic;
public function getVariableType(string $variableName): Type;
public function canAnyVariableExist(): bool;
/**
* @return array<int, string>
*/
public function getDefinedVariables(): array;
/**
* @return array<int, string>
*/
public function getMaybeDefinedVariables(): array;
public function hasConstant(Name $name): bool;
/** @deprecated Use getInstancePropertyReflection or getStaticPropertyReflection instead */
public function getPropertyReflection(Type $typeWithProperty, string $propertyName): ?ExtendedPropertyReflection;
public function getInstancePropertyReflection(Type $typeWithProperty, string $propertyName): ?ExtendedPropertyReflection;
public function getStaticPropertyReflection(Type $typeWithProperty, string $propertyName): ?ExtendedPropertyReflection;
public function getMethodReflection(Type $typeWithMethod, string $methodName): ?ExtendedMethodReflection;
public function getConstantReflection(Type $typeWithConstant, string $constantName): ?ClassConstantReflection;
public function getIterableKeyType(Type $iteratee): Type;
public function getIterableValueType(Type $iteratee): Type;
/**
* @phpstan-assert-if-true !null $this->getAnonymousFunctionReflection()
* @phpstan-assert-if-true !null $this->getAnonymousFunctionReturnType()
*/
public function isInAnonymousFunction(): bool;
public function getAnonymousFunctionReflection(): ?ParametersAcceptor;
public function getAnonymousFunctionReturnType(): ?Type;
public function getType(Expr $node): Type;
public function getNativeType(Expr $expr): Type;
public function getKeepVoidType(Expr $node): Type;
public function resolveName(Name $name): string;
public function resolveTypeByName(Name $name): TypeWithClassName;
/**
* @param mixed $value
*/
public function getTypeFromValue($value): Type;
public function hasExpressionType(Expr $node): TrinaryLogic;
public function isInClassExists(string $className): bool;
public function isInFunctionExists(string $functionName): bool;
public function isInClosureBind(): bool;
/** @return list<FunctionReflection|MethodReflection> */
public function getFunctionCallStack(): array;
/** @return list<array{FunctionReflection|MethodReflection, ParameterReflection|null}> */
public function getFunctionCallStackWithParameters(): array;
public function isParameterValueNullable(Param $parameter): bool;
/**
* @param Node\Name|Node\Identifier|Node\ComplexType|null $type
*/
public function getFunctionType($type, bool $isNullable, bool $isVariadic): Type;
public function isInExpressionAssign(Expr $expr): bool;
public function isUndefinedExpressionAllowed(Expr $expr): bool;
public function filterByTruthyValue(Expr $expr): self;
public function filterByFalseyValue(Expr $expr): self;
public function isInFirstLevelStatement(): bool;
public function getPhpVersion(): PhpVersions;
}