Skip to content

Commit

Permalink
Merge pull request PrestaShop#36322 from jolelievre/symfony-clean
Browse files Browse the repository at this point in the history
Symfony clean after migration
  • Loading branch information
nicosomb authored Jun 10, 2024
2 parents 82b7790 + 9c48b3f commit 74f1ff1
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 38 deletions.
20 changes: 9 additions & 11 deletions src/Core/Context/LegacyControllerContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,20 +111,18 @@ class LegacyControllerContext
* @param string|null $token Legacy security token
* @param string $override_folder
* @param string $currentIndex Legacy current index built like a legacy URL based on controller name
*
* @todo Add a readonly tag to fields when switching to symfony 6.2, currently an error does not allow this to be done (see https://github.com/FriendsOfPHP/proxy-manager-lts/issues/26)
*/
public function __construct(
protected readonly ContainerInterface $container,
public string $controller_name,
public string $controller_type,
public int $multishop_context,
public ?string $className,
public int $id,
public ?string $token,
public string $override_folder,
public string $currentIndex,
public string $table,
public readonly string $controller_name,
public readonly string $controller_type,
public readonly int $multishop_context,
public readonly ?string $className,
public readonly int $id,
public readonly ?string $token,
public readonly string $override_folder,
public readonly string $currentIndex,
public readonly string $table,
) {
$this->php_self = $this->controller_name;
}
Expand Down
5 changes: 0 additions & 5 deletions src/Core/Security/OAuth2/JwtTokenUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,6 @@ public function eraseCredentials()
return;
}

public function getUsername()
{
return '';
}

public function getUserIdentifier(): string
{
return $this->userId;
Expand Down
5 changes: 0 additions & 5 deletions src/PrestaShopBundle/Entity/ApiClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,11 +232,6 @@ public function eraseCredentials(): void
{
}

public function getUsername(): string
{
return $this->getClientName();
}

public function getUserIdentifier(): string
{
return $this->getClientId();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,4 @@ public function supportsClass(string $class): bool
{
return $class === ApiClient::class;
}

public function loadUserByUsername(string $username): ApiClient
{
return $this->loadUserByIdentifier($username);
}
}
12 changes: 0 additions & 12 deletions src/PrestaShopBundle/Service/DataProvider/UserProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@
*/
class UserProvider
{
public const ANONYMOUS_USER = 'ANONYMOUS_USER';

public function __construct(
private readonly Security $security,
) {
Expand All @@ -56,16 +54,6 @@ public function getUser(): ?UserInterface
return null;
}

public function getUsername(): string
{
$user = $this->getUser();
if ($user instanceof UserInterface) {
return $user->getUserIdentifier();
}

return self::ANONYMOUS_USER;
}

public function logout(): void
{
$this->security->logout(false);
Expand Down

0 comments on commit 74f1ff1

Please sign in to comment.