apply more cs rules for php-cs

This commit is contained in:
2023-10-17 13:27:03 +02:00
parent 0b0cbed9db
commit bc2041cbdd
1485 changed files with 8169 additions and 9620 deletions

View File

@@ -15,10 +15,8 @@ use Chill\CalendarBundle\Export\Declarations;
use Chill\MainBundle\Export\AggregatorInterface;
use Chill\MainBundle\Repository\UserRepository;
use Chill\MainBundle\Templating\Entity\UserRender;
use Closure;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface;
use function in_array;
final readonly class AgentAggregator implements AggregatorInterface
{
@@ -31,7 +29,7 @@ final readonly class AgentAggregator implements AggregatorInterface
public function alterQuery(QueryBuilder $qb, $data)
{
if (!in_array('caluser', $qb->getAllAliases(), true)) {
if (!\in_array('caluser', $qb->getAllAliases(), true)) {
$qb->join('cal.mainUser', 'caluser');
}
@@ -48,12 +46,13 @@ final readonly class AgentAggregator implements AggregatorInterface
{
// no form
}
public function getFormDefaultData(): array
{
return [];
}
public function getLabels($key, array $values, $data): Closure
public function getLabels($key, array $values, $data): \Closure
{
return function ($value): string {
if ('_header' === $value) {

View File

@@ -15,10 +15,8 @@ use Chill\CalendarBundle\Export\Declarations;
use Chill\CalendarBundle\Repository\CancelReasonRepository;
use Chill\MainBundle\Export\AggregatorInterface;
use Chill\MainBundle\Templating\TranslatableStringHelper;
use Closure;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface;
use function in_array;
class CancelReasonAggregator implements AggregatorInterface
{
@@ -32,7 +30,7 @@ class CancelReasonAggregator implements AggregatorInterface
public function alterQuery(QueryBuilder $qb, $data)
{
// TODO: still needs to take into account calendars without a cancel reason somehow
if (!in_array('calcancel', $qb->getAllAliases(), true)) {
if (!\in_array('calcancel', $qb->getAllAliases(), true)) {
$qb->join('cal.cancelReason', 'calcancel');
}
@@ -49,12 +47,13 @@ class CancelReasonAggregator implements AggregatorInterface
{
// no form
}
public function getFormDefaultData(): array
{
return [];
}
public function getLabels($key, array $values, $data): Closure
public function getLabels($key, array $values, $data): \Closure
{
return function ($value): string {
if ('_header' === $value) {

View File

@@ -16,7 +16,6 @@ use Chill\MainBundle\Entity\User\UserJobHistory;
use Chill\MainBundle\Export\AggregatorInterface;
use Chill\MainBundle\Repository\UserJobRepository;
use Chill\MainBundle\Templating\TranslatableStringHelper;
use Closure;
use Doctrine\ORM\Query\Expr\Join;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface;
@@ -50,10 +49,10 @@ final readonly class JobAggregator implements AggregatorInterface
// job_at based on cal.startDate
->andWhere(
$qb->expr()->andX(
$qb->expr()->lte("{$p}_history.startDate", "cal.startDate"),
$qb->expr()->lte("{$p}_history.startDate", 'cal.startDate'),
$qb->expr()->orX(
$qb->expr()->isNull("{$p}_history.endDate"),
$qb->expr()->gt("{$p}_history.endDate", "cal.startDate")
$qb->expr()->gt("{$p}_history.endDate", 'cal.startDate')
)
)
)
@@ -73,7 +72,7 @@ final readonly class JobAggregator implements AggregatorInterface
return [];
}
public function getLabels($key, array $values, $data): Closure
public function getLabels($key, array $values, $data): \Closure
{
return function ($value): string {
if ('_header' === $value) {
@@ -96,7 +95,7 @@ final readonly class JobAggregator implements AggregatorInterface
public function getQueryKeys($data): array
{
return [self::PREFIX . '_select'];
return [self::PREFIX.'_select'];
}
public function getTitle(): string

View File

@@ -14,10 +14,8 @@ namespace Chill\CalendarBundle\Export\Aggregator;
use Chill\CalendarBundle\Export\Declarations;
use Chill\MainBundle\Export\AggregatorInterface;
use Chill\MainBundle\Repository\LocationRepository;
use Closure;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface;
use function in_array;
final readonly class LocationAggregator implements AggregatorInterface
{
@@ -30,7 +28,7 @@ final readonly class LocationAggregator implements AggregatorInterface
public function alterQuery(QueryBuilder $qb, $data)
{
if (!in_array('calloc', $qb->getAllAliases(), true)) {
if (!\in_array('calloc', $qb->getAllAliases(), true)) {
$qb->join('cal.location', 'calloc');
}
$qb->addSelect('IDENTITY(cal.location) as location_aggregator');
@@ -46,12 +44,13 @@ final readonly class LocationAggregator implements AggregatorInterface
{
// no form
}
public function getFormDefaultData(): array
{
return [];
}
public function getLabels($key, array $values, $data): Closure
public function getLabels($key, array $values, $data): \Closure
{
return function ($value): string {
if ('_header' === $value) {

View File

@@ -15,10 +15,8 @@ use Chill\CalendarBundle\Export\Declarations;
use Chill\MainBundle\Export\AggregatorInterface;
use Chill\MainBundle\Repository\LocationTypeRepository;
use Chill\MainBundle\Templating\TranslatableStringHelper;
use Closure;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface;
use function in_array;
final readonly class LocationTypeAggregator implements AggregatorInterface
{
@@ -31,7 +29,7 @@ final readonly class LocationTypeAggregator implements AggregatorInterface
public function alterQuery(QueryBuilder $qb, $data)
{
if (!in_array('calloc', $qb->getAllAliases(), true)) {
if (!\in_array('calloc', $qb->getAllAliases(), true)) {
$qb->join('cal.location', 'calloc');
}
@@ -48,12 +46,13 @@ final readonly class LocationTypeAggregator implements AggregatorInterface
{
// no form
}
public function getFormDefaultData(): array
{
return [];
}
public function getLabels($key, array $values, $data): Closure
public function getLabels($key, array $values, $data): \Closure
{
return function ($value): string {
if ('_header' === $value) {

View File

@@ -13,7 +13,6 @@ namespace Chill\CalendarBundle\Export\Aggregator;
use Chill\CalendarBundle\Export\Declarations;
use Chill\MainBundle\Export\AggregatorInterface;
use Closure;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface;
@@ -40,12 +39,13 @@ class MonthYearAggregator implements AggregatorInterface
{
// No form needed
}
public function getFormDefaultData(): array
{
return [];
}
public function getLabels($key, array $values, $data): Closure
public function getLabels($key, array $values, $data): \Closure
{
return static function ($value): string {
if ('_header' === $value) {

View File

@@ -16,14 +16,13 @@ use Chill\MainBundle\Entity\User\UserScopeHistory;
use Chill\MainBundle\Export\AggregatorInterface;
use Chill\MainBundle\Repository\ScopeRepository;
use Chill\MainBundle\Templating\TranslatableStringHelper;
use Closure;
use Doctrine\ORM\Query\Expr\Join;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface;
final readonly class ScopeAggregator implements AggregatorInterface
{
private const PREFIX = "cal_agg_scope";
private const PREFIX = 'cal_agg_scope';
public function __construct(
private ScopeRepository $scopeRepository,
@@ -40,7 +39,7 @@ final readonly class ScopeAggregator implements AggregatorInterface
$p = self::PREFIX;
$qb
->leftJoin("cal.mainUser", "{$p}_user")
->leftJoin('cal.mainUser', "{$p}_user")
->leftJoin(
UserScopeHistory::class,
"{$p}_history",
@@ -50,10 +49,10 @@ final readonly class ScopeAggregator implements AggregatorInterface
// scope_at based on cal.startDate
->andWhere(
$qb->expr()->andX(
$qb->expr()->lte("{$p}_history.startDate", "cal.startDate"),
$qb->expr()->lte("{$p}_history.startDate", 'cal.startDate'),
$qb->expr()->orX(
$qb->expr()->isNull("{$p}_history.endDate"),
$qb->expr()->gt("{$p}_history.endDate", "cal.startDate")
$qb->expr()->gt("{$p}_history.endDate", 'cal.startDate')
)
)
)
@@ -73,7 +72,7 @@ final readonly class ScopeAggregator implements AggregatorInterface
return [];
}
public function getLabels($key, array $values, $data): Closure
public function getLabels($key, array $values, $data): \Closure
{
return function ($value): string {
if ('_header' === $value) {
@@ -96,7 +95,7 @@ final readonly class ScopeAggregator implements AggregatorInterface
public function getQueryKeys($data): array
{
return [self::PREFIX . '_select'];
return [self::PREFIX.'_select'];
}
public function getTitle(): string

View File

@@ -20,9 +20,7 @@ namespace Chill\CalendarBundle\Export\Aggregator;
use Chill\CalendarBundle\Export\Declarations;
use Chill\MainBundle\Export\AggregatorInterface;
use Closure;
use Doctrine\ORM\QueryBuilder;
use LogicException;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
@@ -50,12 +48,13 @@ class UrgencyAggregator implements AggregatorInterface
{
// no form
}
public function getFormDefaultData(): array
{
return [];
}
public function getLabels($key, array $values, $data): Closure
public function getLabels($key, array $values, $data): \Closure
{
return function ($value): string {
if ('_header' === $value) {
@@ -65,7 +64,7 @@ class UrgencyAggregator implements AggregatorInterface
return match ($value) {
true => $this->translator->trans('is urgent'),
false => $this->translator->trans('is not urgent'),
default => throw new LogicException(sprintf('The value %s is not valid', $value)),
default => throw new \LogicException(sprintf('The value %s is not valid', $value)),
};
};
}

View File

@@ -18,7 +18,6 @@ use Chill\MainBundle\Export\ExportInterface;
use Chill\MainBundle\Export\FormatterInterface;
use Chill\MainBundle\Export\GroupedExportInterface;
use Chill\PersonBundle\Security\Authorization\PersonVoter;
use Closure;
use Doctrine\ORM\AbstractQuery;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface;
@@ -32,6 +31,7 @@ class CountCalendars implements ExportInterface, GroupedExportInterface
{
// No form necessary
}
public function getFormDefaultData(): array
{
return [];

View File

@@ -20,7 +20,6 @@ use Chill\MainBundle\Export\GroupedExportInterface;
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter;
use Doctrine\ORM\Query;
use Doctrine\ORM\QueryBuilder;
use LogicException;
use Symfony\Component\Form\FormBuilderInterface;
class StatCalendarAvgDuration implements ExportInterface, GroupedExportInterface
@@ -31,6 +30,7 @@ class StatCalendarAvgDuration implements ExportInterface, GroupedExportInterface
{
// no form needed
}
public function getFormDefaultData(): array
{
return [];
@@ -54,7 +54,7 @@ class StatCalendarAvgDuration implements ExportInterface, GroupedExportInterface
public function getLabels($key, array $values, $data)
{
if ('export_result' !== $key) {
throw new LogicException("the key {$key} is not used by this export");
throw new \LogicException("the key {$key} is not used by this export");
}
$labels = array_combine($values, $values);

View File

@@ -20,7 +20,6 @@ use Chill\MainBundle\Export\GroupedExportInterface;
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter;
use Doctrine\ORM\Query;
use Doctrine\ORM\QueryBuilder;
use LogicException;
use Symfony\Component\Form\FormBuilderInterface;
class StatCalendarSumDuration implements ExportInterface, GroupedExportInterface
@@ -31,6 +30,7 @@ class StatCalendarSumDuration implements ExportInterface, GroupedExportInterface
{
// no form needed
}
public function getFormDefaultData(): array
{
return [];
@@ -54,7 +54,7 @@ class StatCalendarSumDuration implements ExportInterface, GroupedExportInterface
public function getLabels($key, array $values, $data)
{
if ('export_result' !== $key) {
throw new LogicException("the key {$key} is not used by this export");
throw new \LogicException("the key {$key} is not used by this export");
}
$labels = array_combine($values, $values);

View File

@@ -58,6 +58,7 @@ class AgentFilter implements FilterInterface
'expanded' => true,
]);
}
public function getFormDefaultData(): array
{
return [];

View File

@@ -58,6 +58,7 @@ class BetweenDatesFilter implements FilterInterface
->add('date_from', PickRollingDateType::class, [])
->add('date_to', PickRollingDateType::class, []);
}
public function getFormDefaultData(): array
{
return ['date_from' => new RollingDate(RollingDate::T_YEAR_PREVIOUS_START), 'date_to' => new RollingDate(RollingDate::T_TODAY)];

View File

@@ -20,7 +20,6 @@ namespace Chill\CalendarBundle\Export\Filter;
use Chill\CalendarBundle\Export\Declarations;
use Chill\MainBundle\Export\FilterInterface;
use Doctrine\ORM\Query\Expr\Andx;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\FormBuilderInterface;
@@ -66,6 +65,7 @@ class CalendarRangeFilter implements FilterInterface
'empty_data' => self::DEFAULT_CHOICE,
]);
}
public function getFormDefaultData(): array
{
return ['hasCalendarRange' => self::DEFAULT_CHOICE];

View File

@@ -20,7 +20,6 @@ use Doctrine\ORM\Query\Expr\Join;
use Doctrine\ORM\QueryBuilder;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
final readonly class JobFilter implements FilterInterface
{
@@ -40,7 +39,7 @@ final readonly class JobFilter implements FilterInterface
$p = self::PREFIX;
$qb
->leftJoin("cal.mainUser", "{$p}_user")
->leftJoin('cal.mainUser', "{$p}_user")
->leftJoin(
UserJobHistory::class,
"{$p}_history",
@@ -50,19 +49,18 @@ final readonly class JobFilter implements FilterInterface
// job_at based on cal.startDate
->andWhere(
$qb->expr()->andX(
$qb->expr()->lte("{$p}_history.startDate", "cal.startDate"),
$qb->expr()->lte("{$p}_history.startDate", 'cal.startDate'),
$qb->expr()->orX(
$qb->expr()->isNull("{$p}_history.endDate"),
$qb->expr()->gt("{$p}_history.endDate", "cal.startDate")
$qb->expr()->gt("{$p}_history.endDate", 'cal.startDate')
)
)
)
->andWhere($qb->expr()->in("{$p}_history.job", ":{$p}_job"))
->setParameter(
"{$p}_job",
$data["job"]
$data['job']
);
}
public function applyOn(): string

View File

@@ -41,7 +41,7 @@ class ScopeFilter implements FilterInterface
$p = self::PREFIX;
$qb
->leftJoin("cal.mainUser", "{$p}_user")
->leftJoin('cal.mainUser', "{$p}_user")
->leftJoin(
UserScopeHistory::class,
"{$p}_history",
@@ -51,17 +51,17 @@ class ScopeFilter implements FilterInterface
// scope_at based on cal.startDate
->andWhere(
$qb->expr()->andX(
$qb->expr()->lte("{$p}_history.startDate", "cal.startDate"),
$qb->expr()->lte("{$p}_history.startDate", 'cal.startDate'),
$qb->expr()->orX(
$qb->expr()->isNull("{$p}_history.endDate"),
$qb->expr()->gt("{$p}_history.endDate", "cal.startDate")
$qb->expr()->gt("{$p}_history.endDate", 'cal.startDate')
)
)
)
->andWhere($qb->expr()->in("{$p}_history.scope", ":{$p}_scope"))
->setParameter(
"{$p}_scope",
$data["scope"]
$data['scope']
);
}