Model/User.php
public function getRoles(): ?array
    {
        $roles = $this->roles;
        $groupRoles = [[]];

        foreach ($this->getGroups() as $group) {
            $groupRoles[] = $group->getRoles();
        }
        $groupRoles = array_merge(...$groupRoles);

        return array_unique(array_merge($roles, $groupRoles));
    }
public function getRoles(): ?array
    {
        $roles = $this->roles;
        $groupRoles = [[]];

        foreach ($this->getGroups() as $group) {
            $groupRoles[] = $group->getRoles();
        }
        $groupRoles = array_merge(...$groupRoles);

        return array_unique(array_merge($roles, $groupRoles));
    }
public function getRoles ( ) : ? array { $ roles = $ this -> roles ; $ groupRoles = [ [ ] ] ; foreach ( $ this -> getGroups ( ) as $ group ) { $ groupRoles [ ] = $ group -> getRoles ( ) ; } $ groupRoles = array_merge ( ... $ groupRoles ) ; return array_unique ( array_merge ( $ roles , $ groupRoles ) ) ; }
Group combined Roles.

@return array
Group combined Roles .