mirror of
https://github.com/symfony/form.git
synced 2026-03-24 00:02:23 +01:00
[CS] Remove @inheritdoc PHPDoc
This commit is contained in:
@@ -43,9 +43,6 @@ abstract class AbstractExtension implements FormExtensionInterface
|
||||
*/
|
||||
private bool $typeGuesserLoaded = false;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getType(string $name): FormTypeInterface
|
||||
{
|
||||
if (!isset($this->types)) {
|
||||
@@ -59,9 +56,6 @@ abstract class AbstractExtension implements FormExtensionInterface
|
||||
return $this->types[$name];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function hasType(string $name): bool
|
||||
{
|
||||
if (!isset($this->types)) {
|
||||
@@ -71,9 +65,6 @@ abstract class AbstractExtension implements FormExtensionInterface
|
||||
return isset($this->types[$name]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getTypeExtensions(string $name): array
|
||||
{
|
||||
if (!isset($this->typeExtensions)) {
|
||||
@@ -84,9 +75,6 @@ abstract class AbstractExtension implements FormExtensionInterface
|
||||
?? [];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function hasTypeExtensions(string $name): bool
|
||||
{
|
||||
if (!isset($this->typeExtensions)) {
|
||||
@@ -96,9 +84,6 @@ abstract class AbstractExtension implements FormExtensionInterface
|
||||
return isset($this->typeExtensions[$name]) && \count($this->typeExtensions[$name]) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getTypeGuesser(): ?FormTypeGuesserInterface
|
||||
{
|
||||
if (!$this->typeGuesserLoaded) {
|
||||
|
||||
@@ -61,9 +61,6 @@ abstract class AbstractRendererEngine implements FormRendererEngineInterface, Re
|
||||
$this->defaultThemes = $defaultThemes;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setTheme(FormView $view, mixed $themes, bool $useDefaultThemes = true)
|
||||
{
|
||||
$cacheKey = $view->vars[self::CACHE_KEY_VAR];
|
||||
@@ -78,9 +75,6 @@ abstract class AbstractRendererEngine implements FormRendererEngineInterface, Re
|
||||
unset($this->resources[$cacheKey], $this->resourceHierarchyLevels[$cacheKey]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getResourceForBlockName(FormView $view, string $blockName): mixed
|
||||
{
|
||||
$cacheKey = $view->vars[self::CACHE_KEY_VAR];
|
||||
@@ -92,9 +86,6 @@ abstract class AbstractRendererEngine implements FormRendererEngineInterface, Re
|
||||
return $this->resources[$cacheKey][$blockName];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getResourceForBlockNameHierarchy(FormView $view, array $blockNameHierarchy, int $hierarchyLevel): mixed
|
||||
{
|
||||
$cacheKey = $view->vars[self::CACHE_KEY_VAR];
|
||||
@@ -107,9 +98,6 @@ abstract class AbstractRendererEngine implements FormRendererEngineInterface, Re
|
||||
return $this->resources[$cacheKey][$blockName];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getResourceHierarchyLevel(FormView $view, array $blockNameHierarchy, int $hierarchyLevel): int|false
|
||||
{
|
||||
$cacheKey = $view->vars[self::CACHE_KEY_VAR];
|
||||
|
||||
@@ -20,45 +20,27 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
*/
|
||||
abstract class AbstractType implements FormTypeInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildView(FormView $view, FormInterface $form, array $options)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function finishView(FormView $view, FormInterface $form, array $options)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getBlockPrefix()
|
||||
{
|
||||
return StringUtil::fqcnToBlockPrefix(static::class) ?: '';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getParent()
|
||||
{
|
||||
return FormType::class;
|
||||
|
||||
@@ -18,30 +18,18 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
*/
|
||||
abstract class AbstractTypeExtension implements FormTypeExtensionInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildView(FormView $view, FormInterface $form, array $options)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function finishView(FormView $view, FormInterface $form, array $options)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
}
|
||||
|
||||
24
Button.php
24
Button.php
@@ -81,9 +81,6 @@ class Button implements \IteratorAggregate, FormInterface
|
||||
throw new BadMethodCallException('Buttons cannot have children.');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setParent(FormInterface $parent = null): static
|
||||
{
|
||||
if ($this->submitted) {
|
||||
@@ -95,9 +92,6 @@ class Button implements \IteratorAggregate, FormInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getParent(): ?FormInterface
|
||||
{
|
||||
return $this->parent;
|
||||
@@ -147,17 +141,11 @@ class Button implements \IteratorAggregate, FormInterface
|
||||
throw new BadMethodCallException('Buttons cannot have children.');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function all(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getErrors(bool $deep = false, bool $flatten = true): FormErrorIterator
|
||||
{
|
||||
return new FormErrorIterator($this, []);
|
||||
@@ -266,9 +254,6 @@ class Button implements \IteratorAggregate, FormInterface
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isDisabled(): bool
|
||||
{
|
||||
if ($this->parent?->isDisabled()) {
|
||||
@@ -340,25 +325,16 @@ class Button implements \IteratorAggregate, FormInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getRoot(): FormInterface
|
||||
{
|
||||
return $this->parent ? $this->parent->getRoot() : $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isRoot(): bool
|
||||
{
|
||||
return null === $this->parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function createView(FormView $parent = null): FormView
|
||||
{
|
||||
if (null === $parent && $this->parent) {
|
||||
|
||||
@@ -173,9 +173,6 @@ class ButtonBuilder implements \IteratorAggregate, FormBuilderInterface
|
||||
throw new BadMethodCallException('Buttons do not support data transformers.');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setAttribute(string $name, mixed $value): static
|
||||
{
|
||||
$this->attributes[$name] = $value;
|
||||
@@ -183,9 +180,6 @@ class ButtonBuilder implements \IteratorAggregate, FormBuilderInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setAttributes(array $attributes): static
|
||||
{
|
||||
$this->attributes = $attributes;
|
||||
@@ -415,9 +409,6 @@ class ButtonBuilder implements \IteratorAggregate, FormBuilderInterface
|
||||
throw new BadMethodCallException('Buttons do not support event dispatching.');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName(): string
|
||||
{
|
||||
return $this->name;
|
||||
|
||||
@@ -22,17 +22,11 @@ class CallbackTransformer implements DataTransformerInterface
|
||||
$this->reverseTransform = $reverseTransform(...);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function transform(mixed $data): mixed
|
||||
{
|
||||
return ($this->transform)($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function reverseTransform(mixed $data): mixed
|
||||
{
|
||||
return ($this->reverseTransform)($data);
|
||||
|
||||
@@ -90,41 +90,26 @@ class ArrayChoiceList implements ChoiceListInterface
|
||||
$this->structuredValues = $structuredValues;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getChoices(): array
|
||||
{
|
||||
return $this->choices;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getValues(): array
|
||||
{
|
||||
return array_map('strval', array_keys($this->choices));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getStructuredValues(): array
|
||||
{
|
||||
return $this->structuredValues;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getOriginalKeys(): array
|
||||
{
|
||||
return $this->originalKeys;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getChoicesForValues(array $values): array
|
||||
{
|
||||
$choices = [];
|
||||
@@ -138,9 +123,6 @@ class ArrayChoiceList implements ChoiceListInterface
|
||||
return $choices;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getValuesForChoices(array $choices): array
|
||||
{
|
||||
$values = [];
|
||||
|
||||
@@ -26,25 +26,16 @@ use Symfony\Component\Form\FormTypeInterface;
|
||||
*/
|
||||
final class ChoiceLoader extends AbstractStaticOption implements ChoiceLoaderInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function loadChoiceList(callable $value = null): ChoiceListInterface
|
||||
{
|
||||
return $this->getOption()->loadChoiceList($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function loadChoicesForValues(array $values, callable $value = null): array
|
||||
{
|
||||
return $this->getOption()->loadChoicesForValues($values, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function loadValuesForChoices(array $choices, callable $value = null): array
|
||||
{
|
||||
return $this->getOption()->loadValuesForChoices($choices, $value);
|
||||
|
||||
@@ -77,9 +77,6 @@ class CachingFactoryDecorator implements ChoiceListFactoryInterface, ResetInterf
|
||||
return $this->decoratedFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function createListFromChoices(iterable $choices, mixed $value = null, mixed $filter = null): ChoiceListInterface
|
||||
{
|
||||
if ($choices instanceof \Traversable) {
|
||||
@@ -113,9 +110,6 @@ class CachingFactoryDecorator implements ChoiceListFactoryInterface, ResetInterf
|
||||
return $this->lists[$hash];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function createListFromLoader(ChoiceLoaderInterface $loader, mixed $value = null, mixed $filter = null): ChoiceListInterface
|
||||
{
|
||||
$cache = true;
|
||||
@@ -151,9 +145,6 @@ class CachingFactoryDecorator implements ChoiceListFactoryInterface, ResetInterf
|
||||
return $this->lists[$hash];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function createView(ChoiceListInterface $list, mixed $preferredChoices = null, mixed $label = null, mixed $index = null, mixed $groupBy = null, mixed $attr = null, mixed $labelTranslationParameters = []): ChoiceListView
|
||||
{
|
||||
$cache = true;
|
||||
|
||||
@@ -30,9 +30,6 @@ use Symfony\Contracts\Translation\TranslatableInterface;
|
||||
*/
|
||||
class DefaultChoiceListFactory implements ChoiceListFactoryInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function createListFromChoices(iterable $choices, callable $value = null, callable $filter = null): ChoiceListInterface
|
||||
{
|
||||
if ($filter) {
|
||||
@@ -47,9 +44,6 @@ class DefaultChoiceListFactory implements ChoiceListFactoryInterface
|
||||
return new ArrayChoiceList($choices, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function createListFromLoader(ChoiceLoaderInterface $loader, callable $value = null, callable $filter = null): ChoiceListInterface
|
||||
{
|
||||
if ($filter) {
|
||||
@@ -59,9 +53,6 @@ class DefaultChoiceListFactory implements ChoiceListFactoryInterface
|
||||
return new LazyChoiceList($loader, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function createView(ChoiceListInterface $list, array|callable $preferredChoices = null, callable|false $label = null, callable $index = null, callable $groupBy = null, array|callable $attr = null, array|callable $labelTranslationParameters = []): ChoiceListView
|
||||
{
|
||||
$preferredViews = [];
|
||||
|
||||
@@ -55,9 +55,6 @@ class PropertyAccessDecorator implements ChoiceListFactoryInterface
|
||||
return $this->decoratedFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function createListFromChoices(iterable $choices, mixed $value = null, mixed $filter = null): ChoiceListInterface
|
||||
{
|
||||
if (\is_string($value)) {
|
||||
@@ -89,9 +86,6 @@ class PropertyAccessDecorator implements ChoiceListFactoryInterface
|
||||
return $this->decoratedFactory->createListFromChoices($choices, $value, $filter);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function createListFromLoader(ChoiceLoaderInterface $loader, mixed $value = null, mixed $filter = null): ChoiceListInterface
|
||||
{
|
||||
if (\is_string($value)) {
|
||||
@@ -123,9 +117,6 @@ class PropertyAccessDecorator implements ChoiceListFactoryInterface
|
||||
return $this->decoratedFactory->createListFromLoader($loader, $value, $filter);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function createView(ChoiceListInterface $list, mixed $preferredChoices = null, mixed $label = null, mixed $index = null, mixed $groupBy = null, mixed $attr = null, mixed $labelTranslationParameters = []): ChoiceListView
|
||||
{
|
||||
$accessor = $this->propertyAccessor;
|
||||
|
||||
@@ -51,49 +51,31 @@ class LazyChoiceList implements ChoiceListInterface
|
||||
$this->value = null === $value ? null : $value(...);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getChoices(): array
|
||||
{
|
||||
return $this->loader->loadChoiceList($this->value)->getChoices();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getValues(): array
|
||||
{
|
||||
return $this->loader->loadChoiceList($this->value)->getValues();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getStructuredValues(): array
|
||||
{
|
||||
return $this->loader->loadChoiceList($this->value)->getStructuredValues();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getOriginalKeys(): array
|
||||
{
|
||||
return $this->loader->loadChoiceList($this->value)->getOriginalKeys();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getChoicesForValues(array $values): array
|
||||
{
|
||||
return $this->loader->loadChoicesForValues($values, $this->value);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getValuesForChoices(array $choices): array
|
||||
{
|
||||
return $this->loader->loadValuesForChoices($choices, $this->value);
|
||||
|
||||
@@ -23,17 +23,12 @@ abstract class AbstractChoiceLoader implements ChoiceLoaderInterface
|
||||
|
||||
/**
|
||||
* @final
|
||||
*
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function loadChoiceList(callable $value = null): ChoiceListInterface
|
||||
{
|
||||
return new ArrayChoiceList($this->choices ??= $this->loadChoices(), $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function loadChoicesForValues(array $values, callable $value = null): array
|
||||
{
|
||||
if (!$values) {
|
||||
@@ -43,9 +38,6 @@ abstract class AbstractChoiceLoader implements ChoiceLoaderInterface
|
||||
return $this->doLoadChoicesForValues($values, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function loadValuesForChoices(array $choices, callable $value = null): array
|
||||
{
|
||||
if (!$choices) {
|
||||
|
||||
@@ -52,17 +52,11 @@ class FilterChoiceLoaderDecorator extends AbstractChoiceLoader
|
||||
return $choices ?? [];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function loadChoicesForValues(array $values, callable $value = null): array
|
||||
{
|
||||
return array_filter($this->decoratedLoader->loadChoicesForValues($values, $value), $this->filter);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function loadValuesForChoices(array $choices, callable $value = null): array
|
||||
{
|
||||
return $this->decoratedLoader->loadValuesForChoices(array_filter($choices, $this->filter), $value);
|
||||
|
||||
@@ -19,17 +19,11 @@ namespace Symfony\Component\Form\ChoiceList\Loader;
|
||||
*/
|
||||
class IntlCallbackChoiceLoader extends CallbackChoiceLoader
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function loadChoicesForValues(array $values, callable $value = null): array
|
||||
{
|
||||
return parent::loadChoicesForValues(array_filter($values), $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function loadValuesForChoices(array $choices, callable $value = null): array
|
||||
{
|
||||
$choices = array_filter($choices);
|
||||
|
||||
@@ -35,8 +35,6 @@ class ChoiceGroupView implements \IteratorAggregate
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @return \Traversable<array-key, ChoiceGroupView|ChoiceView>
|
||||
*/
|
||||
public function getIterator(): \Traversable
|
||||
|
||||
@@ -54,9 +54,6 @@ class DebugCommand extends Command
|
||||
$this->fileLinkFormatter = $fileLinkFormatter;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
$this
|
||||
@@ -98,9 +95,6 @@ EOF
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
$io = new SymfonyStyle($input, $output);
|
||||
|
||||
@@ -40,9 +40,6 @@ abstract class Descriptor implements DescriptorInterface
|
||||
protected $parents = [];
|
||||
protected $extensions = [];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function describe(OutputInterface $output, ?object $object, array $options = [])
|
||||
{
|
||||
$this->output = $output instanceof OutputStyle ? $output : new SymfonyStyle(new ArrayInput([]), $output);
|
||||
|
||||
@@ -22,9 +22,6 @@ use Symfony\Component\Form\FormInterface;
|
||||
*/
|
||||
class CallbackAccessor implements DataAccessorInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getValue(object|array $data, FormInterface $form): mixed
|
||||
{
|
||||
if (null === $getter = $form->getConfig()->getOption('getter')) {
|
||||
@@ -34,9 +31,6 @@ class CallbackAccessor implements DataAccessorInterface
|
||||
return ($getter)($data, $form);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setValue(object|array &$data, mixed $value, FormInterface $form): void
|
||||
{
|
||||
if (null === $setter = $form->getConfig()->getOption('setter')) {
|
||||
@@ -46,17 +40,11 @@ class CallbackAccessor implements DataAccessorInterface
|
||||
($setter)($data, $form->getData(), $form);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isReadable(object|array $data, FormInterface $form): bool
|
||||
{
|
||||
return null !== $form->getConfig()->getOption('getter');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isWritable(object|array $data, FormInterface $form): bool
|
||||
{
|
||||
return null !== $form->getConfig()->getOption('setter');
|
||||
|
||||
@@ -30,9 +30,6 @@ class ChainAccessor implements DataAccessorInterface
|
||||
$this->accessors = $accessors;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getValue(object|array $data, FormInterface $form): mixed
|
||||
{
|
||||
foreach ($this->accessors as $accessor) {
|
||||
@@ -44,9 +41,6 @@ class ChainAccessor implements DataAccessorInterface
|
||||
throw new AccessException('Unable to read from the given form data as no accessor in the chain is able to read the data.');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setValue(object|array &$data, mixed $value, FormInterface $form): void
|
||||
{
|
||||
foreach ($this->accessors as $accessor) {
|
||||
@@ -60,9 +54,6 @@ class ChainAccessor implements DataAccessorInterface
|
||||
throw new AccessException('Unable to write the given value as no accessor in the chain is able to set the data.');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isReadable(object|array $data, FormInterface $form): bool
|
||||
{
|
||||
foreach ($this->accessors as $accessor) {
|
||||
@@ -74,9 +65,6 @@ class ChainAccessor implements DataAccessorInterface
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isWritable(object|array $data, FormInterface $form): bool
|
||||
{
|
||||
foreach ($this->accessors as $accessor) {
|
||||
|
||||
@@ -36,9 +36,6 @@ class PropertyPathAccessor implements DataAccessorInterface
|
||||
$this->propertyAccessor = $propertyAccessor ?? PropertyAccess::createPropertyAccessor();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getValue(object|array $data, FormInterface $form): mixed
|
||||
{
|
||||
if (null === $propertyPath = $form->getPropertyPath()) {
|
||||
@@ -48,9 +45,6 @@ class PropertyPathAccessor implements DataAccessorInterface
|
||||
return $this->getPropertyValue($data, $propertyPath);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setValue(object|array &$data, mixed $value, FormInterface $form): void
|
||||
{
|
||||
if (null === $propertyPath = $form->getPropertyPath()) {
|
||||
@@ -70,17 +64,11 @@ class PropertyPathAccessor implements DataAccessorInterface
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isReadable(object|array $data, FormInterface $form): bool
|
||||
{
|
||||
return null !== $form->getPropertyPath();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isWritable(object|array $data, FormInterface $form): bool
|
||||
{
|
||||
return null !== $form->getPropertyPath();
|
||||
|
||||
@@ -25,9 +25,6 @@ use Symfony\Component\Form\Exception\UnexpectedTypeException;
|
||||
*/
|
||||
class CheckboxListMapper implements DataMapperInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function mapDataToForms(mixed $choices, \Traversable $checkboxes)
|
||||
{
|
||||
if (null === $choices) {
|
||||
@@ -44,9 +41,6 @@ class CheckboxListMapper implements DataMapperInterface
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function mapFormsToData(\Traversable $checkboxes, mixed &$choices)
|
||||
{
|
||||
if (!\is_array($choices)) {
|
||||
|
||||
@@ -35,9 +35,6 @@ class DataMapper implements DataMapperInterface
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function mapDataToForms(mixed $data, \Traversable $forms): void
|
||||
{
|
||||
$empty = null === $data || [] === $data;
|
||||
@@ -57,9 +54,6 @@ class DataMapper implements DataMapperInterface
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function mapFormsToData(\Traversable $forms, mixed &$data): void
|
||||
{
|
||||
if (null === $data) {
|
||||
|
||||
@@ -25,9 +25,6 @@ use Symfony\Component\Form\Exception\UnexpectedTypeException;
|
||||
*/
|
||||
class RadioListMapper implements DataMapperInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function mapDataToForms(mixed $choice, \Traversable $radios)
|
||||
{
|
||||
if (!\is_string($choice)) {
|
||||
@@ -40,9 +37,6 @@ class RadioListMapper implements DataMapperInterface
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function mapFormsToData(\Traversable $radios, mixed &$choice)
|
||||
{
|
||||
if (null !== $choice && !\is_string($choice)) {
|
||||
|
||||
@@ -28,9 +28,6 @@ class DateTimeZoneToStringTransformer implements DataTransformerInterface
|
||||
$this->multiple = $multiple;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function transform(mixed $dateTimeZone): mixed
|
||||
{
|
||||
if (null === $dateTimeZone) {
|
||||
@@ -52,9 +49,6 @@ class DateTimeZoneToStringTransformer implements DataTransformerInterface
|
||||
return $dateTimeZone->getName();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function reverseTransform(mixed $value): mixed
|
||||
{
|
||||
if (null === $value) {
|
||||
|
||||
@@ -33,9 +33,6 @@ class IntegerToLocalizedStringTransformer extends NumberToLocalizedStringTransfo
|
||||
parent::__construct(0, $grouping, $roundingMode, $locale);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function reverseTransform(mixed $value): int|float|null
|
||||
{
|
||||
$decimalSeparator = $this->getNumberFormatter()->getSymbol(\NumberFormatter::DECIMAL_SEPARATOR_SYMBOL);
|
||||
|
||||
@@ -28,9 +28,6 @@ class IntlTimeZoneToStringTransformer implements DataTransformerInterface
|
||||
$this->multiple = $multiple;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function transform(mixed $intlTimeZone): mixed
|
||||
{
|
||||
if (null === $intlTimeZone) {
|
||||
@@ -52,9 +49,6 @@ class IntlTimeZoneToStringTransformer implements DataTransformerInterface
|
||||
return $intlTimeZone->getID();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function reverseTransform(mixed $value): mixed
|
||||
{
|
||||
if (null === $value) {
|
||||
|
||||
@@ -28,18 +28,12 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
*/
|
||||
abstract class BaseType extends AbstractType
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$builder->setDisabled($options['disabled']);
|
||||
$builder->setAutoInitialize($options['auto_initialize']);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildView(FormView $view, FormInterface $form, array $options)
|
||||
{
|
||||
$name = $form->getName();
|
||||
@@ -118,9 +112,6 @@ abstract class BaseType extends AbstractType
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
|
||||
@@ -16,9 +16,6 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class BirthdayType extends AbstractType
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
@@ -29,17 +26,11 @@ class BirthdayType extends AbstractType
|
||||
$resolver->setAllowedTypes('years', 'array');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getParent(): ?string
|
||||
{
|
||||
return DateType::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getBlockPrefix(): string
|
||||
{
|
||||
return 'birthday';
|
||||
|
||||
@@ -21,25 +21,16 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
*/
|
||||
class ButtonType extends BaseType implements ButtonTypeInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getParent(): ?string
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getBlockPrefix(): string
|
||||
{
|
||||
return 'button';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
parent::configureOptions($resolver);
|
||||
|
||||
@@ -20,9 +20,6 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class CheckboxType extends AbstractType
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
// Unlike in other types, where the data is NULL by default, it
|
||||
@@ -35,9 +32,6 @@ class CheckboxType extends AbstractType
|
||||
$builder->addViewTransformer(new BooleanToStringTransformer($options['value'], $options['false_values']));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildView(FormView $view, FormInterface $form, array $options)
|
||||
{
|
||||
$view->vars = array_replace($view->vars, [
|
||||
@@ -46,9 +40,6 @@ class CheckboxType extends AbstractType
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$emptyData = function (FormInterface $form, $viewData) {
|
||||
@@ -69,9 +60,6 @@ class CheckboxType extends AbstractType
|
||||
$resolver->setAllowedTypes('false_values', 'array');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getBlockPrefix(): string
|
||||
{
|
||||
return 'checkbox';
|
||||
|
||||
@@ -62,9 +62,6 @@ class ChoiceType extends AbstractType
|
||||
$this->translator = $translator;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$unknownValues = [];
|
||||
@@ -218,9 +215,6 @@ class ChoiceType extends AbstractType
|
||||
}, 256);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildView(FormView $view, FormInterface $form, array $options)
|
||||
{
|
||||
$choiceTranslationDomain = $options['choice_translation_domain'];
|
||||
@@ -277,9 +271,6 @@ class ChoiceType extends AbstractType
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function finishView(FormView $view, FormInterface $form, array $options)
|
||||
{
|
||||
if ($options['expanded']) {
|
||||
@@ -297,9 +288,6 @@ class ChoiceType extends AbstractType
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$emptyData = function (Options $options) {
|
||||
@@ -391,9 +379,6 @@ class ChoiceType extends AbstractType
|
||||
$resolver->setAllowedTypes('group_by', ['null', 'callable', 'string', PropertyPath::class, GroupBy::class]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getBlockPrefix(): string
|
||||
{
|
||||
return 'choice';
|
||||
|
||||
@@ -21,9 +21,6 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class CollectionType extends AbstractType
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
if ($options['allow_add'] && $options['prototype']) {
|
||||
@@ -51,9 +48,6 @@ class CollectionType extends AbstractType
|
||||
$builder->addEventSubscriber($resizeListener);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildView(FormView $view, FormInterface $form, array $options)
|
||||
{
|
||||
$view->vars = array_replace($view->vars, [
|
||||
@@ -67,9 +61,6 @@ class CollectionType extends AbstractType
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function finishView(FormView $view, FormInterface $form, array $options)
|
||||
{
|
||||
$prefixOffset = -2;
|
||||
@@ -101,9 +92,6 @@ class CollectionType extends AbstractType
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$entryOptionsNormalizer = function (Options $options, $value) {
|
||||
@@ -131,9 +119,6 @@ class CollectionType extends AbstractType
|
||||
$resolver->setAllowedTypes('prototype_options', 'array');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getBlockPrefix(): string
|
||||
{
|
||||
return 'collection';
|
||||
|
||||
@@ -33,9 +33,6 @@ class ColorType extends AbstractType
|
||||
$this->translator = $translator;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
if (!$options['html5']) {
|
||||
@@ -62,9 +59,6 @@ class ColorType extends AbstractType
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
@@ -75,17 +69,11 @@ class ColorType extends AbstractType
|
||||
$resolver->setAllowedTypes('html5', 'bool');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getParent(): ?string
|
||||
{
|
||||
return TextType::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getBlockPrefix(): string
|
||||
{
|
||||
return 'color';
|
||||
|
||||
@@ -22,9 +22,6 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class CountryType extends AbstractType
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
@@ -50,17 +47,11 @@ class CountryType extends AbstractType
|
||||
$resolver->setAllowedTypes('alpha3', 'bool');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getParent(): ?string
|
||||
{
|
||||
return ChoiceType::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getBlockPrefix(): string
|
||||
{
|
||||
return 'country';
|
||||
|
||||
@@ -22,9 +22,6 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class CurrencyType extends AbstractType
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
@@ -47,17 +44,11 @@ class CurrencyType extends AbstractType
|
||||
$resolver->setAllowedTypes('choice_translation_locale', ['null', 'string']);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getParent(): ?string
|
||||
{
|
||||
return ChoiceType::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getBlockPrefix(): string
|
||||
{
|
||||
return 'currency';
|
||||
|
||||
@@ -43,9 +43,6 @@ class DateIntervalType extends AbstractType
|
||||
'choice' => ChoiceType::class,
|
||||
];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
if (!$options['with_years'] && !$options['with_months'] && !$options['with_weeks'] && !$options['with_days'] && !$options['with_hours'] && !$options['with_minutes'] && !$options['with_seconds']) {
|
||||
@@ -148,9 +145,6 @@ class DateIntervalType extends AbstractType
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildView(FormView $view, FormInterface $form, array $options)
|
||||
{
|
||||
$vars = [
|
||||
@@ -163,9 +157,6 @@ class DateIntervalType extends AbstractType
|
||||
$view->vars = array_replace($view->vars, $vars);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$compound = function (Options $options) {
|
||||
@@ -277,9 +268,6 @@ class DateIntervalType extends AbstractType
|
||||
$resolver->setAllowedTypes('labels', 'array');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getBlockPrefix(): string
|
||||
{
|
||||
return 'dateinterval';
|
||||
|
||||
@@ -47,9 +47,6 @@ class DateTimeType extends AbstractType
|
||||
\IntlDateFormatter::SHORT,
|
||||
];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$parts = ['year', 'month', 'day', 'hour'];
|
||||
@@ -202,9 +199,6 @@ class DateTimeType extends AbstractType
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildView(FormView $view, FormInterface $form, array $options)
|
||||
{
|
||||
$view->vars['widget'] = $options['widget'];
|
||||
@@ -226,9 +220,6 @@ class DateTimeType extends AbstractType
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$compound = function (Options $options) {
|
||||
@@ -348,9 +339,6 @@ class DateTimeType extends AbstractType
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getBlockPrefix(): string
|
||||
{
|
||||
return 'datetime';
|
||||
|
||||
@@ -43,9 +43,6 @@ class DateType extends AbstractType
|
||||
'choice' => ChoiceType::class,
|
||||
];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$dateFormat = \is_int($options['format']) ? $options['format'] : self::DEFAULT_FORMAT;
|
||||
@@ -182,9 +179,6 @@ class DateType extends AbstractType
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function finishView(FormView $view, FormInterface $form, array $options)
|
||||
{
|
||||
$view->vars['widget'] = $options['widget'];
|
||||
@@ -222,9 +216,6 @@ class DateType extends AbstractType
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$compound = function (Options $options) {
|
||||
@@ -333,9 +324,6 @@ class DateType extends AbstractType
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getBlockPrefix(): string
|
||||
{
|
||||
return 'date';
|
||||
|
||||
@@ -16,9 +16,6 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class EmailType extends AbstractType
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
@@ -26,17 +23,11 @@ class EmailType extends AbstractType
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getParent(): ?string
|
||||
{
|
||||
return TextType::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getBlockPrefix(): string
|
||||
{
|
||||
return 'email';
|
||||
|
||||
@@ -41,9 +41,6 @@ class FileType extends AbstractType
|
||||
$this->translator = $translator;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
// Ensure that submitted data is always an uploaded file or an array of some
|
||||
@@ -85,9 +82,6 @@ class FileType extends AbstractType
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildView(FormView $view, FormInterface $form, array $options)
|
||||
{
|
||||
if ($options['multiple']) {
|
||||
@@ -101,17 +95,11 @@ class FileType extends AbstractType
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function finishView(FormView $view, FormInterface $form, array $options)
|
||||
{
|
||||
$view->vars['multipart'] = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$dataClass = null;
|
||||
@@ -135,9 +123,6 @@ class FileType extends AbstractType
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getBlockPrefix(): string
|
||||
{
|
||||
return 'file';
|
||||
|
||||
@@ -38,9 +38,6 @@ class FormType extends BaseType
|
||||
]));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
parent::buildForm($builder, $options);
|
||||
@@ -69,9 +66,6 @@ class FormType extends BaseType
|
||||
$builder->setIsEmptyCallback($options['is_empty_callback']);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildView(FormView $view, FormInterface $form, array $options)
|
||||
{
|
||||
parent::buildView($view, $form, $options);
|
||||
@@ -122,9 +116,6 @@ class FormType extends BaseType
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function finishView(FormView $view, FormInterface $form, array $options)
|
||||
{
|
||||
$multipart = false;
|
||||
@@ -139,9 +130,6 @@ class FormType extends BaseType
|
||||
$view->vars['multipart'] = $multipart;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
parent::configureOptions($resolver);
|
||||
@@ -232,17 +220,11 @@ class FormType extends BaseType
|
||||
$resolver->setInfo('setter', 'A callable that accepts three arguments (a reference to the view data, the submitted value and the current form field).');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getParent(): ?string
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getBlockPrefix(): string
|
||||
{
|
||||
return 'form';
|
||||
|
||||
@@ -16,9 +16,6 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class HiddenType extends AbstractType
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
@@ -31,9 +28,6 @@ class HiddenType extends AbstractType
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getBlockPrefix(): string
|
||||
{
|
||||
return 'hidden';
|
||||
|
||||
@@ -20,17 +20,11 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class IntegerType extends AbstractType
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$builder->addViewTransformer(new IntegerToLocalizedStringTransformer($options['grouping'], $options['rounding_mode'], !$options['grouping'] ? 'en' : null));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildView(FormView $view, FormInterface $form, array $options)
|
||||
{
|
||||
if ($options['grouping']) {
|
||||
@@ -38,9 +32,6 @@ class IntegerType extends AbstractType
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
@@ -62,9 +53,6 @@ class IntegerType extends AbstractType
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getBlockPrefix(): string
|
||||
{
|
||||
return 'integer';
|
||||
|
||||
@@ -23,9 +23,6 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class LanguageType extends AbstractType
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
@@ -74,17 +71,11 @@ class LanguageType extends AbstractType
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getParent(): ?string
|
||||
{
|
||||
return ChoiceType::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getBlockPrefix(): string
|
||||
{
|
||||
return 'language';
|
||||
|
||||
@@ -22,9 +22,6 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class LocaleType extends AbstractType
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
@@ -47,17 +44,11 @@ class LocaleType extends AbstractType
|
||||
$resolver->setAllowedTypes('choice_translation_locale', ['null', 'string']);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getParent(): ?string
|
||||
{
|
||||
return ChoiceType::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getBlockPrefix(): string
|
||||
{
|
||||
return 'locale';
|
||||
|
||||
@@ -24,9 +24,6 @@ class MoneyType extends AbstractType
|
||||
{
|
||||
protected static $patterns = [];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
// Values used in HTML5 number inputs should be formatted as in "1234.5", ie. 'en' format without grouping,
|
||||
@@ -42,9 +39,6 @@ class MoneyType extends AbstractType
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildView(FormView $view, FormInterface $form, array $options)
|
||||
{
|
||||
$view->vars['money_pattern'] = self::getPattern($options['currency']);
|
||||
@@ -54,9 +48,6 @@ class MoneyType extends AbstractType
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
@@ -93,9 +84,6 @@ class MoneyType extends AbstractType
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getBlockPrefix(): string
|
||||
{
|
||||
return 'money';
|
||||
|
||||
@@ -23,9 +23,6 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class NumberType extends AbstractType
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$builder->addViewTransformer(new NumberToLocalizedStringTransformer(
|
||||
@@ -40,9 +37,6 @@ class NumberType extends AbstractType
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildView(FormView $view, FormInterface $form, array $options)
|
||||
{
|
||||
if ($options['html5']) {
|
||||
@@ -52,9 +46,6 @@ class NumberType extends AbstractType
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
@@ -90,9 +81,6 @@ class NumberType extends AbstractType
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getBlockPrefix(): string
|
||||
{
|
||||
return 'number';
|
||||
|
||||
@@ -18,9 +18,6 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class PasswordType extends AbstractType
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildView(FormView $view, FormInterface $form, array $options)
|
||||
{
|
||||
if ($options['always_empty'] || !$form->isSubmitted()) {
|
||||
@@ -28,9 +25,6 @@ class PasswordType extends AbstractType
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
@@ -40,17 +34,11 @@ class PasswordType extends AbstractType
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getParent(): ?string
|
||||
{
|
||||
return TextType::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getBlockPrefix(): string
|
||||
{
|
||||
return 'password';
|
||||
|
||||
@@ -20,9 +20,6 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class PercentType extends AbstractType
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$builder->addViewTransformer(new PercentToLocalizedStringTransformer(
|
||||
@@ -33,9 +30,6 @@ class PercentType extends AbstractType
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildView(FormView $view, FormInterface $form, array $options)
|
||||
{
|
||||
$view->vars['symbol'] = $options['symbol'];
|
||||
@@ -45,9 +39,6 @@ class PercentType extends AbstractType
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
@@ -78,9 +69,6 @@ class PercentType extends AbstractType
|
||||
$resolver->setAllowedTypes('html5', 'bool');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getBlockPrefix(): string
|
||||
{
|
||||
return 'percent';
|
||||
|
||||
@@ -16,9 +16,6 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class RadioType extends AbstractType
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
@@ -26,17 +23,11 @@ class RadioType extends AbstractType
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getParent(): ?string
|
||||
{
|
||||
return CheckboxType::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getBlockPrefix(): string
|
||||
{
|
||||
return 'radio';
|
||||
|
||||
@@ -16,9 +16,6 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class RangeType extends AbstractType
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
@@ -26,17 +23,11 @@ class RangeType extends AbstractType
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getParent(): ?string
|
||||
{
|
||||
return TextType::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getBlockPrefix(): string
|
||||
{
|
||||
return 'range';
|
||||
|
||||
@@ -18,9 +18,6 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class RepeatedType extends AbstractType
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
// Overwrite required option for child fields
|
||||
@@ -44,9 +41,6 @@ class RepeatedType extends AbstractType
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
@@ -65,9 +59,6 @@ class RepeatedType extends AbstractType
|
||||
$resolver->setAllowedTypes('second_options', 'array');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getBlockPrefix(): string
|
||||
{
|
||||
return 'repeated';
|
||||
|
||||
@@ -21,17 +21,11 @@ use Symfony\Component\Form\ButtonTypeInterface;
|
||||
*/
|
||||
class ResetType extends AbstractType implements ButtonTypeInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getParent(): ?string
|
||||
{
|
||||
return ButtonType::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getBlockPrefix(): string
|
||||
{
|
||||
return 'reset';
|
||||
|
||||
@@ -16,9 +16,6 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class SearchType extends AbstractType
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
@@ -26,17 +23,11 @@ class SearchType extends AbstractType
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getParent(): ?string
|
||||
{
|
||||
return TextType::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getBlockPrefix(): string
|
||||
{
|
||||
return 'search';
|
||||
|
||||
@@ -33,26 +33,17 @@ class SubmitType extends AbstractType implements SubmitButtonTypeInterface
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefault('validate', true);
|
||||
$resolver->setAllowedTypes('validate', 'bool');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getParent(): ?string
|
||||
{
|
||||
return ButtonType::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getBlockPrefix(): string
|
||||
{
|
||||
return 'submit';
|
||||
|
||||
@@ -16,9 +16,6 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class TelType extends AbstractType
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
@@ -26,17 +23,11 @@ class TelType extends AbstractType
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getParent(): ?string
|
||||
{
|
||||
return TextType::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getBlockPrefix(): string
|
||||
{
|
||||
return 'tel';
|
||||
|
||||
@@ -30,9 +30,6 @@ class TextType extends AbstractType implements DataTransformerInterface
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
@@ -40,26 +37,17 @@ class TextType extends AbstractType implements DataTransformerInterface
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getBlockPrefix(): string
|
||||
{
|
||||
return 'text';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function transform(mixed $data): mixed
|
||||
{
|
||||
// Model data should not be transformed
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function reverseTransform(mixed $data): mixed
|
||||
{
|
||||
return $data ?? '';
|
||||
|
||||
@@ -17,26 +17,17 @@ use Symfony\Component\Form\FormView;
|
||||
|
||||
class TextareaType extends AbstractType
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildView(FormView $view, FormInterface $form, array $options)
|
||||
{
|
||||
$view->vars['pattern'] = null;
|
||||
unset($view->vars['attr']['pattern']);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getParent(): ?string
|
||||
{
|
||||
return TextType::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getBlockPrefix(): string
|
||||
{
|
||||
return 'textarea';
|
||||
|
||||
@@ -34,9 +34,6 @@ class TimeType extends AbstractType
|
||||
'choice' => ChoiceType::class,
|
||||
];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$parts = ['hour'];
|
||||
@@ -212,9 +209,6 @@ class TimeType extends AbstractType
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildView(FormView $view, FormInterface $form, array $options)
|
||||
{
|
||||
$view->vars = array_replace($view->vars, [
|
||||
@@ -239,9 +233,6 @@ class TimeType extends AbstractType
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$compound = function (Options $options) {
|
||||
@@ -374,9 +365,6 @@ class TimeType extends AbstractType
|
||||
$resolver->setAllowedTypes('reference_date', ['null', \DateTimeInterface::class]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getBlockPrefix(): string
|
||||
{
|
||||
return 'time';
|
||||
|
||||
@@ -25,9 +25,6 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class TimezoneType extends AbstractType
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
if ('datetimezone' === $options['input']) {
|
||||
@@ -37,9 +34,6 @@ class TimezoneType extends AbstractType
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
@@ -91,17 +85,11 @@ class TimezoneType extends AbstractType
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getParent(): ?string
|
||||
{
|
||||
return ChoiceType::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getBlockPrefix(): string
|
||||
{
|
||||
return 'timezone';
|
||||
|
||||
@@ -35,9 +35,6 @@ class TransformationFailureExtension extends AbstractTypeExtension
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function getExtendedTypes(): iterable
|
||||
{
|
||||
return [FormType::class];
|
||||
|
||||
@@ -21,9 +21,6 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
*/
|
||||
class UlidType extends AbstractType
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$builder
|
||||
@@ -31,9 +28,6 @@ class UlidType extends AbstractType
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
|
||||
@@ -20,9 +20,6 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class UrlType extends AbstractType
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
if (null !== $options['default_protocol']) {
|
||||
@@ -30,9 +27,6 @@ class UrlType extends AbstractType
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildView(FormView $view, FormInterface $form, array $options)
|
||||
{
|
||||
if ($options['default_protocol']) {
|
||||
@@ -41,9 +35,6 @@ class UrlType extends AbstractType
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
@@ -54,17 +45,11 @@ class UrlType extends AbstractType
|
||||
$resolver->setAllowedTypes('default_protocol', ['null', 'string']);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getParent(): ?string
|
||||
{
|
||||
return TextType::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getBlockPrefix(): string
|
||||
{
|
||||
return 'url';
|
||||
|
||||
@@ -21,9 +21,6 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
*/
|
||||
class UuidType extends AbstractType
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$builder
|
||||
@@ -31,9 +28,6 @@ class UuidType extends AbstractType
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
|
||||
@@ -28,9 +28,6 @@ class WeekType extends AbstractType
|
||||
'choice' => ChoiceType::class,
|
||||
];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
if ('string' === $options['input']) {
|
||||
@@ -83,9 +80,6 @@ class WeekType extends AbstractType
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildView(FormView $view, FormInterface $form, array $options)
|
||||
{
|
||||
$view->vars['widget'] = $options['widget'];
|
||||
@@ -95,9 +89,6 @@ class WeekType extends AbstractType
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$compound = function (Options $options) {
|
||||
@@ -183,9 +174,6 @@ class WeekType extends AbstractType
|
||||
$resolver->setAllowedTypes('weeks', 'int[]');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getBlockPrefix(): string
|
||||
{
|
||||
return 'week';
|
||||
|
||||
@@ -33,9 +33,6 @@ class CsrfExtension extends AbstractExtension
|
||||
$this->translationDomain = $translationDomain;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function loadTypeExtensions(): array
|
||||
{
|
||||
return [
|
||||
|
||||
@@ -86,9 +86,6 @@ class FormTypeCsrfExtension extends AbstractTypeExtension
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
@@ -100,9 +97,6 @@ class FormTypeCsrfExtension extends AbstractTypeExtension
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function getExtendedTypes(): iterable
|
||||
{
|
||||
return [FormType::class];
|
||||
|
||||
@@ -28,9 +28,6 @@ class DataCollectorExtension extends AbstractExtension
|
||||
$this->dataCollector = $dataCollector;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function loadTypeExtensions(): array
|
||||
{
|
||||
return [
|
||||
|
||||
@@ -31,9 +31,6 @@ class DataCollectorListener implements EventSubscriberInterface
|
||||
$this->dataCollector = $dataCollector;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function getSubscribedEvents(): array
|
||||
{
|
||||
return [
|
||||
|
||||
@@ -89,17 +89,11 @@ class FormDataCollector extends DataCollector implements FormDataCollectorInterf
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function associateFormWithView(FormInterface $form, FormView $view)
|
||||
{
|
||||
$this->formsByView[spl_object_hash($view)] = spl_object_hash($form);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function collectConfiguration(FormInterface $form)
|
||||
{
|
||||
$hash = spl_object_hash($form);
|
||||
@@ -118,9 +112,6 @@ class FormDataCollector extends DataCollector implements FormDataCollectorInterf
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function collectDefaultData(FormInterface $form)
|
||||
{
|
||||
$hash = spl_object_hash($form);
|
||||
@@ -140,9 +131,6 @@ class FormDataCollector extends DataCollector implements FormDataCollectorInterf
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function collectSubmittedData(FormInterface $form)
|
||||
{
|
||||
$hash = spl_object_hash($form);
|
||||
@@ -174,9 +162,6 @@ class FormDataCollector extends DataCollector implements FormDataCollectorInterf
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function collectViewVariables(FormView $view)
|
||||
{
|
||||
$hash = spl_object_hash($view);
|
||||
@@ -195,33 +180,21 @@ class FormDataCollector extends DataCollector implements FormDataCollectorInterf
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildPreliminaryFormTree(FormInterface $form)
|
||||
{
|
||||
$this->data['forms'][$form->getName()] = &$this->recursiveBuildPreliminaryFormTree($form, $this->data['forms_by_hash']);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildFinalFormTree(FormInterface $form, FormView $view)
|
||||
{
|
||||
$this->data['forms'][$form->getName()] = &$this->recursiveBuildFinalFormTree($form, $view, $this->data['forms_by_hash']);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName(): string
|
||||
{
|
||||
return 'form';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getData(): array|Data
|
||||
{
|
||||
return $this->data;
|
||||
@@ -243,9 +216,6 @@ class FormDataCollector extends DataCollector implements FormDataCollectorInterf
|
||||
return parent::__sleep();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function getCasters(): array
|
||||
{
|
||||
return parent::getCasters() + [
|
||||
|
||||
@@ -22,9 +22,6 @@ use Symfony\Component\Validator\ConstraintViolationInterface;
|
||||
*/
|
||||
class FormDataExtractor implements FormDataExtractorInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function extractConfiguration(FormInterface $form): array
|
||||
{
|
||||
$data = [
|
||||
@@ -50,9 +47,6 @@ class FormDataExtractor implements FormDataExtractorInterface
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function extractDefaultData(FormInterface $form): array
|
||||
{
|
||||
$data = [
|
||||
@@ -73,9 +67,6 @@ class FormDataExtractor implements FormDataExtractorInterface
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function extractSubmittedData(FormInterface $form): array
|
||||
{
|
||||
$data = [
|
||||
@@ -132,9 +123,6 @@ class FormDataExtractor implements FormDataExtractorInterface
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function extractViewVariables(FormView $view): array
|
||||
{
|
||||
$data = [
|
||||
|
||||
@@ -36,41 +36,26 @@ class ResolvedTypeDataCollectorProxy implements ResolvedFormTypeInterface
|
||||
$this->dataCollector = $dataCollector;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getBlockPrefix(): string
|
||||
{
|
||||
return $this->proxiedType->getBlockPrefix();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getParent(): ?ResolvedFormTypeInterface
|
||||
{
|
||||
return $this->proxiedType->getParent();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getInnerType(): FormTypeInterface
|
||||
{
|
||||
return $this->proxiedType->getInnerType();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getTypeExtensions(): array
|
||||
{
|
||||
return $this->proxiedType->getTypeExtensions();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function createBuilder(FormFactoryInterface $factory, string $name, array $options = []): FormBuilderInterface
|
||||
{
|
||||
$builder = $this->proxiedType->createBuilder($factory, $name, $options);
|
||||
@@ -81,33 +66,21 @@ class ResolvedTypeDataCollectorProxy implements ResolvedFormTypeInterface
|
||||
return $builder;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function createView(FormInterface $form, FormView $parent = null): FormView
|
||||
{
|
||||
return $this->proxiedType->createView($form, $parent);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$this->proxiedType->buildForm($builder, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildView(FormView $view, FormInterface $form, array $options)
|
||||
{
|
||||
$this->proxiedType->buildView($view, $form, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function finishView(FormView $view, FormInterface $form, array $options)
|
||||
{
|
||||
$this->proxiedType->finishView($view, $form, $options);
|
||||
@@ -132,9 +105,6 @@ class ResolvedTypeDataCollectorProxy implements ResolvedFormTypeInterface
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getOptionsResolver(): OptionsResolver
|
||||
{
|
||||
return $this->proxiedType->getOptionsResolver();
|
||||
|
||||
@@ -33,9 +33,6 @@ class ResolvedTypeFactoryDataCollectorProxy implements ResolvedFormTypeFactoryIn
|
||||
$this->dataCollector = $dataCollector;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function createResolvedType(FormTypeInterface $type, array $typeExtensions, ResolvedFormTypeInterface $parent = null): ResolvedFormTypeInterface
|
||||
{
|
||||
return new ResolvedTypeDataCollectorProxy(
|
||||
|
||||
@@ -32,17 +32,11 @@ class DataCollectorTypeExtension extends AbstractTypeExtension
|
||||
$this->listener = new DataCollectorListener($dataCollector);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$builder->addEventSubscriber($this->listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function getExtendedTypes(): iterable
|
||||
{
|
||||
return [FormType::class];
|
||||
|
||||
@@ -36,9 +36,6 @@ class DependencyInjectionExtension implements FormExtensionInterface
|
||||
$this->guesserServices = $guesserServices;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getType(string $name): FormTypeInterface
|
||||
{
|
||||
if (!$this->typeContainer->has($name)) {
|
||||
@@ -48,17 +45,11 @@ class DependencyInjectionExtension implements FormExtensionInterface
|
||||
return $this->typeContainer->get($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function hasType(string $name): bool
|
||||
{
|
||||
return $this->typeContainer->has($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getTypeExtensions(string $name): array
|
||||
{
|
||||
$extensions = [];
|
||||
@@ -82,17 +73,11 @@ class DependencyInjectionExtension implements FormExtensionInterface
|
||||
return $extensions;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function hasTypeExtensions(string $name): bool
|
||||
{
|
||||
return isset($this->typeExtensionServices[$name]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getTypeGuesser(): ?FormTypeGuesserInterface
|
||||
{
|
||||
if (!$this->guesserLoaded) {
|
||||
|
||||
@@ -35,9 +35,6 @@ class HttpFoundationRequestHandler implements RequestHandlerInterface
|
||||
$this->serverParams = $serverParams ?? new ServerParams();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function handleRequest(FormInterface $form, mixed $request = null)
|
||||
{
|
||||
if (!$request instanceof Request) {
|
||||
@@ -109,9 +106,6 @@ class HttpFoundationRequestHandler implements RequestHandlerInterface
|
||||
$form->submit($data, 'PATCH' !== $method);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isFileUpload(mixed $data): bool
|
||||
{
|
||||
return $data instanceof File;
|
||||
|
||||
@@ -29,17 +29,11 @@ class FormTypeHttpFoundationExtension extends AbstractTypeExtension
|
||||
$this->requestHandler = $requestHandler ?? new HttpFoundationRequestHandler();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$builder->setRequestHandler($this->requestHandler);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function getExtendedTypes(): iterable
|
||||
{
|
||||
return [FormType::class];
|
||||
|
||||
@@ -31,9 +31,6 @@ class Form extends Constraint
|
||||
*/
|
||||
protected static $errorNames = self::ERROR_NAMES;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getTargets(): string|array
|
||||
{
|
||||
return self::CLASS_CONSTRAINT;
|
||||
|
||||
@@ -29,9 +29,6 @@ class FormValidator extends ConstraintValidator
|
||||
*/
|
||||
private \SplObjectStorage $resolvedGroups;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validate(mixed $form, Constraint $formConstraint)
|
||||
{
|
||||
if (!$formConstraint instanceof Form) {
|
||||
|
||||
@@ -26,9 +26,6 @@ class ValidationListener implements EventSubscriberInterface
|
||||
private ValidatorInterface $validator;
|
||||
private ViolationMapperInterface $violationMapper;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function getSubscribedEvents(): array
|
||||
{
|
||||
return [FormEvents::POST_SUBMIT => 'validateForm'];
|
||||
|
||||
@@ -24,9 +24,6 @@ use Symfony\Component\Validator\Constraints\GroupSequence;
|
||||
*/
|
||||
abstract class BaseValidatorExtension extends AbstractTypeExtension
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
// Make sure that validation groups end up as null, closure or array
|
||||
|
||||
@@ -37,17 +37,11 @@ class FormTypeValidatorExtension extends BaseValidatorExtension
|
||||
$this->violationMapper = new ViolationMapper($formRenderer, $translator);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$builder->addEventSubscriber(new ValidationListener($this->validator, $this->violationMapper));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
parent::configureOptions($resolver);
|
||||
@@ -69,9 +63,6 @@ class FormTypeValidatorExtension extends BaseValidatorExtension
|
||||
$resolver->setNormalizer('constraints', $constraintsNormalizer);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function getExtendedTypes(): iterable
|
||||
{
|
||||
return [FormType::class];
|
||||
|
||||
@@ -21,9 +21,6 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
*/
|
||||
class RepeatedTypeValidatorExtension extends AbstractTypeExtension
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
// Map errors to the first field
|
||||
@@ -36,9 +33,6 @@ class RepeatedTypeValidatorExtension extends AbstractTypeExtension
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function getExtendedTypes(): iterable
|
||||
{
|
||||
return [RepeatedType::class];
|
||||
|
||||
@@ -18,9 +18,6 @@ use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
*/
|
||||
class SubmitTypeValidatorExtension extends BaseValidatorExtension
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function getExtendedTypes(): iterable
|
||||
{
|
||||
return [SubmitType::class];
|
||||
|
||||
@@ -32,9 +32,6 @@ class UploadValidatorExtension extends AbstractTypeExtension
|
||||
$this->translationDomain = $translationDomain;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$translator = $this->translator;
|
||||
@@ -46,9 +43,6 @@ class UploadValidatorExtension extends AbstractTypeExtension
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function getExtendedTypes(): iterable
|
||||
{
|
||||
return [FormType::class];
|
||||
|
||||
@@ -64,9 +64,6 @@ class ValidatorTypeGuesser implements FormTypeGuesserInterface
|
||||
$this->metadataFactory = $metadataFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function guessType(string $class, string $property): ?TypeGuess
|
||||
{
|
||||
return $this->guess($class, $property, function (Constraint $constraint) {
|
||||
@@ -74,9 +71,6 @@ class ValidatorTypeGuesser implements FormTypeGuesserInterface
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function guessRequired(string $class, string $property): ?ValueGuess
|
||||
{
|
||||
return $this->guess($class, $property, function (Constraint $constraint) {
|
||||
@@ -86,9 +80,6 @@ class ValidatorTypeGuesser implements FormTypeGuesserInterface
|
||||
}, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function guessMaxLength(string $class, string $property): ?ValueGuess
|
||||
{
|
||||
return $this->guess($class, $property, function (Constraint $constraint) {
|
||||
@@ -96,9 +87,6 @@ class ValidatorTypeGuesser implements FormTypeGuesserInterface
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function guessPattern(string $class, string $property): ?ValueGuess
|
||||
{
|
||||
return $this->guess($class, $property, function (Constraint $constraint) {
|
||||
|
||||
@@ -38,9 +38,6 @@ class ViolationMapper implements ViolationMapperInterface
|
||||
$this->translator = $translator;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function mapViolation(ConstraintViolation $violation, FormInterface $form, bool $allowNonSynchronized = false)
|
||||
{
|
||||
$this->allowNonSynchronized = $allowNonSynchronized;
|
||||
|
||||
@@ -101,17 +101,11 @@ class ViolationPath implements \IteratorAggregate, PropertyPathInterface
|
||||
return $this->pathAsString;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getLength(): int
|
||||
{
|
||||
return $this->length;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getParent(): ?PropertyPathInterface
|
||||
{
|
||||
if ($this->length <= 1) {
|
||||
@@ -130,17 +124,11 @@ class ViolationPath implements \IteratorAggregate, PropertyPathInterface
|
||||
return $parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getElements(): array
|
||||
{
|
||||
return $this->elements;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getElement(int $index): string
|
||||
{
|
||||
if (!isset($this->elements[$index])) {
|
||||
@@ -150,9 +138,6 @@ class ViolationPath implements \IteratorAggregate, PropertyPathInterface
|
||||
return $this->elements[$index];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isProperty(int $index): bool
|
||||
{
|
||||
if (!isset($this->isIndex[$index])) {
|
||||
@@ -162,9 +147,6 @@ class ViolationPath implements \IteratorAggregate, PropertyPathInterface
|
||||
return !$this->isIndex[$index];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isIndex(int $index): bool
|
||||
{
|
||||
if (!isset($this->isIndex[$index])) {
|
||||
|
||||
93
Form.php
93
Form.php
@@ -165,25 +165,16 @@ class Form implements \IteratorAggregate, FormInterface, ClearableErrorsInterfac
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getConfig(): FormConfigInterface
|
||||
{
|
||||
return $this->config;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName(): string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getPropertyPath(): ?PropertyPathInterface
|
||||
{
|
||||
if ($this->propertyPath || $this->propertyPath = $this->config->getPropertyPath()) {
|
||||
@@ -209,9 +200,6 @@ class Form implements \IteratorAggregate, FormInterface, ClearableErrorsInterfac
|
||||
return $this->propertyPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isRequired(): bool
|
||||
{
|
||||
if (null === $this->parent || $this->parent->isRequired()) {
|
||||
@@ -221,9 +209,6 @@ class Form implements \IteratorAggregate, FormInterface, ClearableErrorsInterfac
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isDisabled(): bool
|
||||
{
|
||||
if (null === $this->parent || !$this->parent->isDisabled()) {
|
||||
@@ -233,9 +218,6 @@ class Form implements \IteratorAggregate, FormInterface, ClearableErrorsInterfac
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setParent(FormInterface $parent = null): static
|
||||
{
|
||||
if ($this->submitted) {
|
||||
@@ -251,33 +233,21 @@ class Form implements \IteratorAggregate, FormInterface, ClearableErrorsInterfac
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getParent(): ?FormInterface
|
||||
{
|
||||
return $this->parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getRoot(): FormInterface
|
||||
{
|
||||
return $this->parent ? $this->parent->getRoot() : $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isRoot(): bool
|
||||
{
|
||||
return null === $this->parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setData(mixed $modelData): static
|
||||
{
|
||||
// If the form is submitted while disabled, it is set to submitted, but the data is not
|
||||
@@ -357,9 +327,6 @@ class Form implements \IteratorAggregate, FormInterface, ClearableErrorsInterfac
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getData(): mixed
|
||||
{
|
||||
if ($this->inheritData) {
|
||||
@@ -381,9 +348,6 @@ class Form implements \IteratorAggregate, FormInterface, ClearableErrorsInterfac
|
||||
return $this->modelData;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getNormData(): mixed
|
||||
{
|
||||
if ($this->inheritData) {
|
||||
@@ -405,9 +369,6 @@ class Form implements \IteratorAggregate, FormInterface, ClearableErrorsInterfac
|
||||
return $this->normData;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getViewData(): mixed
|
||||
{
|
||||
if ($this->inheritData) {
|
||||
@@ -429,17 +390,11 @@ class Form implements \IteratorAggregate, FormInterface, ClearableErrorsInterfac
|
||||
return $this->viewData;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getExtraData(): array
|
||||
{
|
||||
return $this->extraData;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function initialize(): static
|
||||
{
|
||||
if (null !== $this->parent) {
|
||||
@@ -456,9 +411,6 @@ class Form implements \IteratorAggregate, FormInterface, ClearableErrorsInterfac
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function handleRequest(mixed $request = null): static
|
||||
{
|
||||
$this->config->getRequestHandler()->handleRequest($this, $request);
|
||||
@@ -466,9 +418,6 @@ class Form implements \IteratorAggregate, FormInterface, ClearableErrorsInterfac
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function submit(mixed $submittedData, bool $clearMissing = true): static
|
||||
{
|
||||
if ($this->submitted) {
|
||||
@@ -645,9 +594,6 @@ class Form implements \IteratorAggregate, FormInterface, ClearableErrorsInterfac
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function addError(FormError $error): static
|
||||
{
|
||||
if (null === $error->getOrigin()) {
|
||||
@@ -663,33 +609,21 @@ class Form implements \IteratorAggregate, FormInterface, ClearableErrorsInterfac
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isSubmitted(): bool
|
||||
{
|
||||
return $this->submitted;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isSynchronized(): bool
|
||||
{
|
||||
return null === $this->transformationFailure;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getTransformationFailure(): ?Exception\TransformationFailedException
|
||||
{
|
||||
return $this->transformationFailure;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isEmpty(): bool
|
||||
{
|
||||
foreach ($this->children as $child) {
|
||||
@@ -709,9 +643,6 @@ class Form implements \IteratorAggregate, FormInterface, ClearableErrorsInterfac
|
||||
($this->modelData instanceof \Traversable && 0 === iterator_count($this->modelData));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isValid(): bool
|
||||
{
|
||||
if (!$this->submitted) {
|
||||
@@ -737,9 +668,6 @@ class Form implements \IteratorAggregate, FormInterface, ClearableErrorsInterfac
|
||||
return $this->parent && method_exists($this->parent, 'getClickedButton') ? $this->parent->getClickedButton() : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getErrors(bool $deep = false, bool $flatten = true): FormErrorIterator
|
||||
{
|
||||
$errors = $this->errors;
|
||||
@@ -771,9 +699,6 @@ class Form implements \IteratorAggregate, FormInterface, ClearableErrorsInterfac
|
||||
return new FormErrorIterator($this, $errors);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function clearErrors(bool $deep = false): static
|
||||
{
|
||||
$this->errors = [];
|
||||
@@ -790,17 +715,11 @@ class Form implements \IteratorAggregate, FormInterface, ClearableErrorsInterfac
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function all(): array
|
||||
{
|
||||
return iterator_to_array($this->children);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function add(FormInterface|string $child, string $type = null, array $options = []): static
|
||||
{
|
||||
if ($this->submitted) {
|
||||
@@ -865,9 +784,6 @@ class Form implements \IteratorAggregate, FormInterface, ClearableErrorsInterfac
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function remove(string $name): static
|
||||
{
|
||||
if ($this->submitted) {
|
||||
@@ -885,17 +801,11 @@ class Form implements \IteratorAggregate, FormInterface, ClearableErrorsInterfac
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function has(string $name): bool
|
||||
{
|
||||
return isset($this->children[$name]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get(string $name): FormInterface
|
||||
{
|
||||
if (isset($this->children[$name])) {
|
||||
@@ -973,9 +883,6 @@ class Form implements \IteratorAggregate, FormInterface, ClearableErrorsInterfac
|
||||
return \count($this->children);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function createView(FormView $parent = null): FormView
|
||||
{
|
||||
if (null === $parent && $this->parent) {
|
||||
|
||||
@@ -45,9 +45,6 @@ class FormBuilder extends FormConfigBuilder implements \IteratorAggregate, FormB
|
||||
$this->setFormFactory($factory);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function add(FormBuilderInterface|string $child, string $type = null, array $options = []): static
|
||||
{
|
||||
if ($this->locked) {
|
||||
@@ -74,9 +71,6 @@ class FormBuilder extends FormConfigBuilder implements \IteratorAggregate, FormB
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function create(string $name, string $type = null, array $options = []): FormBuilderInterface
|
||||
{
|
||||
if ($this->locked) {
|
||||
@@ -94,9 +88,6 @@ class FormBuilder extends FormConfigBuilder implements \IteratorAggregate, FormB
|
||||
return $this->getFormFactory()->createBuilderForProperty($this->getDataClass(), $name, null, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get(string $name): FormBuilderInterface
|
||||
{
|
||||
if ($this->locked) {
|
||||
@@ -114,9 +105,6 @@ class FormBuilder extends FormConfigBuilder implements \IteratorAggregate, FormB
|
||||
throw new InvalidArgumentException(sprintf('The child with the name "%s" does not exist.', $name));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function remove(string $name): static
|
||||
{
|
||||
if ($this->locked) {
|
||||
@@ -128,9 +116,6 @@ class FormBuilder extends FormConfigBuilder implements \IteratorAggregate, FormB
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function has(string $name): bool
|
||||
{
|
||||
if ($this->locked) {
|
||||
@@ -140,9 +125,6 @@ class FormBuilder extends FormConfigBuilder implements \IteratorAggregate, FormB
|
||||
return isset($this->unresolvedChildren[$name]) || isset($this->children[$name]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function all(): array
|
||||
{
|
||||
if ($this->locked) {
|
||||
@@ -163,9 +145,6 @@ class FormBuilder extends FormConfigBuilder implements \IteratorAggregate, FormB
|
||||
return \count($this->children);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFormConfig(): FormConfigInterface
|
||||
{
|
||||
/** @var $config self */
|
||||
@@ -177,9 +156,6 @@ class FormBuilder extends FormConfigBuilder implements \IteratorAggregate, FormB
|
||||
return $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getForm(): FormInterface
|
||||
{
|
||||
if ($this->locked) {
|
||||
@@ -204,8 +180,6 @@ class FormBuilder extends FormConfigBuilder implements \IteratorAggregate, FormB
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @return \Traversable<string, FormBuilderInterface>
|
||||
*/
|
||||
public function getIterator(): \Traversable
|
||||
|
||||
@@ -84,9 +84,6 @@ class FormConfigBuilder implements FormConfigBuilderInterface
|
||||
$this->options = $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function addEventListener(string $eventName, callable $listener, int $priority = 0): static
|
||||
{
|
||||
if ($this->locked) {
|
||||
@@ -98,9 +95,6 @@ class FormConfigBuilder implements FormConfigBuilderInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function addEventSubscriber(EventSubscriberInterface $subscriber): static
|
||||
{
|
||||
if ($this->locked) {
|
||||
@@ -112,9 +106,6 @@ class FormConfigBuilder implements FormConfigBuilderInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function addViewTransformer(DataTransformerInterface $viewTransformer, bool $forcePrepend = false): static
|
||||
{
|
||||
if ($this->locked) {
|
||||
@@ -130,9 +121,6 @@ class FormConfigBuilder implements FormConfigBuilderInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function resetViewTransformers(): static
|
||||
{
|
||||
if ($this->locked) {
|
||||
@@ -144,9 +132,6 @@ class FormConfigBuilder implements FormConfigBuilderInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function addModelTransformer(DataTransformerInterface $modelTransformer, bool $forceAppend = false): static
|
||||
{
|
||||
if ($this->locked) {
|
||||
@@ -162,9 +147,6 @@ class FormConfigBuilder implements FormConfigBuilderInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function resetModelTransformers(): static
|
||||
{
|
||||
if ($this->locked) {
|
||||
@@ -176,9 +158,6 @@ class FormConfigBuilder implements FormConfigBuilderInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getEventDispatcher(): EventDispatcherInterface
|
||||
{
|
||||
if ($this->locked && !$this->dispatcher instanceof ImmutableEventDispatcher) {
|
||||
@@ -188,169 +167,106 @@ class FormConfigBuilder implements FormConfigBuilderInterface
|
||||
return $this->dispatcher;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName(): string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getPropertyPath(): ?PropertyPathInterface
|
||||
{
|
||||
return $this->propertyPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getMapped(): bool
|
||||
{
|
||||
return $this->mapped;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getByReference(): bool
|
||||
{
|
||||
return $this->byReference;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getInheritData(): bool
|
||||
{
|
||||
return $this->inheritData;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getCompound(): bool
|
||||
{
|
||||
return $this->compound;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getType(): ResolvedFormTypeInterface
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getViewTransformers(): array
|
||||
{
|
||||
return $this->viewTransformers;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getModelTransformers(): array
|
||||
{
|
||||
return $this->modelTransformers;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDataMapper(): ?DataMapperInterface
|
||||
{
|
||||
return $this->dataMapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getRequired(): bool
|
||||
{
|
||||
return $this->required;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDisabled(): bool
|
||||
{
|
||||
return $this->disabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getErrorBubbling(): bool
|
||||
{
|
||||
return $this->errorBubbling;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getEmptyData(): mixed
|
||||
{
|
||||
return $this->emptyData;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getAttributes(): array
|
||||
{
|
||||
return $this->attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function hasAttribute(string $name): bool
|
||||
{
|
||||
return \array_key_exists($name, $this->attributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getAttribute(string $name, mixed $default = null): mixed
|
||||
{
|
||||
return \array_key_exists($name, $this->attributes) ? $this->attributes[$name] : $default;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getData(): mixed
|
||||
{
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDataClass(): ?string
|
||||
{
|
||||
return $this->dataClass;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDataLocked(): bool
|
||||
{
|
||||
return $this->dataLocked;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFormFactory(): FormFactoryInterface
|
||||
{
|
||||
if (!isset($this->formFactory)) {
|
||||
@@ -360,73 +276,46 @@ class FormConfigBuilder implements FormConfigBuilderInterface
|
||||
return $this->formFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getAction(): string
|
||||
{
|
||||
return $this->action;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getMethod(): string
|
||||
{
|
||||
return $this->method;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getRequestHandler(): RequestHandlerInterface
|
||||
{
|
||||
return $this->requestHandler ??= self::$nativeRequestHandler ??= new NativeRequestHandler();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getAutoInitialize(): bool
|
||||
{
|
||||
return $this->autoInitialize;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getOptions(): array
|
||||
{
|
||||
return $this->options;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function hasOption(string $name): bool
|
||||
{
|
||||
return \array_key_exists($name, $this->options);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getOption(string $name, mixed $default = null): mixed
|
||||
{
|
||||
return \array_key_exists($name, $this->options) ? $this->options[$name] : $default;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getIsEmptyCallback(): ?callable
|
||||
{
|
||||
return $this->isEmptyCallback;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setAttribute(string $name, mixed $value): static
|
||||
{
|
||||
if ($this->locked) {
|
||||
@@ -438,9 +327,6 @@ class FormConfigBuilder implements FormConfigBuilderInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setAttributes(array $attributes): static
|
||||
{
|
||||
if ($this->locked) {
|
||||
@@ -452,9 +338,6 @@ class FormConfigBuilder implements FormConfigBuilderInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setDataMapper(DataMapperInterface $dataMapper = null): static
|
||||
{
|
||||
if ($this->locked) {
|
||||
@@ -466,9 +349,6 @@ class FormConfigBuilder implements FormConfigBuilderInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setDisabled(bool $disabled): static
|
||||
{
|
||||
if ($this->locked) {
|
||||
@@ -480,9 +360,6 @@ class FormConfigBuilder implements FormConfigBuilderInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setEmptyData(mixed $emptyData): static
|
||||
{
|
||||
if ($this->locked) {
|
||||
@@ -494,9 +371,6 @@ class FormConfigBuilder implements FormConfigBuilderInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setErrorBubbling(bool $errorBubbling): static
|
||||
{
|
||||
if ($this->locked) {
|
||||
@@ -508,9 +382,6 @@ class FormConfigBuilder implements FormConfigBuilderInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setRequired(bool $required): static
|
||||
{
|
||||
if ($this->locked) {
|
||||
@@ -522,9 +393,6 @@ class FormConfigBuilder implements FormConfigBuilderInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setPropertyPath(string|PropertyPathInterface|null $propertyPath): static
|
||||
{
|
||||
if ($this->locked) {
|
||||
@@ -540,9 +408,6 @@ class FormConfigBuilder implements FormConfigBuilderInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setMapped(bool $mapped): static
|
||||
{
|
||||
if ($this->locked) {
|
||||
@@ -554,9 +419,6 @@ class FormConfigBuilder implements FormConfigBuilderInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setByReference(bool $byReference): static
|
||||
{
|
||||
if ($this->locked) {
|
||||
@@ -568,9 +430,6 @@ class FormConfigBuilder implements FormConfigBuilderInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setInheritData(bool $inheritData): static
|
||||
{
|
||||
if ($this->locked) {
|
||||
@@ -582,9 +441,6 @@ class FormConfigBuilder implements FormConfigBuilderInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setCompound(bool $compound): static
|
||||
{
|
||||
if ($this->locked) {
|
||||
@@ -596,9 +452,6 @@ class FormConfigBuilder implements FormConfigBuilderInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setType(ResolvedFormTypeInterface $type): static
|
||||
{
|
||||
if ($this->locked) {
|
||||
@@ -610,9 +463,6 @@ class FormConfigBuilder implements FormConfigBuilderInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setData(mixed $data): static
|
||||
{
|
||||
if ($this->locked) {
|
||||
@@ -624,9 +474,6 @@ class FormConfigBuilder implements FormConfigBuilderInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setDataLocked(bool $locked): static
|
||||
{
|
||||
if ($this->locked) {
|
||||
@@ -638,9 +485,6 @@ class FormConfigBuilder implements FormConfigBuilderInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setFormFactory(FormFactoryInterface $formFactory)
|
||||
{
|
||||
if ($this->locked) {
|
||||
@@ -652,9 +496,6 @@ class FormConfigBuilder implements FormConfigBuilderInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setAction(string $action): static
|
||||
{
|
||||
if ($this->locked) {
|
||||
@@ -666,9 +507,6 @@ class FormConfigBuilder implements FormConfigBuilderInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setMethod(string $method): static
|
||||
{
|
||||
if ($this->locked) {
|
||||
@@ -680,9 +518,6 @@ class FormConfigBuilder implements FormConfigBuilderInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setRequestHandler(RequestHandlerInterface $requestHandler): static
|
||||
{
|
||||
if ($this->locked) {
|
||||
@@ -694,9 +529,6 @@ class FormConfigBuilder implements FormConfigBuilderInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setAutoInitialize(bool $initialize): static
|
||||
{
|
||||
if ($this->locked) {
|
||||
@@ -708,9 +540,6 @@ class FormConfigBuilder implements FormConfigBuilderInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFormConfig(): FormConfigInterface
|
||||
{
|
||||
if ($this->locked) {
|
||||
@@ -724,9 +553,6 @@ class FormConfigBuilder implements FormConfigBuilderInterface
|
||||
return $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setIsEmptyCallback(?callable $isEmptyCallback): static
|
||||
{
|
||||
$this->isEmptyCallback = null === $isEmptyCallback ? null : $isEmptyCallback(...);
|
||||
|
||||
@@ -23,41 +23,26 @@ class FormFactory implements FormFactoryInterface
|
||||
$this->registry = $registry;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function create(string $type = FormType::class, mixed $data = null, array $options = []): FormInterface
|
||||
{
|
||||
return $this->createBuilder($type, $data, $options)->getForm();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function createNamed(string $name, string $type = FormType::class, mixed $data = null, array $options = []): FormInterface
|
||||
{
|
||||
return $this->createNamedBuilder($name, $type, $data, $options)->getForm();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function createForProperty(string $class, string $property, mixed $data = null, array $options = []): FormInterface
|
||||
{
|
||||
return $this->createBuilderForProperty($class, $property, $data, $options)->getForm();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function createBuilder(string $type = FormType::class, mixed $data = null, array $options = []): FormBuilderInterface
|
||||
{
|
||||
return $this->createNamedBuilder($this->registry->getType($type)->getBlockPrefix(), $type, $data, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function createNamedBuilder(string $name, string $type = FormType::class, mixed $data = null, array $options = []): FormBuilderInterface
|
||||
{
|
||||
if (null !== $data && !\array_key_exists('data', $options)) {
|
||||
@@ -75,9 +60,6 @@ class FormFactory implements FormFactoryInterface
|
||||
return $builder;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function createBuilderForProperty(string $class, string $property, mixed $data = null, array $options = []): FormBuilderInterface
|
||||
{
|
||||
if (null === $guesser = $this->registry->getTypeGuesser()) {
|
||||
|
||||
@@ -49,9 +49,6 @@ class FormFactoryBuilder implements FormFactoryBuilderInterface
|
||||
$this->forceCoreExtension = $forceCoreExtension;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setResolvedTypeFactory(ResolvedFormTypeFactoryInterface $resolvedTypeFactory): static
|
||||
{
|
||||
$this->resolvedTypeFactory = $resolvedTypeFactory;
|
||||
@@ -59,9 +56,6 @@ class FormFactoryBuilder implements FormFactoryBuilderInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function addExtension(FormExtensionInterface $extension): static
|
||||
{
|
||||
$this->extensions[] = $extension;
|
||||
@@ -69,9 +63,6 @@ class FormFactoryBuilder implements FormFactoryBuilderInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function addExtensions(array $extensions): static
|
||||
{
|
||||
$this->extensions = array_merge($this->extensions, $extensions);
|
||||
@@ -79,9 +70,6 @@ class FormFactoryBuilder implements FormFactoryBuilderInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function addType(FormTypeInterface $type): static
|
||||
{
|
||||
$this->types[] = $type;
|
||||
@@ -89,9 +77,6 @@ class FormFactoryBuilder implements FormFactoryBuilderInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function addTypes(array $types): static
|
||||
{
|
||||
foreach ($types as $type) {
|
||||
@@ -101,9 +86,6 @@ class FormFactoryBuilder implements FormFactoryBuilderInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function addTypeExtension(FormTypeExtensionInterface $typeExtension): static
|
||||
{
|
||||
foreach ($typeExtension::getExtendedTypes() as $extendedType) {
|
||||
@@ -113,9 +95,6 @@ class FormFactoryBuilder implements FormFactoryBuilderInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function addTypeExtensions(array $typeExtensions): static
|
||||
{
|
||||
foreach ($typeExtensions as $typeExtension) {
|
||||
@@ -125,9 +104,6 @@ class FormFactoryBuilder implements FormFactoryBuilderInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function addTypeGuesser(FormTypeGuesserInterface $typeGuesser): static
|
||||
{
|
||||
$this->typeGuessers[] = $typeGuesser;
|
||||
@@ -135,9 +111,6 @@ class FormFactoryBuilder implements FormFactoryBuilderInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function addTypeGuessers(array $typeGuessers): static
|
||||
{
|
||||
$this->typeGuessers = array_merge($this->typeGuessers, $typeGuessers);
|
||||
@@ -145,9 +118,6 @@ class FormFactoryBuilder implements FormFactoryBuilderInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFormFactory(): FormFactoryInterface
|
||||
{
|
||||
$extensions = $this->extensions;
|
||||
|
||||
@@ -54,9 +54,6 @@ class FormRegistry implements FormRegistryInterface
|
||||
$this->resolvedTypeFactory = $resolvedTypeFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getType(string $name): ResolvedFormTypeInterface
|
||||
{
|
||||
if (!isset($this->types[$name])) {
|
||||
@@ -118,9 +115,6 @@ class FormRegistry implements FormRegistryInterface
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function hasType(string $name): bool
|
||||
{
|
||||
if (isset($this->types[$name])) {
|
||||
@@ -136,9 +130,6 @@ class FormRegistry implements FormRegistryInterface
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getTypeGuesser(): ?FormTypeGuesserInterface
|
||||
{
|
||||
if (false === $this->guesser) {
|
||||
@@ -158,9 +149,6 @@ class FormRegistry implements FormRegistryInterface
|
||||
return $this->guesser;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getExtensions(): array
|
||||
{
|
||||
return $this->extensions;
|
||||
|
||||
@@ -37,25 +37,16 @@ class FormRenderer implements FormRendererInterface
|
||||
$this->csrfTokenManager = $csrfTokenManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getEngine(): FormRendererEngineInterface
|
||||
{
|
||||
return $this->engine;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setTheme(FormView $view, mixed $themes, bool $useDefaultThemes = true)
|
||||
{
|
||||
$this->engine->setTheme($view, $themes, $useDefaultThemes);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function renderCsrfToken(string $tokenId): string
|
||||
{
|
||||
if (null === $this->csrfTokenManager) {
|
||||
@@ -65,9 +56,6 @@ class FormRenderer implements FormRendererInterface
|
||||
return $this->csrfTokenManager->getToken($tokenId)->getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function renderBlock(FormView $view, string $blockName, array $variables = []): string
|
||||
{
|
||||
$resource = $this->engine->getResourceForBlockName($view, $blockName);
|
||||
@@ -124,9 +112,6 @@ class FormRenderer implements FormRendererInterface
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function searchAndRenderBlock(FormView $view, string $blockNameSuffix, array $variables = []): string
|
||||
{
|
||||
$renderOnlyOnce = 'row' === $blockNameSuffix || 'widget' === $blockNameSuffix;
|
||||
@@ -277,9 +262,6 @@ class FormRenderer implements FormRendererInterface
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function humanize(string $text): string
|
||||
{
|
||||
return ucfirst(strtolower(trim(preg_replace(['/([A-Z])/', '/[_\s]+/'], ['_$1', ' '], $text))));
|
||||
|
||||
@@ -43,9 +43,6 @@ class FormTypeGuesserChain implements FormTypeGuesserInterface
|
||||
$this->guessers = array_merge([], ...$tmpGuessers);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function guessType(string $class, string $property): ?TypeGuess
|
||||
{
|
||||
return $this->guess(function ($guesser) use ($class, $property) {
|
||||
@@ -53,9 +50,6 @@ class FormTypeGuesserChain implements FormTypeGuesserInterface
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function guessRequired(string $class, string $property): ?ValueGuess
|
||||
{
|
||||
return $this->guess(function ($guesser) use ($class, $property) {
|
||||
@@ -63,9 +57,6 @@ class FormTypeGuesserChain implements FormTypeGuesserInterface
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function guessMaxLength(string $class, string $property): ?ValueGuess
|
||||
{
|
||||
return $this->guess(function ($guesser) use ($class, $property) {
|
||||
@@ -73,9 +64,6 @@ class FormTypeGuesserChain implements FormTypeGuesserInterface
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function guessPattern(string $class, string $property): ?ValueGuess
|
||||
{
|
||||
return $this->guess(function ($guesser) use ($class, $property) {
|
||||
|
||||
@@ -40,8 +40,6 @@ class NativeRequestHandler implements RequestHandlerInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @throws Exception\UnexpectedTypeException If the $request is not null
|
||||
*/
|
||||
public function handleRequest(FormInterface $form, mixed $request = null)
|
||||
@@ -124,9 +122,6 @@ class NativeRequestHandler implements RequestHandlerInterface
|
||||
$form->submit($data, 'PATCH' !== $method);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isFileUpload(mixed $data): bool
|
||||
{
|
||||
// POST data will always be strings or arrays of strings. Thus, we can be sure
|
||||
|
||||
@@ -40,9 +40,6 @@ class PreloadedExtension implements FormExtensionInterface
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getType(string $name): FormTypeInterface
|
||||
{
|
||||
if (!isset($this->types[$name])) {
|
||||
@@ -52,34 +49,22 @@ class PreloadedExtension implements FormExtensionInterface
|
||||
return $this->types[$name];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function hasType(string $name): bool
|
||||
{
|
||||
return isset($this->types[$name]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getTypeExtensions(string $name): array
|
||||
{
|
||||
return $this->typeExtensions[$name]
|
||||
?? [];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function hasTypeExtensions(string $name): bool
|
||||
{
|
||||
return !empty($this->typeExtensions[$name]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getTypeGuesser(): ?FormTypeGuesserInterface
|
||||
{
|
||||
return $this->typeGuesser;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user