Programatically assigning multiple user role ?
If you look at User::addRole it says


  User::addRole($rid) 
  
  string $rid: The role ID to add.


Therefore, this cannot be an array. Thus, you must do this separate

$user-&gt;addRole('lecturer');
$user-&gt;addRole('program coodinator');
$user-&gt;save();


If you look at class User, there is no such thing as "addRoles" or any method that allows multiple way of doing it with an array.