Change record status: 
Project: 
Introduced in branch: 
8.x
Description: 

Instead of accessing the information about roles directly there are a bunch of helper methods.

Drupal 7:

<?php
// Get a list of all roles.
$account->roles
// Check whether a user has a certain role
isset($account->roles[$rid])
// Add a role
$account->roles[$rid] = $rid;
// Remove a role
unset($account->roles[$rid]);
?>

Drupal 8

<?php
// Get a list of all roles.
$account->getRoles()
// Check whether a user has a certain role
$account->hasRole($rid);
// Add a role
$account->addRole($rid);
// Remove a role
$account->removeRole($rid);
?>
Updates Done (doc team, etc.)
Online documentation: 
Not done
Theming guide: 
Not done
Module developer documentation: 
Not done
Examples project: 
Not done
Coder Review: 
Not done
Coder Upgrade: 
Not done
Other: 
Other updates done