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)),
};
};
}