mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-30 03:23:48 +00:00
Fix phpstan issues
This commit is contained in:
@@ -31,31 +31,21 @@ namespace Chill\PersonBundle\Privacy;
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use Chill\MainBundle\Entity\User;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||
|
||||
class PrivacyEventSubscriber implements EventSubscriberInterface
|
||||
final readonly class PrivacyEventSubscriber implements EventSubscriberInterface
|
||||
{
|
||||
/**
|
||||
* @var LoggerInterface
|
||||
*/
|
||||
protected $logger;
|
||||
|
||||
/**
|
||||
* @var TokenStorageInterface
|
||||
*/
|
||||
protected $token;
|
||||
|
||||
/**
|
||||
* PrivacyEventSubscriber constructor.
|
||||
*/
|
||||
public function __construct(LoggerInterface $logger, TokenStorageInterface $token)
|
||||
{
|
||||
$this->logger = $logger;
|
||||
$this->token = $token;
|
||||
}
|
||||
public function __construct(
|
||||
private LoggerInterface $logger,
|
||||
private TokenStorageInterface $token
|
||||
) {}
|
||||
|
||||
public static function getSubscribedEvents()
|
||||
{
|
||||
@@ -109,11 +99,20 @@ class PrivacyEventSubscriber implements EventSubscriberInterface
|
||||
);
|
||||
}
|
||||
|
||||
protected function getInvolved(): array
|
||||
private function getInvolved(): array
|
||||
{
|
||||
$user = $this->token->getToken()->getUser();
|
||||
|
||||
if ($user instanceof User) {
|
||||
return [
|
||||
'by_user' => $user->getUserIdentifier(),
|
||||
'by_user_id' => $user->getId(),
|
||||
];
|
||||
}
|
||||
|
||||
return [
|
||||
'by_user' => $this->token->getToken()->getUser()->getUsername(),
|
||||
'by_user_id' => $this->token->getToken()->getUser()->getId(),
|
||||
'by_user' => $user->getUsername(),
|
||||
'by_user_id' => $user->getUserIdentifier(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user