Skip to content

Commit

Permalink
Update composer (#93)
Browse files Browse the repository at this point in the history
  • Loading branch information
babeuloula authored Oct 3, 2023
1 parent 1f911a7 commit 3491b80
Show file tree
Hide file tree
Showing 13 changed files with 944 additions and 962 deletions.
8 changes: 2 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@
"composer/package-versions-deprecated": true,
"symfony/flex": true,
"symfony/runtime": true,
"dealerdirect/phpcodesniffer-composer-installer": true
"dealerdirect/phpcodesniffer-composer-installer": true,
"php-http/discovery": true
},
"optimize-autoloader": true,
"preferred-install": {
Expand All @@ -60,11 +61,6 @@
"App\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"App\\Tests\\": "tests/"
}
},
"replace": {
"symfony/polyfill-ctype": "*",
"symfony/polyfill-iconv": "*",
Expand Down
1,825 changes: 898 additions & 927 deletions composer.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/Controller/HomeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

final class HomeController
{
public function __construct(readonly private Environment $twig)
public function __construct(private readonly Environment $twig)
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/Controller/Notification/MarkAsReadController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
final class MarkAsReadController
{
public function __construct(
readonly private NotificationService $notificationService,
private readonly NotificationService $notificationService,
) {
}

Expand Down
4 changes: 2 additions & 2 deletions src/Controller/Notification/ReloadController.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
final class ReloadController
{
public function __construct(
readonly private NotificationService $notificationService,
readonly private Environment $twig
private readonly NotificationService $notificationService,
private readonly Environment $twig
) {
}

Expand Down
2 changes: 1 addition & 1 deletion src/Controller/OAuthController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

final class OAuthController extends AbstractController
{
public function __construct(readonly private ClientRegistry $clientRegistry)
public function __construct(private readonly ClientRegistry $clientRegistry)
{
}

Expand Down
8 changes: 4 additions & 4 deletions src/Controller/PullRequest/ListController.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
final class ListController
{
public function __construct(
readonly private PullRequestLabelService $pullRequestLabelService,
readonly private PullRequestFilterService $pullRequestFilterService,
readonly private NotificationService $notificationService,
readonly private Environment $twig,
private readonly PullRequestLabelService $pullRequestLabelService,
private readonly PullRequestFilterService $pullRequestFilterService,
private readonly NotificationService $notificationService,
private readonly Environment $twig,
) {
}

Expand Down
4 changes: 2 additions & 2 deletions src/Controller/PullRequest/ReloadController.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
final class ReloadController
{
public function __construct(
readonly private PullRequestFilterService $pullRequestFilterService,
readonly private Environment $twig
private readonly PullRequestFilterService $pullRequestFilterService,
private readonly Environment $twig
) {
}

Expand Down
11 changes: 7 additions & 4 deletions src/Controller/User/ConfigurationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Security\Core\User\UserInterface;
Expand All @@ -20,9 +21,9 @@
final class ConfigurationController
{
public function __construct(
readonly private Environment $twig,
readonly private UserRepository $repository,
readonly private UrlGeneratorInterface $router
private readonly Environment $twig,
private readonly UserRepository $repository,
private readonly UrlGeneratorInterface $router
) {
}

Expand All @@ -38,7 +39,9 @@ public function __invoke(UserInterface $user, Request $request): Response
true,
);

$request->getSession()->getFlashBag()->add('success', 'Configuration saved with success.');
/** @var Session $session */
$session = $request->getSession();
$session->getFlashBag()->add('success', 'Configuration saved with success.');

return new RedirectResponse(
$this->router->generate('user_configuration')
Expand Down
7 changes: 5 additions & 2 deletions src/Controller/User/DeleteController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use App\Repository\UserRepository;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
Expand All @@ -27,9 +28,11 @@ public function __construct(
public function __invoke(Request $request, UserInterface $user): RedirectResponse
{
$this->userRepository->remove($user, true);
$this->tokenStorage->setToken(null);
$this->tokenStorage->setToken();

$request->getSession()->getFlashBag()->add('success', 'Your account was deleted with success.');
/** @var Session $session */
$session = $request->getSession();
$session->getFlashBag()->add('success', 'Your account was deleted with success.');

return new RedirectResponse(
$this->router->generate('home')
Expand Down
11 changes: 8 additions & 3 deletions src/Event/EventSubscriber/ExceptionSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\HttpKernel\Event\ExceptionEvent;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;

final class ExceptionSubscriber implements EventSubscriberInterface
{
public function __construct(readonly protected UrlGeneratorInterface $router)
public function __construct(protected readonly UrlGeneratorInterface $router)
{
}

Expand Down Expand Up @@ -51,7 +52,9 @@ public function githubException(ExceptionEvent $event): void
Response::HTTP_FORBIDDEN
);
} else {
$event->getRequest()->getSession()->getFlashBag()->add(
/** @var Session $session */
$session = $event->getRequest()->getSession();
$session->getFlashBag()->add(
'error',
$event->getThrowable()->getMessage()
);
Expand All @@ -70,7 +73,9 @@ public function xhrException(ExceptionEvent $event): void
return;
}

$event->getRequest()->getSession()->getFlashBag()->add('error', $event->getThrowable()->getMessage());
/** @var Session $session */
$session = $event->getRequest()->getSession();
$session->getFlashBag()->add('error', $event->getThrowable()->getMessage());
$event->setResponse(
new RedirectResponse(
$this->router->generate('home')
Expand Down
4 changes: 1 addition & 3 deletions src/Model/Doctrine/Type/AbstractEnumType.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ abstract public static function getEnumClass(): string;
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter
public function getSQLDeclaration(array $column, AbstractPlatform $platform): string
{
if (false === \array_key_exists('type', $column)
|| false === $column['type'] instanceof AbstractEnumType
) {
if (false === \array_key_exists('type', $column)) {
throw new \InvalidArgumentException('Wrong enum column type.');
}

Expand Down
18 changes: 12 additions & 6 deletions src/Security/Authenticator/GithubAuthenticator.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\Routing\RouterInterface;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
Expand All @@ -24,10 +25,10 @@
final class GithubAuthenticator extends OAuth2Authenticator implements AuthenticationEntryPointInterface
{
public function __construct(
readonly private ClientRegistry $clientRegistry,
readonly private RouterInterface $router,
readonly private UserRepository $userRepository,
readonly private LoggerInterface $logger,
private readonly ClientRegistry $clientRegistry,
private readonly RouterInterface $router,
private readonly UserRepository $userRepository,
private readonly LoggerInterface $logger,
) {
}

Expand Down Expand Up @@ -83,7 +84,9 @@ function () use ($accessToken, $client): User {
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter
public function onAuthenticationSuccess(Request $request, TokenInterface $token, string $firewallName): ?Response
{
$request->getSession()->getFlashBag()->add('success', 'Github OAuth connection success.');
/** @var Session $session */
$session = $request->getSession();
$session->getFlashBag()->add('success', 'Github OAuth connection success.');

return new RedirectResponse($this->router->generate('home'));
}
Expand All @@ -93,7 +96,10 @@ public function onAuthenticationFailure(Request $request, AuthenticationExceptio
{
$error = strtr($exception->getMessageKey(), $exception->getMessageData());

$request->getSession()->getFlashBag()->add('error', $error);
/** @var Session $session */
$session = $request->getSession();
$session->getFlashBag()->add('error', $error);

$this->logger->error(
'Github OAuth connection failed',
[
Expand Down

0 comments on commit 3491b80

Please sign in to comment.