| 1: | <?php declare(strict_types = 1); |
| 2: | |
| 3: | namespace PHPStan\Analyser; |
| 4: | |
| 5: | use PHPStan\Reflection\ClassConstantReflection; |
| 6: | use PHPStan\Reflection\ClassMemberAccessAnswerer; |
| 7: | use PHPStan\Reflection\ClassReflection; |
| 8: | use PHPStan\Reflection\ExtendedPropertyReflection; |
| 9: | use PHPStan\Reflection\MethodReflection; |
| 10: | use PHPStan\Reflection\PropertyReflection; |
| 11: | |
| 12: | final class OutOfClassScope implements ClassMemberAccessAnswerer |
| 13: | { |
| 14: | |
| 15: | |
| 16: | public function __construct() |
| 17: | { |
| 18: | } |
| 19: | |
| 20: | public function isInClass(): bool |
| 21: | { |
| 22: | return false; |
| 23: | } |
| 24: | |
| 25: | public function getClassReflection(): ?ClassReflection |
| 26: | { |
| 27: | return null; |
| 28: | } |
| 29: | |
| 30: | public function canAccessProperty(PropertyReflection $propertyReflection): bool |
| 31: | { |
| 32: | return $propertyReflection->isPublic(); |
| 33: | } |
| 34: | |
| 35: | public function canReadProperty(ExtendedPropertyReflection $propertyReflection): bool |
| 36: | { |
| 37: | return $propertyReflection->isPublic(); |
| 38: | } |
| 39: | |
| 40: | public function canWriteProperty(ExtendedPropertyReflection $propertyReflection): bool |
| 41: | { |
| 42: | return $propertyReflection->isPublic() |
| 43: | && !$propertyReflection->isProtectedSet() |
| 44: | && !$propertyReflection->isPrivateSet(); |
| 45: | } |
| 46: | |
| 47: | public function canCallMethod(MethodReflection $methodReflection): bool |
| 48: | { |
| 49: | return $methodReflection->isPublic(); |
| 50: | } |
| 51: | |
| 52: | public function canAccessConstant(ClassConstantReflection $constantReflection): bool |
| 53: | { |
| 54: | return $constantReflection->isPublic(); |
| 55: | } |
| 56: | |
| 57: | } |
| 58: | |