Skip to content

Commit

Permalink
Merge pull request #23 from duboiss/feature/php
Browse files Browse the repository at this point in the history
  • Loading branch information
duboiss committed Dec 10, 2023
2 parents 96a9be7 + ec5b35b commit 06b8f63
Show file tree
Hide file tree
Showing 32 changed files with 634 additions and 665 deletions.
2 changes: 1 addition & 1 deletion .symfony.insight.yaml
@@ -1,4 +1,4 @@
php_version: 8.1
php_version: 8.2

rules:
composer.invalid_file:
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Expand Up @@ -2,7 +2,7 @@
"type": "project",
"license": "proprietary",
"require": {
"php": "^8.1",
"php": "^8.2",
"ext-ctype": "*",
"ext-iconv": "*",
"doctrine/doctrine-bundle": "^2.1",
Expand Down Expand Up @@ -59,7 +59,7 @@
},
"config": {
"platform": {
"php": "8.1"
"php": "8.2"
},
"preferred-install": {
"*": "dist"
Expand Down
1,195 changes: 601 additions & 594 deletions composer.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docker/php/Dockerfile
@@ -1,4 +1,4 @@
ARG PHP_VERSION=8.1
ARG PHP_VERSION=8.2

FROM php:${PHP_VERSION}-fpm AS symforum_php

Expand Down
2 changes: 1 addition & 1 deletion rector.php
Expand Up @@ -16,5 +16,5 @@
$rectorConfig->rule(InlineConstructorDefaultToPropertyRector::class);

// define sets of rules
$rectorConfig->sets([LevelSetList::UP_TO_PHP_81]);
$rectorConfig->sets([LevelSetList::UP_TO_PHP_82]);
};
2 changes: 1 addition & 1 deletion src/Controller/Admin/CategoryAdminController.php
Expand Up @@ -21,7 +21,7 @@
#[Route(path: '/admin/categories', name: 'admin.category.')]
class CategoryAdminController extends AbstractBaseController
{
public function __construct(private readonly RequestStack $requestStack, private DecoderInterface $decoder, private readonly TranslatorInterface $translator)
public function __construct(private readonly RequestStack $requestStack, private readonly DecoderInterface $decoder, private readonly TranslatorInterface $translator)
{
parent::__construct($requestStack, $this->decoder);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/Admin/ReportAdminController.php
Expand Up @@ -19,7 +19,7 @@
#[Route(path: '/admin/reports', name: 'admin.report.')]
class ReportAdminController extends AbstractBaseController
{
public function __construct(private readonly RequestStack $requestStack, private DecoderInterface $decoder, private readonly TranslatorInterface $translator)
public function __construct(private readonly RequestStack $requestStack, private readonly DecoderInterface $decoder, private readonly TranslatorInterface $translator)
{
parent::__construct($requestStack, $this->decoder);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/Admin/UserAdminController.php
Expand Up @@ -20,7 +20,7 @@
#[Route(path: '/admin/users', name: 'admin.user.')]
class UserAdminController extends AbstractBaseController
{
public function __construct(private readonly RequestStack $requestStack, private DecoderInterface $decoder, private readonly TranslatorInterface $translator)
public function __construct(private readonly RequestStack $requestStack, private readonly DecoderInterface $decoder, private readonly TranslatorInterface $translator)
{
parent::__construct($requestStack, $this->decoder);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/ForumController.php
Expand Up @@ -25,7 +25,7 @@
#[Route(path: '/forums')]
class ForumController extends AbstractBaseController
{
public function __construct(private readonly RequestStack $requestStack, private DecoderInterface $decoder, private readonly TranslatorInterface $translator)
public function __construct(private readonly RequestStack $requestStack, private readonly DecoderInterface $decoder, private readonly TranslatorInterface $translator)
{
parent::__construct($requestStack, $this->decoder);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/MessageController.php
Expand Up @@ -23,7 +23,7 @@
#[Route(path: '/forums/messages', name: 'message.')]
class MessageController extends AbstractBaseController
{
public function __construct(private readonly RequestStack $requestStack, private DecoderInterface $decoder, private readonly TranslatorInterface $translator)
public function __construct(private readonly RequestStack $requestStack, private readonly DecoderInterface $decoder, private readonly TranslatorInterface $translator)
{
parent::__construct($requestStack, $this->decoder);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Controller/ReportController.php
Expand Up @@ -19,7 +19,7 @@
#[Route(path: '/forums/reports', name: 'report.')]
class ReportController extends AbstractBaseController
{
public function __construct(private readonly RequestStack $requestStack, private DecoderInterface $decoder, private readonly TranslatorInterface $translator)
public function __construct(private readonly RequestStack $requestStack, private readonly DecoderInterface $decoder, private readonly TranslatorInterface $translator)
{
parent::__construct($requestStack, $this->decoder);
}
Expand All @@ -28,7 +28,7 @@ public function __construct(private readonly RequestStack $requestStack, private
#[Route(path: '/{uuid}', name: 'message', methods: ['POST'])]
public function message(Message $message, Request $request, ReportService $reportService, ReportRepository $reportRepository): Response
{
$reason = trim($this->jsonDecodeRequestContent($request)['reason']);
$reason = trim((string) $this->jsonDecodeRequestContent($request)['reason']);

if ($reportRepository->findOneBy(['message' => $message, 'reportedBy' => $this->getUser()])) {
return $this->json([
Expand Down
4 changes: 1 addition & 3 deletions src/Controller/SecurityController.php
Expand Up @@ -26,7 +26,5 @@ public function login(AuthenticationUtils $authenticationUtils, Request $request
}

#[Route(path: '/logout', name: 'security.logout', methods: ['GET'])]
public function logout(): void
{
}
public function logout(): void {}
}
4 changes: 1 addition & 3 deletions src/DataFixtures/UserFixtures.php
Expand Up @@ -11,9 +11,7 @@

class UserFixtures extends BaseFixtures
{
public function __construct(private readonly UserPasswordHasherInterface $hasher)
{
}
public function __construct(private readonly UserPasswordHasherInterface $hasher) {}

protected function loadData(ObjectManager $manager): void
{
Expand Down
4 changes: 1 addition & 3 deletions src/Entity/User.php
Expand Up @@ -170,9 +170,7 @@ public function getPassword(): ?string
return $this->hash;
}

public function eraseCredentials(): void
{
}
public function eraseCredentials(): void {}

public function getUserIdentifier(): string
{
Expand Down
2 changes: 1 addition & 1 deletion src/EventListener/LogoutListener.php
Expand Up @@ -15,7 +15,7 @@ class LogoutListener
{
private readonly FlashBagInterface $flashBag;

public function __construct(RequestStack $requestStack, private TranslatorInterface $translator)
public function __construct(RequestStack $requestStack, private readonly TranslatorInterface $translator)
{
$this->flashBag = $requestStack->getSession()->getFlashBag();
}
Expand Down
4 changes: 1 addition & 3 deletions src/EventSubscriber/UserActivitySubscriber.php
Expand Up @@ -15,9 +15,7 @@

class UserActivitySubscriber implements EventSubscriberInterface
{
public function __construct(private readonly EntityManagerInterface $em, private readonly Security $security, private readonly OptionService $optionService, private readonly UserRepository $userRepository)
{
}
public function __construct(private readonly EntityManagerInterface $em, private readonly Security $security, private readonly OptionService $optionService, private readonly UserRepository $userRepository) {}

public function onTerminate(): void
{
Expand Down
4 changes: 1 addition & 3 deletions src/Form/ThreadType.php
Expand Up @@ -16,9 +16,7 @@

class ThreadType extends AbstractType
{
public function __construct(private TranslatorInterface $translator)
{
}
public function __construct(private readonly TranslatorInterface $translator) {}

public function buildForm(FormBuilderInterface $builder, array $options): void
{
Expand Down
4 changes: 1 addition & 3 deletions src/Form/UserSettingsType.php
Expand Up @@ -14,9 +14,7 @@

class UserSettingsType extends AbstractType
{
public function __construct(private readonly TranslatorInterface $translator)
{
}
public function __construct(private readonly TranslatorInterface $translator) {}

public function buildForm(FormBuilderInterface $builder, array $options): void
{
Expand Down
4 changes: 1 addition & 3 deletions src/Security/LoginFormAuthenticator.php
Expand Up @@ -25,9 +25,7 @@ class LoginFormAuthenticator extends AbstractLoginFormAuthenticator
final public const REDIRECT_AFTER_LOGIN_ROUTE = 'forum.index';
private const FORUMS_PARENT_PATH = '/forums';

public function __construct(private readonly RouterInterface $router, private readonly CsrfTokenManagerInterface $csrfTokenManager)
{
}
public function __construct(private readonly RouterInterface $router, private readonly CsrfTokenManagerInterface $csrfTokenManager) {}

protected function getLoginUrl(Request $request): string
{
Expand Down
4 changes: 1 addition & 3 deletions src/Security/Voter/ForumVoter.php
Expand Up @@ -15,9 +15,7 @@ class ForumVoter extends Voter
{
private const LOCK = 'LOCK';

public function __construct(private readonly Security $security)
{
}
public function __construct(private readonly Security $security) {}

protected function supports(string $attribute, mixed $subject): bool
{
Expand Down
4 changes: 1 addition & 3 deletions src/Security/Voter/MessageVoter.php
Expand Up @@ -18,9 +18,7 @@ class MessageVoter extends Voter
private const LIKE = 'LIKE';
private const REPORT = 'REPORT';

public function __construct(private readonly Security $security)
{
}
public function __construct(private readonly Security $security) {}

protected function supports(string $attribute, mixed $subject): bool
{
Expand Down
4 changes: 1 addition & 3 deletions src/Security/Voter/ThreadVoter.php
Expand Up @@ -17,9 +17,7 @@ class ThreadVoter extends Voter
private const PIN = 'PIN';
private const DELETE = 'DELETE';

public function __construct(private readonly Security $security)
{
}
public function __construct(private readonly Security $security) {}

protected function supports(string $attribute, mixed $subject): bool
{
Expand Down
4 changes: 1 addition & 3 deletions src/Service/AntispamService.php
Expand Up @@ -17,9 +17,7 @@ class AntispamService

private const DELAY_THREAD = 90;

public function __construct(private readonly ThreadRepository $threadRepository, private readonly MessageRepository $messageRepository, private readonly Security $security)
{
}
public function __construct(private readonly ThreadRepository $threadRepository, private readonly MessageRepository $messageRepository, private readonly Security $security) {}

/**
* @throws Exception
Expand Down
4 changes: 1 addition & 3 deletions src/Service/ForumService.php
Expand Up @@ -9,9 +9,7 @@

class ForumService
{
public function __construct(private readonly EntityManagerInterface $em)
{
}
public function __construct(private readonly EntityManagerInterface $em) {}

public function lock(Forum $forum): void
{
Expand Down
4 changes: 1 addition & 3 deletions src/Service/MessageLikeService.php
Expand Up @@ -13,9 +13,7 @@

class MessageLikeService
{
public function __construct(private readonly Security $security, private readonly EntityManagerInterface $em, private readonly MessageLikeRepository $likeRepository)
{
}
public function __construct(private readonly Security $security, private readonly EntityManagerInterface $em, private readonly MessageLikeRepository $likeRepository) {}

public function likeMessage(Message $message): void
{
Expand Down
4 changes: 1 addition & 3 deletions src/Service/OptionService.php
Expand Up @@ -13,9 +13,7 @@ class OptionService
/** @var CoreOption[] */
private array $cache = [];

public function __construct(private readonly EntityManagerInterface $em, private readonly CoreOptionRepository $coreOptionRepository)
{
}
public function __construct(private readonly EntityManagerInterface $em, private readonly CoreOptionRepository $coreOptionRepository) {}

public function get(string $optionName, string $default = null): ?string
{
Expand Down
4 changes: 1 addition & 3 deletions src/Service/ReportService.php
Expand Up @@ -12,9 +12,7 @@

class ReportService
{
public function __construct(private readonly EntityManagerInterface $em)
{
}
public function __construct(private readonly EntityManagerInterface $em) {}

public function createReport(Message $message, string $reason): void
{
Expand Down
2 changes: 1 addition & 1 deletion src/Service/ThreadService.php
Expand Up @@ -19,7 +19,7 @@ class ThreadService
{
private readonly FlashBagInterface $flashBag;

public function __construct(private readonly EntityManagerInterface $em, private readonly MessageRepository $messageRepository, RequestStack $requestStack, private readonly AntispamService $antispamService, private readonly OptionService $optionService, private TranslatorInterface $translator)
public function __construct(private readonly EntityManagerInterface $em, private readonly MessageRepository $messageRepository, RequestStack $requestStack, private readonly AntispamService $antispamService, private readonly OptionService $optionService, private readonly TranslatorInterface $translator)
{
$this->flashBag = $requestStack->getSession()->getFlashBag();
}
Expand Down
4 changes: 1 addition & 3 deletions src/Service/UserService.php
Expand Up @@ -9,9 +9,7 @@

class UserService
{
public function __construct(private readonly EntityManagerInterface $em, private readonly ThreadService $threadService, private readonly MessageService $messageService, private readonly ReportService $reportService)
{
}
public function __construct(private readonly EntityManagerInterface $em, private readonly ThreadService $threadService, private readonly MessageService $messageService, private readonly ReportService $reportService) {}

public function deleteUser(User $user, bool $deleteContent = false): void
{
Expand Down
4 changes: 1 addition & 3 deletions src/Twig/AppExtension.php
Expand Up @@ -11,9 +11,7 @@

class AppExtension extends AbstractExtension
{
public function __construct(private readonly UrlGeneratorInterface $urlGenerator, private readonly RequestStack $request)
{
}
public function __construct(private readonly UrlGeneratorInterface $urlGenerator, private readonly RequestStack $request) {}

/**
* @return array|TwigFunction[]
Expand Down
4 changes: 1 addition & 3 deletions src/Twig/BreadcrumbExtension.php
Expand Up @@ -16,9 +16,7 @@ class BreadcrumbExtension extends AbstractExtension
{
private array $breadcrumbsPaths = [];

public function __construct(private readonly UrlGeneratorInterface $urlGenerator)
{
}
public function __construct(private readonly UrlGeneratorInterface $urlGenerator) {}

/**
* @return array|TwigFilter[]
Expand Down
4 changes: 1 addition & 3 deletions src/Twig/UserExtenion.php
Expand Up @@ -16,9 +16,7 @@ class UserExtenion extends AbstractExtension
'ROLE_MODERATOR' => 'Modérateur',
];

public function __construct(private readonly UrlGeneratorInterface $urlGenerator)
{
}
public function __construct(private readonly UrlGeneratorInterface $urlGenerator) {}

/**
* @return array|TwigFunction[]
Expand Down

0 comments on commit 06b8f63

Please sign in to comment.