Drupal-check noticed some issues with VoteManager::addVote, and on further inspection there were more issues to address. Namely:
- $rating is assumed to be an integer but not checked.
- $rating is checked for >100 but not <0
- A type-hint on the voteStorage->create call assists drupal-check (etc) validate the function calls
- The function-docs on addVote were inadequate
Also:
- deleteVote is stubbed out without explanation, which seems odd. Inserted TODO to explain why.
- Exceptions thrown by getVoteTypes can be avoided by returning the empty list.
- Exceptions thrown by __construct should be documented.
Fixes for the above issues are included in the patch.
None.
The accepted type for the $vote_type parameter has been narrowed to 'string', which it should in all cases be anyway.
The accepted type for $rating is still 'mixed' but the @param now notes 'string' is accepted as well as 'int', and the conversion is explicitly managed.
None
Needs work
3.0
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.