DX: apply rector rules up to php8.0

This commit is contained in:
2023-04-15 01:05:37 +02:00
parent d8870e906f
commit dde3002100
714 changed files with 2348 additions and 9263 deletions

View File

@@ -37,32 +37,17 @@ class Convert
private string $collaboraDomain;
private HttpClientInterface $httpClient;
private LoggerInterface $logger;
private RequestStack $requestStack;
private Security $security;
private StoredObjectManagerInterface $storedObjectManager;
/**
* @param StoredObjectManager $storedObjectManager
*/
public function __construct(
HttpClientInterface $httpClient,
RequestStack $requestStack,
Security $security,
StoredObjectManagerInterface $storedObjectManager,
LoggerInterface $logger,
private HttpClientInterface $httpClient,
private RequestStack $requestStack,
private Security $security,
private StoredObjectManagerInterface $storedObjectManager,
private LoggerInterface $logger,
ParameterBagInterface $parameters
) {
$this->httpClient = $httpClient;
$this->requestStack = $requestStack;
$this->security = $security;
$this->storedObjectManager = $storedObjectManager;
$this->logger = $logger;
$this->collaboraDomain = $parameters->get('wopi')['server'];
}

View File

@@ -38,48 +38,8 @@ use Twig\Environment;
*/
final class Editor
{
private DocumentManagerInterface $documentManager;
private EngineInterface $engine;
private JWTTokenManagerInterface $JWTTokenManager;
private Psr17Interface $psr17;
private ResponderInterface $responder;
private RouterInterface $router;
private Security $security;
private ConfigurationInterface $wopiConfiguration;
private DiscoveryInterface $wopiDiscovery;
private NormalizerInterface $normalizer;
public function __construct(
ConfigurationInterface $wopiConfiguration,
DiscoveryInterface $wopiDiscovery,
DocumentManagerInterface $documentManager,
EngineInterface $engine,
JWTTokenManagerInterface $JWTTokenManager,
NormalizerInterface $normalizer,
ResponderInterface $responder,
Security $security,
Psr17Interface $psr17,
RouterInterface $router
) {
$this->documentManager = $documentManager;
$this->engine = $engine;
$this->JWTTokenManager = $JWTTokenManager;
$this->normalizer = $normalizer;
$this->wopiConfiguration = $wopiConfiguration;
$this->wopiDiscovery = $wopiDiscovery;
$this->responder = $responder;
$this->security = $security;
$this->psr17 = $psr17;
$this->router = $router;
public function __construct(private ConfigurationInterface $wopiConfiguration, private DiscoveryInterface $wopiDiscovery, private DocumentManagerInterface $documentManager, private EngineInterface $engine, private JWTTokenManagerInterface $JWTTokenManager, private NormalizerInterface $normalizer, private ResponderInterface $responder, private Security $security, private Psr17Interface $psr17, private RouterInterface $router)
{
}
public function __invoke(string $fileId, Request $request): Response

View File

@@ -22,20 +22,8 @@ use Twig\Environment;
final class Responder implements ResponderInterface
{
private SerializerInterface $serializer;
private Environment $twig;
private UrlGeneratorInterface $urlGenerator;
public function __construct(
Environment $twig,
UrlGeneratorInterface $urlGenerator,
SerializerInterface $serializer
) {
$this->twig = $twig;
$this->urlGenerator = $urlGenerator;
$this->serializer = $serializer;
public function __construct(private Environment $twig, private UrlGeneratorInterface $urlGenerator, private SerializerInterface $serializer)
{
}
public function file(

View File

@@ -19,14 +19,8 @@ use Symfony\Component\Security\Core\Security;
class AuthorizationManager implements \ChampsLibres\WopiBundle\Contracts\AuthorizationManagerInterface
{
private Security $security;
private JWTTokenManagerInterface $tokenManager;
public function __construct(JWTTokenManagerInterface $tokenManager, Security $security)
public function __construct(private JWTTokenManagerInterface $tokenManager, private Security $security)
{
$this->tokenManager = $tokenManager;
$this->security = $security;
}
public function isRestrictedWebViewOnly(string $accessToken, Document $document, RequestInterface $request): bool

View File

@@ -26,11 +26,8 @@ class ChillDocumentLockManager implements DocumentLockManagerInterface
*/
private const LOCK_GRACEFUL_DURATION_TIME = 3;
private ChillRedis $redis;
public function __construct(ChillRedis $redis)
public function __construct(private ChillRedis $redis)
{
$this->redis = $redis;
}
public function deleteLock(Document $document, RequestInterface $request): bool

View File

@@ -34,33 +34,18 @@ use function strlen;
final class ChillDocumentManager implements DocumentManagerInterface
{
private DocumentLockManagerInterface $documentLockManager;
private EntityManagerInterface $entityManager;
private Psr17Interface $psr17;
private RequestInterface $request;
private StoredObjectManagerInterface $storedObjectManager;
private StoredObjectRepository $storedObjectRepository;
public function __construct(
DocumentLockManagerInterface $documentLockManager,
EntityManagerInterface $entityManager,
private DocumentLockManagerInterface $documentLockManager,
private EntityManagerInterface $entityManager,
HttpMessageFactoryInterface $httpMessageFactory,
Psr17Interface $psr17,
private Psr17Interface $psr17,
RequestStack $requestStack,
StoredObjectManagerInterface $storedObjectManager,
StoredObjectRepository $storedObjectRepository
private StoredObjectManagerInterface $storedObjectManager,
private StoredObjectRepository $storedObjectRepository
) {
$this->documentLockManager = $documentLockManager;
$this->entityManager = $entityManager;
$this->psr17 = $psr17;
$this->request = $httpMessageFactory->createRequest($requestStack->getCurrentRequest());
$this->storedObjectManager = $storedObjectManager;
$this->storedObjectRepository = $storedObjectRepository;
}
public function create(array $data): Document

View File

@@ -17,12 +17,8 @@ use Psr\Http\Message\ResponseInterface;
final class ChillWopi implements WopiInterface
{
private WopiInterface $wopi;
public function __construct(
WopiInterface $wopi
) {
$this->wopi = $wopi;
public function __construct(private WopiInterface $wopi)
{
}
public function checkFileInfo(

View File

@@ -17,11 +17,8 @@ use Symfony\Component\Security\Core\Security;
class UserManager implements \ChampsLibres\WopiBundle\Contracts\UserManagerInterface
{
private Security $security;
public function __construct(Security $security)
public function __construct(private Security $security)
{
$this->security = $security;
}
public function getUserFriendlyName(string $accessToken, string $fileId, RequestInterface $request): ?string