1: <?php declare(strict_types = 1);
2:
3: namespace PHPStan\Analyser;
4:
5: use PhpParser\Node;
6: use PhpParser\Node\Expr;
7: use PhpParser\Node\Name;
8: use PhpParser\Node\Param;
9: use PHPStan\Reflection\ClassMemberAccessAnswerer;
10: use PHPStan\Reflection\ClassReflection;
11: use PHPStan\Reflection\ConstantReflection;
12: use PHPStan\Reflection\ExtendedMethodReflection;
13: use PHPStan\Reflection\FunctionReflection;
14: use PHPStan\Reflection\NamespaceAnswerer;
15: use PHPStan\Reflection\ParametersAcceptor;
16: use PHPStan\Reflection\PropertyReflection;
17: use PHPStan\TrinaryLogic;
18: use PHPStan\Type\Type;
19: use PHPStan\Type\TypeWithClassName;
20:
21: /** @api */
22: interface Scope extends ClassMemberAccessAnswerer, NamespaceAnswerer
23: {
24:
25: public function getFile(): string;
26:
27: public function getFileDescription(): string;
28:
29: public function isDeclareStrictTypes(): bool;
30:
31: /**
32: * @phpstan-assert-if-true !null $this->getTraitReflection()
33: */
34: public function isInTrait(): bool;
35:
36: public function getTraitReflection(): ?ClassReflection;
37:
38: /**
39: * @return FunctionReflection|ExtendedMethodReflection|null
40: */
41: public function getFunction();
42:
43: public function getFunctionName(): ?string;
44:
45: public function getParentScope(): ?self;
46:
47: public function hasVariableType(string $variableName): TrinaryLogic;
48:
49: public function getVariableType(string $variableName): Type;
50:
51: public function canAnyVariableExist(): bool;
52:
53: /**
54: * @return array<int, string>
55: */
56: public function getDefinedVariables(): array;
57:
58: public function hasConstant(Name $name): bool;
59:
60: public function getPropertyReflection(Type $typeWithProperty, string $propertyName): ?PropertyReflection;
61:
62: public function getMethodReflection(Type $typeWithMethod, string $methodName): ?ExtendedMethodReflection;
63:
64: public function getConstantReflection(Type $typeWithConstant, string $constantName): ?ConstantReflection;
65:
66: public function isInAnonymousFunction(): bool;
67:
68: public function getAnonymousFunctionReflection(): ?ParametersAcceptor;
69:
70: public function getAnonymousFunctionReturnType(): ?Type;
71:
72: public function getType(Expr $node): Type;
73:
74: public function getNativeType(Expr $expr): Type;
75:
76: public function doNotTreatPhpDocTypesAsCertain(): self;
77:
78: public function resolveName(Name $name): string;
79:
80: public function resolveTypeByName(Name $name): TypeWithClassName;
81:
82: /**
83: * @param mixed $value
84: */
85: public function getTypeFromValue($value): Type;
86:
87: /** @deprecated use hasExpressionType instead */
88: public function isSpecified(Expr $node): bool;
89:
90: public function hasExpressionType(Expr $node): TrinaryLogic;
91:
92: public function isInClassExists(string $className): bool;
93:
94: public function isInFunctionExists(string $functionName): bool;
95:
96: public function isInClosureBind(): bool;
97:
98: public function isParameterValueNullable(Param $parameter): bool;
99:
100: /**
101: * @param Node\Name|Node\Identifier|Node\ComplexType|null $type
102: */
103: public function getFunctionType($type, bool $isNullable, bool $isVariadic): Type;
104:
105: public function isInExpressionAssign(Expr $expr): bool;
106:
107: public function isUndefinedExpressionAllowed(Expr $expr): bool;
108:
109: public function filterByTruthyValue(Expr $expr): self;
110:
111: public function filterByFalseyValue(Expr $expr): self;
112:
113: public function isInFirstLevelStatement(): bool;
114:
115: }
116: