Change record status: 
Project: 
Introduced in branch: 
10.1.x
Introduced in version: 
10.1.0
Description: 

The methods User::addRole() and User::removeRole() previously did not return a value, and therefore could not be chained. Now both return $this and can be used in chained calls.

There is no backward compatibility break; however, the UserInterface documentation has been updated and so child implementations should also return $this for forward-compatibility.

Example before:


$user->removeRole('editor');
$user->addRole('contributor');
$user->save();

Now can be written as:


$user
  ->removeRole('editor')
  ->addRole('contributor')
  ->save();

Impacts: 
Module developers