diff --git a/src/Security/UserClassBuilder.php b/src/Security/UserClassBuilder.php index e99af57dc..99b3290f2 100644 --- a/src/Security/UserClassBuilder.php +++ b/src/Security/UserClassBuilder.php @@ -160,12 +160,15 @@ private function addGetRoles(ClassSourceManipulator $manipulator, UserClassConfi ) ); $builder->addStmt($manipulator->createMethodLevelBlankLine()); - // return array_unique($roles); + // return array_values(array_unique($roles)); $builder->addStmt( new Node\Stmt\Return_( new Node\Expr\FuncCall( - new Node\Name('array_unique'), - [new Node\Expr\Variable('roles')] + new Node\Name('array_values'), + [new Node\Expr\FuncCall( + new Node\Name('array_unique'), + [new Node\Expr\Variable('roles')] + )] ) ) ); diff --git a/tests/Security/fixtures/expected/UserEntityWithEmailAsIdentifier.php b/tests/Security/fixtures/expected/UserEntityWithEmailAsIdentifier.php index d053ec604..f238ab994 100644 --- a/tests/Security/fixtures/expected/UserEntityWithEmailAsIdentifier.php +++ b/tests/Security/fixtures/expected/UserEntityWithEmailAsIdentifier.php @@ -67,7 +67,7 @@ public function getRoles(): array // guarantee every user at least has ROLE_USER $roles[] = 'ROLE_USER'; - return array_unique($roles); + return array_values(array_unique($roles)); } /** diff --git a/tests/Security/fixtures/expected/UserEntityWithPassword.php b/tests/Security/fixtures/expected/UserEntityWithPassword.php index ae4158d56..fd68742c8 100644 --- a/tests/Security/fixtures/expected/UserEntityWithPassword.php +++ b/tests/Security/fixtures/expected/UserEntityWithPassword.php @@ -62,7 +62,7 @@ public function getRoles(): array // guarantee every user at least has ROLE_USER $roles[] = 'ROLE_USER'; - return array_unique($roles); + return array_values(array_unique($roles)); } /** diff --git a/tests/Security/fixtures/expected/UserEntityWithUser_IdentifierAsIdentifier.php b/tests/Security/fixtures/expected/UserEntityWithUser_IdentifierAsIdentifier.php index 709982a4a..9d395556b 100644 --- a/tests/Security/fixtures/expected/UserEntityWithUser_IdentifierAsIdentifier.php +++ b/tests/Security/fixtures/expected/UserEntityWithUser_IdentifierAsIdentifier.php @@ -62,7 +62,7 @@ public function getRoles(): array // guarantee every user at least has ROLE_USER $roles[] = 'ROLE_USER'; - return array_unique($roles); + return array_values(array_unique($roles)); } /** diff --git a/tests/Security/fixtures/expected/UserEntityWithoutPassword.php b/tests/Security/fixtures/expected/UserEntityWithoutPassword.php index a1deca0f6..a8ac03d7e 100644 --- a/tests/Security/fixtures/expected/UserEntityWithoutPassword.php +++ b/tests/Security/fixtures/expected/UserEntityWithoutPassword.php @@ -55,7 +55,7 @@ public function getRoles(): array // guarantee every user at least has ROLE_USER $roles[] = 'ROLE_USER'; - return array_unique($roles); + return array_values(array_unique($roles)); } /** diff --git a/tests/Security/fixtures/expected/UserModelWithEmailAsIdentifier.php b/tests/Security/fixtures/expected/UserModelWithEmailAsIdentifier.php index d08e3b66e..8322b29bd 100644 --- a/tests/Security/fixtures/expected/UserModelWithEmailAsIdentifier.php +++ b/tests/Security/fixtures/expected/UserModelWithEmailAsIdentifier.php @@ -51,7 +51,7 @@ public function getRoles(): array // guarantee every user at least has ROLE_USER $roles[] = 'ROLE_USER'; - return array_unique($roles); + return array_values(array_unique($roles)); } /** diff --git a/tests/Security/fixtures/expected/UserModelWithPassword.php b/tests/Security/fixtures/expected/UserModelWithPassword.php index fd2e86898..1d56d630c 100644 --- a/tests/Security/fixtures/expected/UserModelWithPassword.php +++ b/tests/Security/fixtures/expected/UserModelWithPassword.php @@ -46,7 +46,7 @@ public function getRoles(): array // guarantee every user at least has ROLE_USER $roles[] = 'ROLE_USER'; - return array_unique($roles); + return array_values(array_unique($roles)); } /** diff --git a/tests/Security/fixtures/expected/UserModelWithoutPassword.php b/tests/Security/fixtures/expected/UserModelWithoutPassword.php index 355721786..6127c8df3 100644 --- a/tests/Security/fixtures/expected/UserModelWithoutPassword.php +++ b/tests/Security/fixtures/expected/UserModelWithoutPassword.php @@ -40,7 +40,7 @@ public function getRoles(): array // guarantee every user at least has ROLE_USER $roles[] = 'ROLE_USER'; - return array_unique($roles); + return array_values(array_unique($roles)); } /**