@@ -144,7 +144,7 @@ protected function _isProtectedPrefix($prefix, array $protectedPrefixes) {
144
144
}
145
145
146
146
/**
147
- * @param array<int> $userRoles
147
+ * @param array<string, int|string > $userRoles
148
148
* @param array $params
149
149
*
150
150
* @return bool
@@ -259,7 +259,7 @@ protected function _prefixesFromRoles(array $roles) {
259
259
/**
260
260
* @param string $prefix
261
261
* @param array<string> $prefixMap
262
- * @param array<int> $userRoles
262
+ * @param array<string, int|string > $userRoles
263
263
* @param array<int> $availableRoles
264
264
*
265
265
* @return bool
@@ -440,7 +440,7 @@ protected function _constructIniKey($params) {
440
440
* Configure first, tries database roles table next.
441
441
*
442
442
* @throws \Cake\Core\Exception\CakeException
443
- * @return array<int> List with all available roles
443
+ * @return array<string, int> List with all available roles
444
444
*/
445
445
protected function _getAvailableRoles () {
446
446
if ($ this ->_roles !== null ) {
@@ -514,7 +514,7 @@ protected function _getRolesFromDb(string $rolesTableKey): array {
514
514
*
515
515
* @param array $user The user to get the roles for
516
516
* @throws \Cake\Core\Exception\CakeException
517
- * @return array<int> List with all role ids belonging to the user
517
+ * @return array<string, int|string > List with all role ids belonging to the user
518
518
*/
519
519
protected function _getUserRoles ($ user ) {
520
520
// Single-role from session
@@ -610,8 +610,8 @@ protected function _getRolesFromJunction($pivotTableName, $id) {
610
610
/**
611
611
* Returns current roles as [alias => id] pairs.
612
612
*
613
- * @param array<int> $roles
614
- * @return array<int>
613
+ * @param array<int|string|\BackedEnum > $roles
614
+ * @return array<string, int|string >
615
615
*/
616
616
protected function _mapped (array $ roles ) {
617
617
$ availableRoles = $ this ->_getAvailableRoles ();
@@ -620,7 +620,8 @@ protected function _mapped(array $roles) {
620
620
foreach ($ roles as $ role ) {
621
621
if ($ role instanceof BackedEnum) {
622
622
$ alias = $ role instanceof EnumLabelInterface ? $ role ->label () : $ role ->name ;
623
- $ array [$ role ->value ] = $ alias ;
623
+ $ value = $ role ->value ;
624
+ $ array [$ alias ] = $ value ;
624
625
625
626
continue ;
626
627
}
0 commit comments