Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop php 7.3 and add missing typehints #1463

Merged
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -27,7 +27,6 @@ jobs:
strategy:
matrix:
php-version:
- '7.3'
- '7.4'
- '8.0'
- '8.1'
@@ -36,7 +35,7 @@ jobs:
symfony-require: ['']
variant: [normal]
include:
- php-version: '7.3'
- php-version: '7.4'
dependencies: lowest
allowed-to-fail: false
variant: normal
13 changes: 7 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
@@ -20,14 +20,15 @@
],
"homepage": "https://docs.sonata-project.org/projects/SonataUserBundle",
"require": {
"php": "^7.3 || ^8.0",
"php": "^7.4 || ^8.0",
"doctrine/collections": "^1.6",
"doctrine/common": "^3.1",
"doctrine/persistence": "^2.1",
"sonata-project/admin-bundle": "^4.0",
"sonata-project/doctrine-extensions": "^1.10.1",
"sonata-project/doctrine-extensions": "^1.13",
"sonata-project/form-extensions": "^1.4",
"sonata-project/twig-extensions": "^1.3.1",
"symfony/config": "^4.4 || ^5.3 || ^6.0",
"sonata-project/twig-extensions": "^1.3",
"symfony/config": "^4.4.11 || ^5.3 || ^6.0",
"symfony/dependency-injection": "^4.4 || ^5.3 || ^6.0",
"symfony/event-dispatcher": "^4.4 || ^5.3 || ^6.0",
"symfony/form": "^4.4.20 || ^5.3 || ^6.0",
@@ -44,11 +45,11 @@
"symfony/translation": "^4.4 || ^5.3 || ^6.0",
"symfony/translation-contracts": "^1.1 || ^2.5",
"symfony/validator": "^4.4 || ^5.3 || ^6.0",
"twig/twig": "^2.9 || ^3.0"
"twig/twig": "^2.14 || ^3.0"
},
"require-dev": {
"dama/doctrine-test-bundle": "^6.7",
"doctrine/annotations": "^1.10",
"doctrine/annotations": "^1.13.2",
"doctrine/doctrine-bundle": "^2.3.2",
"doctrine/mongodb-odm": "^2.2",
"doctrine/orm": "^2.9",
25 changes: 5 additions & 20 deletions src/Action/CheckEmailAction.php
Original file line number Diff line number Diff line change
@@ -23,30 +23,15 @@

final class CheckEmailAction
{
/**
* @var Environment
*/
private $twig;
private Environment $twig;

/**
* @var UrlGeneratorInterface
*/
private $urlGenerator;
private UrlGeneratorInterface $urlGenerator;

/**
* @var Pool
*/
private $adminPool;
private Pool $adminPool;

/**
* @var TemplateRegistryInterface
*/
private $templateRegistry;
private TemplateRegistryInterface $templateRegistry;

/**
* @var int
*/
private $tokenTtl;
private int $tokenTtl;

public function __construct(
Environment $twig,
54 changes: 15 additions & 39 deletions src/Action/LoginAction.php
Original file line number Diff line number Diff line change
@@ -29,45 +29,21 @@

final class LoginAction
{
/**
* @var Environment
*/
private $twig;

/**
* @var UrlGeneratorInterface
*/
private $urlGenerator;

/**
* @var AuthenticationUtils
*/
private $authenticationUtils;

/**
* @var Pool
*/
private $adminPool;

/**
* @var TemplateRegistryInterface
*/
private $templateRegistry;

/**
* @var TokenStorageInterface
*/
private $tokenStorage;

/**
* @var TranslatorInterface
*/
private $translator;

/**
* @var CsrfTokenManagerInterface|null
*/
private $csrfTokenManager;
private Environment $twig;

private UrlGeneratorInterface $urlGenerator;

private AuthenticationUtils $authenticationUtils;

private Pool $adminPool;

private TemplateRegistryInterface $templateRegistry;

private TokenStorageInterface $tokenStorage;

private TranslatorInterface $translator;

private ?CsrfTokenManagerInterface $csrfTokenManager;

public function __construct(
Environment $twig,
25 changes: 5 additions & 20 deletions src/Action/RequestAction.php
Original file line number Diff line number Diff line change
@@ -23,30 +23,15 @@

final class RequestAction
{
/**
* @var Environment
*/
private $twig;
private Environment $twig;

/**
* @var UrlGeneratorInterface
*/
private $urlGenerator;
private UrlGeneratorInterface $urlGenerator;

/**
* @var AuthorizationCheckerInterface
*/
private $authorizationChecker;
private AuthorizationCheckerInterface $authorizationChecker;

/**
* @var Pool
*/
private $adminPool;
private Pool $adminPool;

/**
* @var TemplateRegistryInterface
*/
private $templateRegistry;
private TemplateRegistryInterface $templateRegistry;

public function __construct(
Environment $twig,
66 changes: 18 additions & 48 deletions src/Action/ResetAction.php
Original file line number Diff line number Diff line change
@@ -30,50 +30,23 @@

final class ResetAction
{
/**
* @var Environment
*/
private $twig;

/**
* @var UrlGeneratorInterface
*/
private $urlGenerator;

/**
* @var AuthorizationCheckerInterface
*/
private $authorizationChecker;

/**
* @var Pool
*/
private $adminPool;

/**
* @var TemplateRegistryInterface
*/
private $templateRegistry;

/**
* @var FormFactoryInterface
*/
private $formFactory;

/**
* @var UserManagerInterface
*/
private $userManager;

/**
* @var TranslatorInterface
*/
private $translator;

/**
* @var int
*/
private $tokenTtl;
private Environment $twig;

private UrlGeneratorInterface $urlGenerator;

private AuthorizationCheckerInterface $authorizationChecker;

private Pool $adminPool;

private TemplateRegistryInterface $templateRegistry;

private FormFactoryInterface $formFactory;

private UserManagerInterface $userManager;

private TranslatorInterface $translator;

private int $tokenTtl;

public function __construct(
Environment $twig,
@@ -97,10 +70,7 @@ public function __construct(
$this->tokenTtl = $tokenTtl;
}

/**
* @param string $token
*/
public function __invoke(Request $request, $token): Response
public function __invoke(Request $request, string $token): Response
{
if ($this->authorizationChecker->isGranted('IS_AUTHENTICATED_FULLY')) {
return new RedirectResponse($this->urlGenerator->generate('sonata_admin_dashboard'));
25 changes: 5 additions & 20 deletions src/Action/SendEmailAction.php
Original file line number Diff line number Diff line change
@@ -23,30 +23,15 @@

final class SendEmailAction
{
/**
* @var UrlGeneratorInterface
*/
private $urlGenerator;
private UrlGeneratorInterface $urlGenerator;

/**
* @var UserManagerInterface
*/
private $userManager;
private UserManagerInterface $userManager;

/**
* @var MailerInterface
*/
private $mailer;
private MailerInterface $mailer;

/**
* @var TokenGeneratorInterface
*/
private $tokenGenerator;
private TokenGeneratorInterface $tokenGenerator;

/**
* @var int
*/
private $retryTtl;
private int $retryTtl;

public function __construct(
UrlGeneratorInterface $urlGenerator,
Original file line number Diff line number Diff line change
@@ -18,8 +18,6 @@
use Symfony\Component\DependencyInjection\Reference;

/**
* GlobalVariablesCompilerPass.
*
* @author Thomas Rabaix <thomas.rabaix@sonata-project.org>
*/
class GlobalVariablesCompilerPass implements CompilerPassInterface
10 changes: 5 additions & 5 deletions src/DependencyInjection/SonataUserExtension.php
Original file line number Diff line number Diff line change
@@ -100,7 +100,7 @@ public function load(array $configs, ContainerBuilder $container): void
*
* @return array<string, mixed>
*/
public function fixImpersonating(array $config)
public function fixImpersonating(array $config): array
{
if (isset($config['impersonating'], $config['impersonating_route'])) {
throw new \RuntimeException('you can\'t have `impersonating` and `impersonating_route` keys defined at the same time');
@@ -127,7 +127,7 @@ public function fixImpersonating(array $config)
/**
* @param array<string, mixed> $config
*/
public function configureClass($config, ContainerBuilder $container): void
public function configureClass(array $config, ContainerBuilder $container): void
{
$container->setParameter('sonata.user.user.class', $config['class']['user']);
$container->setParameter('sonata.user.group.class', $config['class']['group']);
@@ -136,7 +136,7 @@ public function configureClass($config, ContainerBuilder $container): void
/**
* @param array<string, mixed> $config
*/
public function configureAdminClass($config, ContainerBuilder $container): void
public function configureAdminClass(array $config, ContainerBuilder $container): void
{
$container->setParameter('sonata.user.admin.user.class', $config['admin']['user']['class']);
$container->setParameter('sonata.user.admin.group.class', $config['admin']['group']['class']);
@@ -145,7 +145,7 @@ public function configureAdminClass($config, ContainerBuilder $container): void
/**
* @param array<string, mixed> $config
*/
public function configureTranslationDomain($config, ContainerBuilder $container): void
public function configureTranslationDomain(array $config, ContainerBuilder $container): void
{
$container->setParameter('sonata.user.admin.user.translation_domain', $config['admin']['user']['translation']);
$container->setParameter('sonata.user.admin.group.translation_domain', $config['admin']['group']['translation']);
@@ -154,7 +154,7 @@ public function configureTranslationDomain($config, ContainerBuilder $container)
/**
* @param array<string, mixed> $config
*/
public function configureController($config, ContainerBuilder $container): void
public function configureController(array $config, ContainerBuilder $container): void
{
$container->setParameter('sonata.user.admin.user.controller', $config['admin']['user']['controller']);
$container->setParameter('sonata.user.admin.group.controller', $config['admin']['group']['controller']);
3 changes: 1 addition & 2 deletions src/Document/BaseUser.php
Original file line number Diff line number Diff line change
@@ -14,9 +14,8 @@
namespace Sonata\UserBundle\Document;

use Sonata\UserBundle\Model\User as AbstractedUser;
use Sonata\UserBundle\Model\UserInterface;

class BaseUser extends AbstractedUser implements UserInterface
class BaseUser extends AbstractedUser
{
public function prePersist(): void
{
5 changes: 1 addition & 4 deletions src/Document/UserManager.php
Original file line number Diff line number Diff line change
@@ -26,10 +26,7 @@
*/
class UserManager extends BaseDocumentManager implements UserManagerInterface
{
/**
* @var CanonicalFieldsUpdaterInterface
*/
private $canonicalFieldsUpdater;
private CanonicalFieldsUpdaterInterface $canonicalFieldsUpdater;

public function __construct(
string $class,
5 changes: 1 addition & 4 deletions src/Entity/UserManager.php
Original file line number Diff line number Diff line change
@@ -26,10 +26,7 @@
*/
class UserManager extends BaseEntityManager implements UserManagerInterface
{
/**
* @var CanonicalFieldsUpdaterInterface
*/
private $canonicalFieldsUpdater;
private CanonicalFieldsUpdaterInterface $canonicalFieldsUpdater;

public function __construct(
string $class,
Loading