access = $access; } abstract public function getModifiers(): string; /** @psalm-param ?class-string $scope */ public function isAccessible(?string $scope): bool { if (__PHP_Incomplete_Class::class === $this->owner_class) { return false; } if (self::ACCESS_PUBLIC === $this->access) { return true; } if (null === $scope) { return false; } if (self::ACCESS_PRIVATE === $this->access) { return $scope === $this->owner_class; } if (\is_a($scope, $this->owner_class, true)) { return true; } if (\is_a($this->owner_class, $scope, true)) { return true; } return false; } protected function getAccess(): string { switch ($this->access) { case self::ACCESS_PUBLIC: return 'public'; case self::ACCESS_PROTECTED: return 'protected'; case self::ACCESS_PRIVATE: return 'private'; } } }