chore: code cleanup

This commit is contained in:
Björn Fromme
2025-08-21 14:20:43 +02:00
parent c4e28818e0
commit e36009008c
273 changed files with 547 additions and 531 deletions
+1 -1
View File
@@ -36,4 +36,4 @@ class AddressType extends AbstractType
'anti_xss' => true,
]);
}
}
}
+4 -4
View File
@@ -29,7 +29,7 @@ class AdminFeedbackType extends AbstractType
'label' => 'Teamer',
'class' => Teamer::class,
'label_property' => 'name',
'label_function' => fn(Teamer $teamer) => (string) $teamer,
'label_function' => fn (Teamer $teamer) => (string) $teamer,
'endpoint_route' => 'app_admin_autocomplete_teamer',
])
->add('authorOverride', AutocompleteEntityType::class, [
@@ -37,7 +37,7 @@ class AdminFeedbackType extends AbstractType
'label' => 'abweichender Absender',
'class' => User::class,
'label_property' => 'lastName',
'label_function' => fn(User $user) => (string) $user,
'label_function' => fn (User $user) => (string) $user,
'endpoint_route' => 'app_admin_autocomplete_user',
'endpoint_parameters' => [
'role' => 'ROLE_HOUSE_MANAGER',
@@ -107,8 +107,8 @@ class AdminFeedbackType extends AbstractType
'validation_groups' => [
'Default',
'admin',
]
],
])
;
}
}
}
+1 -1
View File
@@ -45,4 +45,4 @@ class ApplicationStatusType extends AbstractType
'anti_xss' => true,
]);
}
}
}
-3
View File
@@ -3,11 +3,8 @@
namespace App\Form;
use App\Entity\Assignment;
use App\Entity\Destination;
use App\Entity\JobProfile;
use App\Entity\User;
use App\Model\AssignmentFilterDto;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Bundle\SecurityBundle\Security;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
+5 -8
View File
@@ -6,18 +6,14 @@ use App\Entity\Assignment;
use App\Entity\Destination;
use App\Entity\Fee;
use App\Entity\JobProfile;
use App\Entity\Upload;
use App\Entity\User;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
@@ -49,7 +45,7 @@ class AssignmentType extends AbstractType
'label' => 'Destination',
'class' => Destination::class,
'label_property' => 'product',
'label_function' => fn(Destination $destination) => (string) $destination,
'label_function' => fn (Destination $destination) => (string) $destination,
'endpoint_route' => 'app_admin_autocomplete_destination',
'attr' => [
'hx-post' => $options['pickup_form_url'],
@@ -66,7 +62,7 @@ class AssignmentType extends AbstractType
'query_builder' => function (EntityRepository $repository) {
return $repository->createQueryBuilder('job_profile')
->where('job_profile.deletedAt IS NULL');
}
},
])
->add('jobProfileInfo', TextareaType::class, [
'label' => 'Zusatzinfos',
@@ -106,6 +102,7 @@ class AssignmentType extends AbstractType
},
'query_builder' => function (EntityRepository $repository) {
$qb = $repository->createQueryBuilder('fee');
return $qb->where($qb->expr()->isNull('fee.deletedAt'));
},
'multiple' => true,
@@ -120,7 +117,7 @@ class AssignmentType extends AbstractType
return $qb
->where($qb->expr()->like('user.roles', ':role'))
->setParameter('role','%ROLE_MANAGER%')
->setParameter('role', '%ROLE_MANAGER%')
->orderBy('user.firstName', 'ASC')
;
},
@@ -130,7 +127,7 @@ class AssignmentType extends AbstractType
'required' => false,
'attr' => [
'data-controller' => 'textarea-autosize',
'data-action' => 'textarea-autosize#resize'
'data-action' => 'textarea-autosize#resize',
],
])
->add('pickup', ChoiceType::class, [
+1 -1
View File
@@ -15,7 +15,7 @@ class AutocompleteEntityType extends AbstractType
{
public function __construct(
private readonly EntityManagerInterface $entityManager,
private readonly UrlGeneratorInterface $urlGenerator
private readonly UrlGeneratorInterface $urlGenerator,
) {
}
+1 -1
View File
@@ -35,4 +35,4 @@ class AvailabilityType extends AbstractType
'anti_xss' => true,
]);
}
}
}
+3 -2
View File
@@ -13,7 +13,8 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
class BpnCountryType extends AbstractType
{
public function __construct(private readonly CountryDataProvider $countries)
{}
{
}
public function getParent(): string
{
@@ -35,4 +36,4 @@ class BpnCountryType extends AbstractType
},
]);
}
}
}
+3 -2
View File
@@ -11,7 +11,8 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
class BpnPickupType extends AbstractType
{
public function __construct(private readonly PickupDataProvider $pickups)
{}
{
}
public function getParent(): string
{
@@ -35,4 +36,4 @@ class BpnPickupType extends AbstractType
'placeholder' => 'Bitte wählen...',
]);
}
}
}
@@ -11,9 +11,10 @@ use Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface;
class BpnCountryChoiceLoader implements ChoiceLoaderInterface
{
public function __construct(private readonly CountryDataProvider $countries, private readonly string $property)
{}
{
}
public function loadChoiceList(callable $value = null): ChoiceListInterface
public function loadChoiceList(?callable $value = null): ChoiceListInterface
{
$choices = [];
/** @var Country[] $countries */
@@ -25,16 +26,15 @@ class BpnCountryChoiceLoader implements ChoiceLoaderInterface
}
return new ArrayChoiceList($choices);
}
public function loadChoicesForValues(array $values, callable $value = null): array
public function loadChoicesForValues(array $values, ?callable $value = null): array
{
return $values;
}
public function loadValuesForChoices(array $choices, callable $value = null): array
public function loadValuesForChoices(array $choices, ?callable $value = null): array
{
return $choices;
}
}
}
@@ -11,9 +11,10 @@ use Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface;
class BpnHotelChoiceLoader implements ChoiceLoaderInterface
{
public function __construct(private readonly HotelDataProvider $dataProvider)
{}
{
}
public function loadChoiceList(callable $value = null): ChoiceListInterface
public function loadChoiceList(?callable $value = null): ChoiceListInterface
{
$choices = [];
/** @var Hotel[] $hotels */
@@ -27,16 +28,15 @@ class BpnHotelChoiceLoader implements ChoiceLoaderInterface
ksort($choices);
return new ArrayChoiceList($choices);
}
public function loadChoicesForValues(array $values, callable $value = null): array
public function loadChoicesForValues(array $values, ?callable $value = null): array
{
return $values;
}
public function loadValuesForChoices(array $choices, callable $value = null): array
public function loadValuesForChoices(array $choices, ?callable $value = null): array
{
return $choices;
}
}
}
@@ -11,9 +11,10 @@ use Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface;
class BpnPickupChoiceLoader implements ChoiceLoaderInterface
{
public function __construct(private readonly PickupDataProvider $dataProvider)
{}
{
}
public function loadChoiceList(callable $value = null): ChoiceListInterface
public function loadChoiceList(?callable $value = null): ChoiceListInterface
{
$choices = [];
/** @var Pickup[] $pickups */
@@ -26,16 +27,15 @@ class BpnPickupChoiceLoader implements ChoiceLoaderInterface
ksort($choices);
return new ArrayChoiceList($choices);
}
public function loadChoicesForValues(array $values, callable $value = null): array
public function loadChoicesForValues(array $values, ?callable $value = null): array
{
return $values;
}
public function loadValuesForChoices(array $choices, callable $value = null): array
public function loadValuesForChoices(array $choices, ?callable $value = null): array
{
return $choices;
}
}
}
+1 -1
View File
@@ -33,4 +33,4 @@ class CommunicationType extends AbstractType
'anti_xss' => true,
]);
}
}
}
+1 -2
View File
@@ -40,7 +40,6 @@ class ContactType extends AbstractType
;
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver
@@ -52,4 +51,4 @@ class ContactType extends AbstractType
->setAllowedTypes('upload_session', UploadSessionDto::class)
;
}
}
}
@@ -13,7 +13,7 @@ class EntityToIdentifierTransformer implements DataTransformerInterface
public function __construct(
private readonly EntityManagerInterface $entityManager,
private readonly string $class,
string $identifier = 'id'
string $identifier = 'id',
) {
if (false === in_array($identifier, ['id', 'uuid'])) {
throw new \InvalidArgumentException(sprintf('Identifier must be one of "id" or "uuid" got "%s"', $identifier));
@@ -30,4 +30,4 @@ class FeedbackToRatingsTransformer implements DataTransformerInterface
return $feedbackRatings;
}
}
}
+1 -1
View File
@@ -47,4 +47,4 @@ class DestinationFilterType extends AbstractType
'data_class' => DestinationFilterDto::class,
]);
}
}
}
+1 -1
View File
@@ -67,4 +67,4 @@ class DocumentCheckType extends AbstractType
->setAllowedValues('document_type', [Upload::TYPE_INVOICE, Upload::TYPE_CONTRACT])
;
}
}
}
+2 -2
View File
@@ -32,7 +32,7 @@ class DocumentFilterType extends AbstractType
'label' => 'Teamer',
'class' => Teamer::class,
'label_property' => 'name',
'label_function' => fn(Teamer $teamer) => (string) $teamer,
'label_function' => fn (Teamer $teamer) => (string) $teamer,
'endpoint_route' => 'app_admin_autocomplete_teamer',
])
->add('type', ChoiceType::class, [
@@ -100,4 +100,4 @@ class DocumentFilterType extends AbstractType
])
;
}
}
}
+1 -1
View File
@@ -30,4 +30,4 @@ class FaqType extends AbstractType
'anti_xss' => true,
]);
}
}
}
+1 -1
View File
@@ -35,4 +35,4 @@ class FeeType extends AbstractType
'anti_xss' => true,
]);
}
}
}
+1 -1
View File
@@ -36,4 +36,4 @@ class FeedbackApproveType extends AbstractType
'data_class' => Feedback::class,
]);
}
}
}
+1 -1
View File
@@ -56,4 +56,4 @@ class FeedbackFilterType extends AbstractType
])
;
}
}
}
+2 -2
View File
@@ -18,7 +18,7 @@ class FeedbackRatingsType extends AbstractType
foreach ($ratings as $index => $rating) {
$builder->add('rating_'.$index, ChoiceType::class, [
'label' => $rating,
'choices' => array_combine(range(5, 1), range(5,1)),
'choices' => array_combine(range(5, 1), range(5, 1)),
]);
}
@@ -34,4 +34,4 @@ class FeedbackRatingsType extends AbstractType
->setAllowedTypes('feedback_set', FeedbackSet::class)
;
}
}
}
+1 -1
View File
@@ -33,4 +33,4 @@ class FeedbackSetType extends AbstractType
'data_class' => FeedbackSet::class,
]);
}
}
}
+1 -1
View File
@@ -47,4 +47,4 @@ class FeedbackType extends AbstractType
->setAllowedTypes('feedback_set', FeedbackSet::class)
;
}
}
}
+2 -2
View File
@@ -26,7 +26,7 @@ class LicenseType extends AbstractType
])
->add('date', AbbreviatedDateType::class, [
'label' => 'Datum',
'years' => range((int) date('Y'), (int) date('Y') - 15)
'years' => range((int) date('Y'), (int) date('Y') - 15),
])
;
}
@@ -50,4 +50,4 @@ class LicenseType extends AbstractType
->setAllowedTypes('upload_session', UploadSessionDto::class)
;
}
}
}
+1 -1
View File
@@ -33,4 +33,4 @@ class MultiselectEntityType extends AbstractType
{
return 'multiselect';
}
}
}
+1 -1
View File
@@ -33,4 +33,4 @@ class MultiselectType extends AbstractType
{
return 'multiselect';
}
}
}
+1 -1
View File
@@ -37,4 +37,4 @@ class NewsType extends AbstractType
'data_class' => News::class,
]);
}
}
}
+3 -3
View File
@@ -17,8 +17,8 @@ class SpecialAgreementsType extends AbstractType
'required' => false,
'attr' => [
'data-controller' => 'textarea-autosize',
'data-action' => 'textarea-autosize#resize'
]
'data-action' => 'textarea-autosize#resize',
],
]);
}
@@ -28,4 +28,4 @@ class SpecialAgreementsType extends AbstractType
'data_class' => Disposition::class,
]);
}
}
}
+1 -1
View File
@@ -75,4 +75,4 @@ class TeamerApplicationType extends AbstractType
'anti_xss' => true,
]);
}
}
}
+1 -1
View File
@@ -43,4 +43,4 @@ class TeamerDispositionType extends AbstractType
'enable_pickup' => false,
]);
}
}
}
+1 -2
View File
@@ -5,7 +5,6 @@ namespace App\Form;
use App\Entity\JobProfile;
use App\Model\TeamerFilterDto;
use Doctrine\ORM\EntityRepository;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
@@ -69,4 +68,4 @@ class TeamerFilterType extends AbstractType
])
;
}
}
}
+4 -3
View File
@@ -23,7 +23,7 @@ class TeamerJobProfileType extends AbstractType
'label' => false,
'class' => JobProfile::class,
// Append potential training or license requirements to profile labels
'choice_label' => function($choice, string $key, mixed $value): TranslatableMessage|string {
'choice_label' => function ($choice, string $key, mixed $value): TranslatableMessage|string {
/** @var JobProfile $choice */
$label = $choice->getName();
$requirements = [];
@@ -43,7 +43,7 @@ class TeamerJobProfileType extends AbstractType
},
// Set disabled attribute on profiles that require a training or licenses the teamer doesnt have
// unless in admin mode
'choice_attr' => function($choice, string $key, mixed $value) use ($options) {
'choice_attr' => function ($choice, string $key, mixed $value) use ($options) {
$selectableProfiles = $options['selectable_job_profiles'];
$isAdminMode = $options['admin_mode'];
@@ -55,6 +55,7 @@ class TeamerJobProfileType extends AbstractType
},
'query_builder' => function (EntityRepository $repository) {
$qb = $repository->createQueryBuilder('job_profile');
return $qb->where($qb->expr()->isNull('job_profile.deletedAt'));
},
'expanded' => true,
@@ -87,4 +88,4 @@ class TeamerJobProfileType extends AbstractType
'anti_xss' => true,
]);
}
}
}
+2 -3
View File
@@ -9,7 +9,6 @@ use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\BirthdayType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormInterface;
@@ -40,7 +39,7 @@ class TeamerProfileType extends AbstractType
->add('firstName', TextType::class, [
'label' => 'Vorname',
])
->add('lastName', TextType::class,[
->add('lastName', TextType::class, [
'label' => 'Nachname',
])
->add('academicTitle', TextType::class, [
@@ -120,4 +119,4 @@ class TeamerProfileType extends AbstractType
->setAllowedTypes('upload_session', UploadSessionDto::class)
;
}
}
}
+1 -1
View File
@@ -13,7 +13,7 @@ class TimelineFilterType extends AbstractType
{
public function __construct(
private readonly TimelineService $timelineService,
private readonly array $destinations
private readonly array $destinations,
) {
}
+1 -1
View File
@@ -26,4 +26,4 @@ class TrainingType extends AbstractType
'anti_xss' => true,
]);
}
}
}