Release 2.20.0 (#4987)

This commit is contained in:
Kevin Papst
2024-08-04 18:22:27 +02:00
committed by GitHub
parent 0947b88d36
commit ff6a3e8262
101 changed files with 441 additions and 458 deletions

View File

@@ -30,7 +30,7 @@ final class ColorPickerType extends AbstractType implements DataTransformerInter
$resolver->setDefaults([
'documentation' => [
'type' => 'string',
'description' => sprintf('The hexadecimal color code (default: %s)', self::DEFAULT_COLOR),
'description' => \sprintf('The hexadecimal color code (default: %s)', self::DEFAULT_COLOR),
],
'label' => 'color',
'empty_data' => null,

View File

@@ -49,7 +49,8 @@ final class DateRangeType extends AbstractType
'max_day' => null,
'locale' => \Locale::getDefault(),
]);
$resolver->addAllowedTypes('timezone', ['string']);
$resolver->setAllowedTypes('separator', 'string');
$resolver->addAllowedTypes('timezone', 'string');
$resolver->addAllowedTypes('min_day', ['null', 'string', \DateTimeInterface::class]);
$resolver->addAllowedTypes('max_day', ['null', 'string', \DateTimeInterface::class]);
@@ -59,6 +60,7 @@ final class DateRangeType extends AbstractType
return $converter->convert($format);
});
$resolver->setAllowedTypes('format', ['string']);
$resolver->setDefault('attr', function (Options $options): array {
$format = $this->localeService->getDateFormat($options['locale']);
@@ -115,7 +117,10 @@ final class DateRangeType extends AbstractType
}
}
public function buildForm(FormBuilderInterface $builder, array $options): void
/**
* @param array{'format': non-empty-string, 'separator': non-empty-string, 'allow_empty': true, 'timezone': non-empty-string} $options
*/
public function buildForm(FormBuilderInterface $builder, array $options): void // @phpstan-ignore-line
{
$formatDate = $options['format'];
$separator = $options['separator'];

View File

@@ -34,6 +34,7 @@ final class DurationType extends AbstractType
'max_hours' => 24,
'icon' => 'clock',
]);
$resolver->setAllowedTypes('max_hours', 'int');
}
public function buildView(FormView $view, FormInterface $form, array $options): void
@@ -54,7 +55,7 @@ final class DurationType extends AbstractType
}
// we track times for humans and no entry should ever be that long
if ($maxHours > $options['max_hours']) {
if (\is_int($options['max_hours']) && $maxHours > $options['max_hours']) {
$maxHours = $options['max_hours'];
}

View File

@@ -36,7 +36,7 @@ final class UserLocaleType extends AbstractType
$resolver->setDefaults([
'label' => 'locale',
'help_html' => true,
'help' => sprintf('<a href="%1$s" target="help_locales">%2$s</a>', $route, $moreLink)
'help' => \sprintf('<a href="%1$s" target="help_locales">%2$s</a>', $route, $moreLink)
]);
}