From f68deca99298e07f0d116ed3337651667621d2ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 12 Sep 2023 14:42:11 +0200 Subject: [PATCH] Fix icu message --- src/Bundle/ChillMainBundle/Entity/User.php | 10 +++--- .../ChillTaskBundle/Menu/UserMenuBuilder.php | 36 ++++--------------- 2 files changed, 10 insertions(+), 36 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Entity/User.php b/src/Bundle/ChillMainBundle/Entity/User.php index 23dfe6926..07724b1c3 100644 --- a/src/Bundle/ChillMainBundle/Entity/User.php +++ b/src/Bundle/ChillMainBundle/Entity/User.php @@ -18,7 +18,8 @@ use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\Criteria; use Doctrine\Common\Collections\Selectable; use Doctrine\ORM\Mapping as ORM; -use libphonenumber\PhoneNumber; +use RuntimeException; +use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface; use Symfony\Component\Security\Core\User\UserInterface; use Symfony\Component\Serializer\Annotation as Serializer; use Symfony\Component\Validator\Context\ExecutionContextInterface; @@ -37,7 +38,7 @@ use Chill\MainBundle\Validation\Constraint\PhonenumberConstraint; * "user": User::class * }) */ -class User implements UserInterface, \Stringable +class User implements UserInterface, \Stringable, PasswordAuthenticatedUserInterface { /** * @ORM\Id @@ -306,10 +307,7 @@ class User implements UserInterface, \Stringable return new ArrayCollection($sortedScopeHistories); } - /** - * @return string - */ - public function getPassword() + public function getPassword(): ?string { return $this->password; } diff --git a/src/Bundle/ChillTaskBundle/Menu/UserMenuBuilder.php b/src/Bundle/ChillTaskBundle/Menu/UserMenuBuilder.php index a8c299680..e744ddb24 100644 --- a/src/Bundle/ChillTaskBundle/Menu/UserMenuBuilder.php +++ b/src/Bundle/ChillTaskBundle/Menu/UserMenuBuilder.php @@ -19,38 +19,14 @@ use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInt use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface; use Symfony\Contracts\Translation\TranslatorInterface; -class UserMenuBuilder implements LocalMenuBuilderInterface +final readonly class UserMenuBuilder implements LocalMenuBuilderInterface { - /** - * @var AuthorizationCheckerInterface - */ - public $authorizationChecker; - - /** - * @var CountNotificationTask - */ - public $counter; - - /** - * @var TokenStorageInterface - */ - public $tokenStorage; - - /** - * @var TranslatorInterface - */ - public $translator; - public function __construct( - CountNotificationTask $counter, - TokenStorageInterface $tokenStorage, - TranslatorInterface $translator, - AuthorizationCheckerInterface $authorizationChecker + private CountNotificationTask $counter, + private TokenStorageInterface $tokenStorage, + private TranslatorInterface $translator, + private AuthorizationCheckerInterface $authorizationChecker ) { - $this->counter = $counter; - $this->tokenStorage = $tokenStorage; - $this->translator = $translator; - $this->authorizationChecker = $authorizationChecker; } public function buildMenu($menuId, MenuItem $menu, array $parameters) @@ -99,7 +75,7 @@ class UserMenuBuilder implements LocalMenuBuilderInterface return ['user']; } - protected function addItemInMenu(MenuItem $menu, $message, $number, $order, array $states = [], array $status = []) + private function addItemInMenu(MenuItem $menu, string $message, int $number, $order, array $states = [], array $status = []) { if (0 < $number) { $menu->addChild(