Skip to content

Conversation

@joshtrichards
Copy link
Member

  • Resolves: #

Summary

TODO

  • ...

Checklist

Updated the docblock for the getMentions method to clarify its return value and sorting behavior.

Signed-off-by: Josh <[email protected]>
Updated the getMentions method to inherit documentation and change sorting logic.

Signed-off-by: Josh <[email protected]>
@joshtrichards joshtrichards added this to the Nextcloud 33 milestone Nov 3, 2025
@joshtrichards joshtrichards marked this pull request as ready for review November 3, 2025 15:54
@joshtrichards joshtrichards requested review from a team and nickvergessen as code owners November 3, 2025 15:54
Comment on lines 184 to 186
/**
* returns an array containing mentions that are included in the comment
*
* @return array each mention provides a 'type' and an 'id', see example below
* @psalm-return list<array{type: 'guest'|'email'|'federated_group'|'group'|'federated_team'|'team'|'federated_user'|'user', id: non-empty-lowercase-string}>
* @since 30.0.2 Type 'email' is supported
* @since 29.0.0 Types 'federated_group', 'federated_team', 'team' and 'federated_user' are supported
* @since 23.0.0 Type 'group' is supported
* @since 17.0.0 Type 'guest' is supported
* @since 11.0.0
* @inheritDoc
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would completely remove that block and add a #[Override] instead

Comment on lines +230 to +232
usort($result, static function ($mention1, $mention2) {
return mb_strlen($mention2['id']) <=> mb_strlen($mention1['id']);
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
usort($result, static function ($mention1, $mention2) {
return mb_strlen($mention2['id']) <=> mb_strlen($mention1['id']);
});
usort($result, static fn (array $mention1, array $mention2): int => mb_strlen($mention2['id']) <=> mb_strlen($mention1['id']));

While at it ;)

Comment on lines +131 to 132
* @return array Each mention is an associative array with 'type' and 'id' keys, sorted by descending length.
* @psalm-return list<array{type: 'guest'|'email'|'federated_group'|'group'|'federated_team'|'team'|'federated_user'|'user', id: non-empty-lowercase-string}>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @return array Each mention is an associative array with 'type' and 'id' keys, sorted by descending length.
* @psalm-return list<array{type: 'guest'|'email'|'federated_group'|'group'|'federated_team'|'team'|'federated_user'|'user', id: non-empty-lowercase-string}>
* @return list<array{type: 'guest'|'email'|'federated_group'|'group'|'federated_team'|'team'|'federated_user'|'user', id: non-empty-lowercase-string}> Each mention is an associative array with 'type' and 'id' keys, sorted by descending length.

Merge the two @return annotation

* @since 30.0.2 Type 'email' is supported
* @since 29.0.0 Types 'federated_group', 'federated_team', 'team' and 'federated_user' are supported
* @since 23.0.0 Type 'group' is supported
* @since 21.0.1 Sort returned results by
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

by what?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants