1: <?php declare(strict_types = 1);
2:
3: namespace PHPStan\Reflection;
4:
5: /**
6: * Answers questions about visibility and access rights for class members
7: * (properties, methods, constants) from the current analysis context.
8: *
9: * This interface is the Scope's role as an access control checker. It is
10: * passed as a parameter to Type methods like getMethod(), getProperty(),
11: * getConstant(), etc., so the type system can enforce visibility rules
12: * (public/protected/private) based on where the access occurs.
13: *
14: * The primary implementation is MutatingScope. A secondary implementation,
15: * OutOfClassScope, is used when accessing members from outside any class.
16: *
17: * @api
18: * @api-do-not-implement
19: */
20: interface ClassMemberAccessAnswerer
21: {
22:
23: /**
24: * @phpstan-assert-if-true !null $this->getClassReflection()
25: */
26: public function isInClass(): bool;
27:
28: public function getClassReflection(): ?ClassReflection;
29:
30: /**
31: * @deprecated Use canReadProperty() or canWriteProperty()
32: */
33: public function canAccessProperty(PropertyReflection $propertyReflection): bool;
34:
35: public function canReadProperty(ExtendedPropertyReflection $propertyReflection): bool;
36:
37: public function canWriteProperty(ExtendedPropertyReflection $propertyReflection): bool;
38:
39: public function canCallMethod(MethodReflection $methodReflection): bool;
40:
41: public function canAccessConstant(ClassConstantReflection $constantReflection): bool;
42:
43: }
44: