mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-26 17:43:54 +00:00
apply rector rules: php up to php82
This commit is contained in:
@@ -34,7 +34,7 @@ use function get_class;
|
||||
*/
|
||||
class AuthorizationHelper implements AuthorizationHelperInterface
|
||||
{
|
||||
public function __construct(private CenterResolverManagerInterface $centerResolverManager, private LoggerInterface $logger, private ScopeResolverDispatcher $scopeResolverDispatcher, private UserACLAwareRepositoryInterface $userACLAwareRepository, private ParentRoleHelper $parentRoleHelper)
|
||||
public function __construct(private readonly CenterResolverManagerInterface $centerResolverManager, private readonly LoggerInterface $logger, private readonly ScopeResolverDispatcher $scopeResolverDispatcher, private readonly UserACLAwareRepositoryInterface $userACLAwareRepository, private readonly ParentRoleHelper $parentRoleHelper)
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -17,7 +17,7 @@ use Symfony\Component\Security\Core\Security;
|
||||
|
||||
class AuthorizationHelperForCurrentUser implements AuthorizationHelperForCurrentUserInterface
|
||||
{
|
||||
public function __construct(private AuthorizationHelperInterface $authorizationHelper, private Security $security)
|
||||
public function __construct(private readonly AuthorizationHelperInterface $authorizationHelper, private readonly Security $security)
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -16,9 +16,9 @@ use Symfony\Component\Security\Core\Authorization\Voter\Voter;
|
||||
|
||||
class ChillExportVoter extends Voter
|
||||
{
|
||||
public const EXPORT = 'chill_export';
|
||||
final public const EXPORT = 'chill_export';
|
||||
|
||||
private VoterHelperInterface $helper;
|
||||
private readonly VoterHelperInterface $helper;
|
||||
|
||||
public function __construct(VoterHelperFactoryInterface $voterHelperFactory)
|
||||
{
|
||||
|
@@ -16,7 +16,7 @@ use Chill\MainBundle\Security\Resolver\CenterResolverDispatcherInterface;
|
||||
|
||||
use function in_array;
|
||||
|
||||
final class DefaultVoterHelper implements VoterHelperInterface
|
||||
final readonly class DefaultVoterHelper implements VoterHelperInterface
|
||||
{
|
||||
public function __construct(private AuthorizationHelper $authorizationHelper, private CenterResolverDispatcherInterface $centerResolverDispatcher, private array $configuration)
|
||||
{
|
||||
|
@@ -17,7 +17,7 @@ final class DefaultVoterHelperGenerator implements VoterGeneratorInterface
|
||||
{
|
||||
private array $configuration = [];
|
||||
|
||||
public function __construct(private AuthorizationHelper $authorizationHelper, private CenterResolverDispatcherInterface $centerResolverDispatcher)
|
||||
public function __construct(private readonly AuthorizationHelper $authorizationHelper, private readonly CenterResolverDispatcherInterface $centerResolverDispatcher)
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -21,15 +21,15 @@ use function in_array;
|
||||
|
||||
class EntityWorkflowVoter extends Voter
|
||||
{
|
||||
public const CREATE = 'CHILL_MAIN_WORKFLOW_CREATE';
|
||||
final public const CREATE = 'CHILL_MAIN_WORKFLOW_CREATE';
|
||||
|
||||
public const DELETE = 'CHILL_MAIN_WORKFLOW_DELETE';
|
||||
final public const DELETE = 'CHILL_MAIN_WORKFLOW_DELETE';
|
||||
|
||||
public const SEE = 'CHILL_MAIN_WORKFLOW_SEE';
|
||||
final public const SEE = 'CHILL_MAIN_WORKFLOW_SEE';
|
||||
|
||||
public const SHOW_ENTITY_LINK = 'CHILL_MAIN_WORKFLOW_LINK_SHOW';
|
||||
final public const SHOW_ENTITY_LINK = 'CHILL_MAIN_WORKFLOW_LINK_SHOW';
|
||||
|
||||
public function __construct(private EntityWorkflowManager $manager, private Security $security)
|
||||
public function __construct(private readonly EntityWorkflowManager $manager, private readonly Security $security)
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -19,11 +19,11 @@ use function in_array;
|
||||
|
||||
class SavedExportVoter extends Voter
|
||||
{
|
||||
public const DELETE = 'CHLL_MAIN_EXPORT_SAVED_DELETE';
|
||||
final public const DELETE = 'CHLL_MAIN_EXPORT_SAVED_DELETE';
|
||||
|
||||
public const EDIT = 'CHLL_MAIN_EXPORT_SAVED_EDIT';
|
||||
final public const EDIT = 'CHLL_MAIN_EXPORT_SAVED_EDIT';
|
||||
|
||||
public const GENERATE = 'CHLL_MAIN_EXPORT_SAVED_GENERATE';
|
||||
final public const GENERATE = 'CHLL_MAIN_EXPORT_SAVED_GENERATE';
|
||||
|
||||
private const ALL = [
|
||||
self::DELETE,
|
||||
|
@@ -24,7 +24,7 @@ class WorkflowEntityDeletionVoter extends Voter
|
||||
/**
|
||||
* @param \Chill\MainBundle\Workflow\EntityWorkflowHandlerInterface[] $handlers
|
||||
*/
|
||||
public function __construct(private $handlers, private EntityWorkflowRepository $entityWorkflowRepository)
|
||||
public function __construct(private $handlers, private readonly EntityWorkflowRepository $entityWorkflowRepository)
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -16,20 +16,20 @@ use Symfony\Component\EventDispatcher\Event;
|
||||
|
||||
class PasswordRecoverEvent extends Event
|
||||
{
|
||||
public const ASK_TOKEN_INVALID_FORM = 'chill_main.ask_token_invalid_form';
|
||||
final public const ASK_TOKEN_INVALID_FORM = 'chill_main.ask_token_invalid_form';
|
||||
|
||||
public const ASK_TOKEN_SUCCESS = 'chill_main.ask_token_success';
|
||||
final public const ASK_TOKEN_SUCCESS = 'chill_main.ask_token_success';
|
||||
|
||||
public const INVALID_TOKEN = 'chill_main.password_recover_invalid_token';
|
||||
final public const INVALID_TOKEN = 'chill_main.password_recover_invalid_token';
|
||||
|
||||
/**
|
||||
* @param bool $safelyGenerated true if generated safely (from console command, etc.)
|
||||
*/
|
||||
public function __construct(
|
||||
private ?string $token = null,
|
||||
private ?User $user = null,
|
||||
private readonly ?string $token = null,
|
||||
private readonly ?User $user = null,
|
||||
private $ip = null,
|
||||
private bool $safelyGenerated = false,
|
||||
private readonly bool $safelyGenerated = false,
|
||||
) {
|
||||
}
|
||||
|
||||
|
@@ -18,28 +18,28 @@ use UnexpectedValueException;
|
||||
|
||||
class PasswordRecoverLocker
|
||||
{
|
||||
public const ASK_TOKEN_INVALID_FORM_TTL = 3600;
|
||||
final public const ASK_TOKEN_INVALID_FORM_TTL = 3600;
|
||||
|
||||
/**
|
||||
* TTL to keep invalid token recorded.
|
||||
*/
|
||||
public const INVALID_TOKEN_TTL = 3600;
|
||||
final public const INVALID_TOKEN_TTL = 3600;
|
||||
|
||||
public const MAX_ASK_TOKEN_BY_USER = 10;
|
||||
final public const MAX_ASK_TOKEN_BY_USER = 10;
|
||||
|
||||
public const MAX_ASK_TOKEN_INVALID_FORM_BY_IP = 10;
|
||||
final public const MAX_ASK_TOKEN_INVALID_FORM_BY_IP = 10;
|
||||
|
||||
public const MAX_ASK_TOKEN_INVALID_FORM_GLOBAL = 50;
|
||||
final public const MAX_ASK_TOKEN_INVALID_FORM_GLOBAL = 50;
|
||||
|
||||
/**
|
||||
* The maximum of invalid token by ip.
|
||||
*/
|
||||
public const MAX_INVALID_TOKEN_BY_IP = 10;
|
||||
final public const MAX_INVALID_TOKEN_BY_IP = 10;
|
||||
|
||||
/**
|
||||
* The maximum of invalid token globally (across all ip).
|
||||
*/
|
||||
public const MAX_INVALID_TOKEN_GLOBAL = 50;
|
||||
final public const MAX_INVALID_TOKEN_GLOBAL = 50;
|
||||
|
||||
/**
|
||||
* @var ChillRedis
|
||||
|
@@ -20,9 +20,9 @@ use function in_array;
|
||||
|
||||
class PasswordRecoverVoter extends Voter
|
||||
{
|
||||
public const ASK_TOKEN = 'CHILL_PASSWORD_ASK_TOKEN';
|
||||
final public const ASK_TOKEN = 'CHILL_PASSWORD_ASK_TOKEN';
|
||||
|
||||
public const TRY_TOKEN = 'CHILL_PASSWORD_TRY_TOKEN';
|
||||
final public const TRY_TOKEN = 'CHILL_PASSWORD_TRY_TOKEN';
|
||||
|
||||
/**
|
||||
* @var PasswordRecoverLocker
|
||||
|
@@ -22,9 +22,9 @@ use function array_merge;
|
||||
|
||||
class RecoverPasswordHelper
|
||||
{
|
||||
public const RECOVER_PASSWORD_ROUTE = 'password_recover';
|
||||
final public const RECOVER_PASSWORD_ROUTE = 'password_recover';
|
||||
|
||||
public function __construct(private TokenManager $tokenManager, private UrlGeneratorInterface $urlGenerator, private MailerInterface $mailer)
|
||||
public function __construct(private readonly TokenManager $tokenManager, private readonly UrlGeneratorInterface $urlGenerator, private readonly MailerInterface $mailer)
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -27,15 +27,15 @@ use function trim;
|
||||
|
||||
class TokenManager
|
||||
{
|
||||
public const HASH = 'h';
|
||||
final public const HASH = 'h';
|
||||
|
||||
public const TIMESTAMP = 'ts';
|
||||
final public const TIMESTAMP = 'ts';
|
||||
|
||||
public const TOKEN = 't';
|
||||
final public const TOKEN = 't';
|
||||
|
||||
public const TOKEN_LENGTH = 24;
|
||||
final public const TOKEN_LENGTH = 24;
|
||||
|
||||
public const USERNAME_CANONICAL = 'u';
|
||||
final public const USERNAME_CANONICAL = 'u';
|
||||
|
||||
/**
|
||||
* @var LoggerInterface
|
||||
@@ -72,7 +72,7 @@ class TokenManager
|
||||
|
||||
public function verify($hash, $token, User $user, string $timestamp)
|
||||
{
|
||||
$token = hex2bin(trim($token));
|
||||
$token = hex2bin(trim((string) $token));
|
||||
|
||||
if (strlen($token) !== self::TOKEN_LENGTH) {
|
||||
return false;
|
||||
|
@@ -11,7 +11,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\MainBundle\Security\Resolver;
|
||||
|
||||
final class CenterResolverDispatcher implements CenterResolverDispatcherInterface
|
||||
final readonly class CenterResolverDispatcher implements CenterResolverDispatcherInterface
|
||||
{
|
||||
/**
|
||||
* @param \Chill\MainBundle\Security\Resolver\CenterResolverInterface[] $resolvers
|
||||
|
@@ -17,7 +17,7 @@ use UnexpectedValueException;
|
||||
use function get_class;
|
||||
use function is_array;
|
||||
|
||||
final class CenterResolverManager implements CenterResolverManagerInterface
|
||||
final readonly class CenterResolverManager implements CenterResolverManagerInterface
|
||||
{
|
||||
/**
|
||||
* @param \Chill\MainBundle\Security\Resolver\CenterResolverInterface[] $resolvers
|
||||
|
@@ -15,16 +15,16 @@ use Twig\TwigFilter;
|
||||
|
||||
final class ResolverTwigExtension extends \Twig\Extension\AbstractExtension
|
||||
{
|
||||
public function __construct(private CenterResolverManagerInterface $centerResolverDispatcher, private ScopeResolverDispatcher $scopeResolverDispatcher)
|
||||
public function __construct(private readonly CenterResolverManagerInterface $centerResolverDispatcher, private readonly ScopeResolverDispatcher $scopeResolverDispatcher)
|
||||
{
|
||||
}
|
||||
|
||||
public function getFilters()
|
||||
{
|
||||
return [
|
||||
new TwigFilter('chill_resolve_center', [$this, 'resolveCenter']),
|
||||
new TwigFilter('chill_resolve_scope', [$this, 'resolveScope']),
|
||||
new TwigFilter('chill_is_scope_concerned', [$this, 'isScopeConcerned']),
|
||||
new TwigFilter('chill_resolve_center', $this->resolveCenter(...)),
|
||||
new TwigFilter('chill_resolve_scope', $this->resolveScope(...)),
|
||||
new TwigFilter('chill_is_scope_concerned', $this->isScopeConcerned(...)),
|
||||
];
|
||||
}
|
||||
|
||||
|
@@ -14,7 +14,7 @@ namespace Chill\MainBundle\Security\Resolver;
|
||||
use Chill\MainBundle\Entity\Scope;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
|
||||
final class ScopeResolverDispatcher
|
||||
final readonly class ScopeResolverDispatcher
|
||||
{
|
||||
/**
|
||||
* @param \Chill\MainBundle\Security\Resolver\ScopeResolverInterface[] $resolvers
|
||||
|
Reference in New Issue
Block a user