Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
FlagCountManagerInterface::getUserCounts() expects a flag and user object and calls methods on each in order to function. Without type hinting, the call could fail due to the wrong type of class.
Proposed resolution
Add type hinting to FlagCountManagerInterface::getUserCounts().
Remaining tasks
Create, test patch.
User interface changes
None.
API changes
FlagCountManagerInterface::getUserCounts() would operate the same, but have additional language level protection against errors.
Comment | File | Size | Author |
---|---|---|---|
#1 | 2479799.1.getUserCountsTypeHinting.patch | 1.71 KB | socketwench |
Comments
Comment #1
socketwench CreditAttribution: socketwench commentedComment #2
joshi.rohit100I think
AccountInterface $user
should beAccountInterface $account
for the consistency.Comment #3
joachim CreditAttribution: joachim commentedI agree -- though on D8 without the global $user there's no longer that security risk.
But best if we only change one thing at a time.
Comment #4
joachim CreditAttribution: joachim commentedCommitted!