diff options
author | Carl Schwan <carl@carlschwan.eu> | 2022-04-19 13:05:38 +0200 |
---|---|---|
committer | Côme Chilliet (Rebase PR Action) <come-nc@users.noreply.github.com> | 2022-09-29 15:15:28 +0000 |
commit | 92a5a8f075fe5e6b72037cc4a668090d3a8cacf5 (patch) | |
tree | 198134dd6411f82a077a70b37bec735024437e1d /lib/public | |
parent | b4708fb9f003a306edcfe0346e25f9583c4c162a (diff) | |
download | nextcloud-server-92a5a8f075fe5e6b72037cc4a668090d3a8cacf5.tar.gz nextcloud-server-92a5a8f075fe5e6b72037cc4a668090d3a8cacf5.zip |
Cleanup tags and Share component
- Port to LoggerInterface
- Use IDBConnection and IQueryBuilder instead of raw SQL and OC_DB
- Use IEventListener instead of hooks
- Remove the now unused OC_DB and OC_DB_StatementWrapper legacy utils
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
Diffstat (limited to 'lib/public')
-rw-r--r-- | lib/public/ITags.php | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/lib/public/ITags.php b/lib/public/ITags.php index 03bcb845f4e..06497781bee 100644 --- a/lib/public/ITags.php +++ b/lib/public/ITags.php @@ -32,9 +32,6 @@ namespace OCP; use OC\Tags; -// FIXME: Where should I put this? Or should it be implemented as a Listener? -\OC_Hook::connect('OC_User', 'post_deleteUser', Tags::class, 'post_deleteUser'); - /** * Class for easily tagging objects by their id * @@ -55,11 +52,9 @@ interface ITags { /** * Check if any tags are saved for this type and user. - * - * @return boolean * @since 6.0.0 */ - public function isEmpty(); + public function isEmpty(): bool; /** * Returns an array mapping a given tag's properties to its values: @@ -69,34 +64,40 @@ interface ITags { * @return array|false * @since 8.0.0 */ - public function getTag($id); + public function getTag(string $id); /** * Get the tags for a specific user. * * This returns an array with id/name maps: + * + * ```php * [ * ['id' => 0, 'name' = 'First tag'], * ['id' => 1, 'name' = 'Second tag'], * ] + * ``` * - * @return array + * @return array<array-key, array{id: int, name: string}> * @since 6.0.0 */ - public function getTags(); + public function getTags(): array; /** * Get a list of tags for the given item ids. * * This returns an array with object id / tag names: + * + * ```php * [ * 1 => array('First tag', 'Second tag'), * 2 => array('Second tag'), * 3 => array('Second tag', 'Third tag'), * ] + * ``` * * @param array $objIds item ids - * @return array|boolean with object id as key and an array + * @return array|false with object id as key and an array * of tag names as value or false if an error occurred * @since 8.0.0 */ @@ -117,10 +118,9 @@ interface ITags { * Checks whether a tag is already saved. * * @param string $name The name to check for. - * @return bool * @since 6.0.0 */ - public function hasTag($name); + public function hasTag(string $name): bool; /** * Checks whether a tag is saved for the given user, @@ -131,7 +131,7 @@ interface ITags { * @return bool * @since 8.0.0 */ - public function userHasTag($name, $user); + public function userHasTag(string $name, string $user): bool; /** * Add a new tag. @@ -140,7 +140,7 @@ interface ITags { * @return int|false the id of the added tag or false if it already exists. * @since 6.0.0 */ - public function add($name); + public function add(string $name); /** * Rename tag. @@ -150,19 +150,19 @@ interface ITags { * @return bool * @since 6.0.0 */ - public function rename($from, $to); + public function rename($from, string $to): bool; /** * Add a list of new tags. * - * @param string[] $names A string with a name or an array of strings containing + * @param string|string[] $names A string with a name or an array of strings containing * the name(s) of the to add. * @param bool $sync When true, save the tags * @param int|null $id int Optional object id to add to this|these tag(s) * @return bool Returns false on error. * @since 6.0.0 */ - public function addMultiple($names, $sync = false, $id = null); + public function addMultiple($names, bool $sync = false, ?int $id = null): bool; /** * Delete tag/object relations from the db |