Avoid type warning when using array_combine on empty arrays

This commit is contained in:
Matthias Jentsch 2014-09-30 15:50:58 +02:00
parent f1903855b9
commit 8eb7db9b35
1 changed files with 3 additions and 1 deletions

View File

@ -198,7 +198,9 @@ class User
public function setPermissions(array $permissions) public function setPermissions(array $permissions)
{ {
natcasesort($permissions); natcasesort($permissions);
$this->permissions = array_combine($permissions, $permissions); if (! empty($permissions)) {
$this->permissions = array_combine($permissions, $permissions);
}
return $this; return $this;
} }