Skip to content

Commit 4ba265f

Browse files
wouterjnicolas-grekas
authored andcommitted
Add PHP types to private methods and functions
1 parent 2438133 commit 4ba265f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

User/InMemoryUserProvider.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ public function __construct(array $users = [])
5454
*/
5555
public function createUser(UserInterface $user)
5656
{
57+
if (!$user instanceof InMemoryUser) {
58+
trigger_deprecation('symfony/security-core', '6.3', 'Passing users that are not instance of "%s" to "%s" is deprecated, "%s" given.', InMemoryUser::class, __METHOD__, get_debug_type($user));
59+
}
60+
5761
$userIdentifier = strtolower($user->getUserIdentifier());
5862
if (isset($this->users[$userIdentifier])) {
5963
throw new \LogicException('Another user with the same username already exists.');
@@ -90,8 +94,10 @@ public function supportsClass(string $class): bool
9094
* Returns the user by given username.
9195
*
9296
* @throws UserNotFoundException if user whose given username does not exist
97+
*
98+
* @return InMemoryUser change return type on 7.0
9399
*/
94-
private function getUser(string $username)/* : InMemoryUser */
100+
private function getUser(string $username): UserInterface
95101
{
96102
if (!isset($this->users[strtolower($username)])) {
97103
$ex = new UserNotFoundException(sprintf('Username "%s" does not exist.', $username));

0 commit comments

Comments
 (0)