Skip to content

Commit

Permalink
Update to php 8.2
Browse files Browse the repository at this point in the history
  • Loading branch information
duboiss committed Dec 10, 2023
1 parent 96a9be7 commit ec5b35b
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 ec5b35b

Please sign in to comment.