Skip to content

Commit

Permalink
More specific types in the doc blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
christeredvartsen committed Aug 30, 2021
1 parent 354d54c commit f6add3d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions src/Auth/AccessControl/Adapter/AdapterInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ interface AdapterInterface {
*
* @param string $publicKey Public key to check access for
* @param string $resource Resource identifier (e.g. image.get, images.post)
* @return array List of users the public key kan access the given resource for
* @return array<string> List of users the public key kan access the given resource for
*/
function getUsersForResource(string $publicKey, string $resource): array;

Expand All @@ -32,7 +32,7 @@ function hasAccess(string $publicKey, string $resource, string $user = null): bo
*
* @param GroupQuery $query A query object used to filter the groups returned
* @param GroupsModel $model Groups model to populate total number of hits with
* @return array
* @return array<string,array<string>>
*/
function getGroups(GroupQuery $query, GroupsModel $model): array;

Expand All @@ -48,7 +48,7 @@ function groupExists(string $groupName): bool;
* Fetch a resource group with the given name
*
* @param string $groupName Name of the group
* @return array Array of resources the group consists of
* @return array<string> Array of resources the group consists of
*/
function getGroup(string $groupName): ?array;

Expand All @@ -72,7 +72,7 @@ function publicKeyExists(string $publicKey): bool;
* Get the access control list for a given public key
*
* @param string $publicKey
* @return array
* @return array<array{id:int|string,users:array<string>,resources:array<string>}>
*/
function getAccessListForPublicKey(string $publicKey): array;

Expand All @@ -81,7 +81,7 @@ function getAccessListForPublicKey(string $publicKey): array;
*
* @param string $publicKey Public key to add access rule to
* @param int|string $accessRuleId Access rule id
* @return array Access rule
* @return array{id:int|string,users:array<string>,resources:array<string>} Access rule
*/
function getAccessRule(string $publicKey, $accessRuleId): ?array;
}
12 changes: 6 additions & 6 deletions src/Auth/AccessControl/Adapter/MutableAdapterInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,25 +35,25 @@ function updatePrivateKey(string $publicKey, string $privateKey): bool;
* Add a new access rule to the given public key
*
* @param string $publicKey Public key to add access rule to
* @param array $accessRule Access rule definition
* @return string Returns a generated access ID
* @param array{resources:array<string>,users:array<string>} $accessRule Access rule definition
* @return string Returns a generated access rule ID
*/
function addAccessRule(string $publicKey, array $accessRule): string;

/**
* Delete an access rule
*
* @param string $publicKey Public key the access rule belongs to
* @param string $accessId Access ID of the rule
* @param string $accessRuleId ID of the access rule
* @return bool
*/
function deleteAccessRule(string $publicKey, string $accessId): bool;
function deleteAccessRule(string $publicKey, string $accessRuleId): bool;

/**
* Add a new group containing the given resources
*
* @param string $groupName Group name
* @param array $resources Array of resources (eg. 'image.get', 'user.head' etc)
* @param array<string> $resources Array of resources (eg. 'image.get', 'user.head' etc)
* @return bool
*/
function addResourceGroup(string $groupName, array $resources = []): bool;
Expand All @@ -62,7 +62,7 @@ function addResourceGroup(string $groupName, array $resources = []): bool;
* Update resources for an existing resource group
*
* @param string $groupName Group to add resources to
* @param array $resources Array of resources (eg. 'image.get', 'user.head' etc)
* @param array<string> $resources Array of resources (eg. 'image.get', 'user.head' etc)
* @param bool
*/
function updateResourceGroup(string $groupName, array $resources): bool;
Expand Down

0 comments on commit f6add3d

Please sign in to comment.