Skip to content
Snippets Groups Projects

Add type-hint to hasPermission() #3415189

1 unresolved thread

Closes #3415189

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
50 50 * @return bool
51 51 * TRUE if the user has the permission, FALSE otherwise.
52 52 */
53 public function hasPermission(/* string */$permission);
53 public function hasPermission(string $permission): bool;
  • Comment on lines -53 to +53

    I am not sure we can add the bool return type straight ahead here. That would break covariance in contrib that implements the interface. As a minimum we should do

    Suggested change
    53 public function hasPermission(string $permission): bool;
    53 public function hasPermission(/* string */$permission)/* : bool */;

    in 10.3 and then implement the returntype in 11.

  • This issue is not about typehinting the return value, so we should not do that here.

  • Please register or sign in to reply
Please register or sign in to reply
Loading