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

@@ -44,10 +44,6 @@ class ExportManager
*/
private array $aggregators = [];
private AuthorizationCheckerInterface $authorizationChecker;
private AuthorizationHelperInterface $authorizationHelper;
/**
* Collected Exports, injected by DI.
*
@@ -69,17 +65,15 @@ class ExportManager
*/
private array $formatters = [];
private LoggerInterface $logger;
/**
* @var \Symfony\Component\Security\Core\User\UserInterface
*/
private $user;
public function __construct(
LoggerInterface $logger,
AuthorizationCheckerInterface $authorizationChecker,
AuthorizationHelperInterface $authorizationHelper,
private LoggerInterface $logger,
private AuthorizationCheckerInterface $authorizationChecker,
private AuthorizationHelperInterface $authorizationHelper,
TokenStorageInterface $tokenStorage,
iterable $exports,
iterable $aggregators,
@@ -87,9 +81,6 @@ class ExportManager
//iterable $formatters,
//iterable $exportElementProvider
) {
$this->logger = $logger;
$this->authorizationChecker = $authorizationChecker;
$this->authorizationHelper = $authorizationHelper;
$this->user = $tokenStorage->getToken()->getUser();
$this->exports = iterator_to_array($exports);
$this->aggregators = iterator_to_array($aggregators);
@@ -163,7 +154,7 @@ class ExportManager
} elseif ($element instanceof FormatterInterface) {
$this->addFormatter($element, $alias);
} else {
throw new LogicException('This element ' . get_class($element) . ' '
throw new LogicException('This element ' . $element::class . ' '
. 'is not an instance of export element');
}
}
@@ -468,12 +459,10 @@ class ExportManager
* Return true if the current user has access to the ExportElement for every
* center, false if the user hasn't access to element for at least one center.
*
* @param \Chill\MainBundle\Export\ExportElementInterface $element
* @param DirectExportInterface|ExportInterface $export
*
* @return bool
*/
public function isGrantedForElement(ExportElementInterface $element, ?ExportElementInterface $export = null, ?array $centers = null)
public function isGrantedForElement(ExportElementInterface $element, \Chill\MainBundle\Export\DirectExportInterface|\Chill\MainBundle\Export\ExportInterface $export = null, ?array $centers = null)
{
if ($element instanceof ExportInterface || $element instanceof DirectExportInterface) {
$role = $element->requiredRole();
@@ -506,7 +495,7 @@ class ExportManager
//debugging
$this->logger->debug('user has no access to element', [
'method' => __METHOD__,
'type' => get_class($element),
'type' => $element::class,
'center' => $center->getName(),
'role' => $role,
]);
@@ -577,7 +566,7 @@ class ExportManager
private function handleFilters(
ExportInterface $export,
QueryBuilder $qb,
$data,
mixed $data,
array $centers
) {
$filters = $this->retrieveUsedFilters($data);
@@ -598,11 +587,9 @@ class ExportManager
}
/**
* @param mixed $data
*
* @return AggregatorInterface[]
*/
private function retrieveUsedAggregators($data)
private function retrieveUsedAggregators(mixed $data)
{
if (null === $data) {
return [];
@@ -616,11 +603,9 @@ class ExportManager
}
/**
* @param mixed $data
*
* @return string[]
*/
private function retrieveUsedAggregatorsType($data)
private function retrieveUsedAggregatorsType(mixed $data)
{
if (null === $data) {
return [];
@@ -660,7 +645,7 @@ class ExportManager
*
* @return array an array with types
*/
private function retrieveUsedFiltersType($data)
private function retrieveUsedFiltersType(mixed $data)
{
if (null === $data) {
return [];
@@ -684,11 +669,10 @@ class ExportManager
/**
* parse the data to retrieve the used filters and aggregators.
*
* @param mixed $data
*
* @return string[]
*/
private function retrieveUsedModifiers($data)
private function retrieveUsedModifiers(mixed $data)
{
if (null === $data) {
return [];