prefix stringlengths 512 512 | suffix stringlengths 256 256 | middle stringlengths 14 229 | meta dict |
|---|---|---|---|
ge.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\ChoiceList\Loader;
use Symfony\Component\Form\ChoiceList\ChoiceListInterface;
/**
* Loads a choic... | e callable receives the choice as only argument.
* Null may be passed when the choice list contains the empty value.
*
* @param callable|null $value The callable which generates the values
* from choices
| y.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*/
interface ChoiceLoaderInterface
{
/**
* Loads a list of choices.
*
* Optionally, a callable can be passed for generating the choice values.
* Th | {
"filepath": "src/Symfony/Component/Form/ChoiceList/Loader/ChoiceLoaderInterface.php",
"language": "php",
"file_size": 2690,
"cut_index": 563,
"middle_length": 229
} |
ge.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\ChoiceList\Loader;
/**
* A decorator to filter choices only when they are loaded or partially load... | ble
{
$list = $this->decoratedLoader->loadChoiceList();
if (array_values($list->getValues()) === array_values($structuredValues = $list->getStructuredValues())) {
return array_filter(array_combine($list->getOriginalKeys(), | e $filter;
public function __construct(ChoiceLoaderInterface $loader, callable $filter)
{
$this->decoratedLoader = $loader;
$this->filter = $filter(...);
}
protected function loadChoices(): itera | {
"filepath": "src/Symfony/Component/Form/ChoiceList/Loader/FilterChoiceLoaderDecorator.php",
"language": "php",
"file_size": 2082,
"cut_index": 563,
"middle_length": 229
} |
?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\ChoiceList\Loader;
/**
* Callback choice loader ... | hoices, ?callable $value = null): array
{
$choices = array_filter($choices);
// If no callable is set, choices are the same as values
if (null === $value) {
return $choices;
}
return parent::loadVal |
{
public function loadChoicesForValues(array $values, ?callable $value = null): array
{
return parent::loadChoicesForValues(array_filter($values), $value);
}
public function loadValuesForChoices(array $c | {
"filepath": "src/Symfony/Component/Form/ChoiceList/Loader/IntlCallbackChoiceLoader.php",
"language": "php",
"file_size": 1039,
"cut_index": 513,
"middle_length": 229
} |
part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\ChoiceList\Loader;
use Symfony\Component\Form\ChoiceList\ArrayChoiceList;... | public function loadChoiceList(?callable $value = null): ChoiceListInterface
{
return $this->choiceList ??= new ArrayChoiceList([], $value);
}
public function loadChoicesForValues(array $values, ?callable $value = null): array
{
| .com>
*/
class LazyChoiceLoader implements ChoiceLoaderInterface
{
private ?ChoiceListInterface $choiceList = null;
public function __construct(
private readonly ChoiceLoaderInterface $loader,
) {
}
| {
"filepath": "src/Symfony/Component/Form/ChoiceList/Loader/LazyChoiceLoader.php",
"language": "php",
"file_size": 1541,
"cut_index": 537,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Form\ChoiceList\Factory;
use Symfony\Component\Form\ChoiceList\ChoiceListInterface;
use Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface;
use Symfony\Component\Form\ChoiceList\View\ChoiceListView;
use Symfony\Contracts\Service\ResetInterface;
... | ace[]
*/
private array $lists = [];
/**
* @var ChoiceListView[]
*/
private array $views = [];
/**
* Generates a SHA-256 hash for the given value.
*
* Optionally, a namespace string can be passed. Calling this | on.
*
* @author Bernhard Schussek <bschussek@gmail.com>
* @author Jules Pietri <jules@heahprod.com>
*/
class CachingFactoryDecorator implements ChoiceListFactoryInterface, ResetInterface
{
/**
* @var ChoiceListInterf | {
"filepath": "src/Symfony/Component/Form/ChoiceList/Factory/CachingFactoryDecorator.php",
"language": "php",
"file_size": 6876,
"cut_index": 716,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\ChoiceList\Factory;
use Symfony\Component\Form\ChoiceList\ChoiceListInterface;
use Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface;
use... | ce values.
* The callable receives the choice as only argument.
* Null may be passed when the choice list contains the empty value.
*
* @param callable|null $filter The callable filtering the choices
*/
public function createLi | toryInterface
{
/**
* Creates a choice list for the given choices.
*
* The choices should be passed in the values of the choices array.
*
* Optionally, a callable can be passed for generating the choi | {
"filepath": "src/Symfony/Component/Form/ChoiceList/Factory/ChoiceListFactoryInterface.php",
"language": "php",
"file_size": 4190,
"cut_index": 614,
"middle_length": 229
} |
Symfony\Component\Form\ChoiceList\LazyChoiceList;
use Symfony\Component\Form\ChoiceList\Loader\CallbackChoiceLoader;
use Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface;
use Symfony\Component\Form\ChoiceList\Loader\FilterChoiceLoaderDecorator;
use Symfony\Component\Form\ChoiceList\View\ChoiceGroupView;
... | blic function createListFromChoices(iterable $choices, ?callable $value = null, ?callable $filter = null): ChoiceListInterface
{
if ($filter) {
// filter the choice list lazily
return $this->createListFromLoader(new Filt | mentation of {@link ChoiceListFactoryInterface}.
*
* @author Bernhard Schussek <bschussek@gmail.com>
* @author Jules Pietri <jules@heahprod.com>
*/
class DefaultChoiceListFactory implements ChoiceListFactoryInterface
{
pu | {
"filepath": "src/Symfony/Component/Form/ChoiceList/Factory/DefaultChoiceListFactory.php",
"language": "php",
"file_size": 12191,
"cut_index": 921,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Form\ChoiceList\Factory;
use Symfony\Component\Form\ChoiceList\ChoiceListInterface;
use Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface;
use Symfony\Component\Form\ChoiceList\View\ChoiceListView;
use Symfony\Component\PropertyAccess\Exception... | actory);
*
* You can now pass property paths for generating choice values, labels, view
* indices, HTML attributes and for determining the preferred choices and the
* choice groups:
*
* // extract values from the $value property
* $list = $c | ;
use Symfony\Component\PropertyAccess\PropertyPathInterface;
/**
* Adds property path support to a choice list factory.
*
* Pass the decorated factory to the constructor:
*
* $decorator = new PropertyAccessDecorator($f | {
"filepath": "src/Symfony/Component/Form/ChoiceList/Factory/PropertyAccessDecorator.php",
"language": "php",
"file_size": 6956,
"cut_index": 716,
"middle_length": 229
} |
part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\ChoiceList\Factory\Cache;
use Symfony\Component\Form\ChoiceList\Factory\C... | i <jules@heahprod.com>
*/
abstract class AbstractStaticOption
{
private static array $options = [];
private bool|string|array|\Closure|ChoiceLoaderInterface $option;
/**
* @param mixed $option Any pseudo callable, array, string or bool | ionInterface;
use Symfony\Component\Form\FormTypeInterface;
/**
* A template decorator for static {@see ChoiceType} options.
*
* Used as fly weight for {@see CachingFactoryDecorator}.
*
* @internal
*
* @author Jules Pietr | {
"filepath": "src/Symfony/Component/Form/ChoiceList/Factory/Cache/AbstractStaticOption.php",
"language": "php",
"file_size": 1785,
"cut_index": 537,
"middle_length": 229
} |
This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\ChoiceList\Factory\Cache;
use Symfony\Component\Form\ChoiceL... | oader extends AbstractStaticOption implements ChoiceLoaderInterface
{
public function loadChoiceList(?callable $value = null): ChoiceListInterface
{
return $this->getOption()->loadChoiceList($value);
}
public function loadChoicesFo | ;
/**
* A cacheable wrapper for {@see FormTypeInterface} or {@see FormTypeExtensionInterface}
* which configures a "choice_loader" option.
*
* @internal
*
* @author Jules Pietri <jules@heahprod.com>
*/
final class ChoiceL | {
"filepath": "src/Symfony/Component/Form/ChoiceList/Factory/Cache/ChoiceLoader.php",
"language": "php",
"file_size": 1329,
"cut_index": 524,
"middle_length": 229
} |
n Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\ChoiceList\View;
/**
* Represents a group of choices in templates.
*
* @author Bernhard Schussek <bschussek@gmail.c... | oices the choice views in the group
*/
public function __construct(
public string $label,
public array $choices = [],
) {
}
/**
* @return \Traversable<array-key, ChoiceGroupView|ChoiceView>
*/
public func |
* @param array<ChoiceGroupView|ChoiceView> $ch | {
"filepath": "src/Symfony/Component/Form/ChoiceList/View/ChoiceGroupView.php",
"language": "php",
"file_size": 988,
"cut_index": 582,
"middle_length": 52
} |
part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\ChoiceList\View;
/**
* Represents a choice list in templates.
*
* A ch... | views
* @param array<ChoiceGroupView|ChoiceView> $preferredChoices the preferred choice views
*/
public function __construct(
public array $choices = [],
public array $preferredChoices = [],
) {
}
/**
* Retur | View} instances.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*/
class ChoiceListView
{
/**
* Creates a new choice list view.
*
* @param array<ChoiceGroupView|ChoiceView> $choices The choice | {
"filepath": "src/Symfony/Component/Form/ChoiceList/View/ChoiceListView.php",
"language": "php",
"file_size": 1558,
"cut_index": 537,
"middle_length": 229
} |
This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\ChoiceList\View;
use Symfony\Contracts\Translation\Translata... | atableInterface|false $label The label displayed to humans; pass false to discard the label
* @param array $attr Additional attributes for the HTML tag
* @param array | ram mixed $data The original choice
* @param string $value The view representation of the choice
* @param string|Transl | {
"filepath": "src/Symfony/Component/Form/ChoiceList/View/ChoiceView.php",
"language": "php",
"file_size": 1370,
"cut_index": 524,
"middle_length": 229
} |
Completion\CompletionInput;
use Symfony\Component\Console\Completion\CompletionSuggestions;
use Symfony\Component\Console\Exception\InvalidArgumentException;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfon... | mation about form types.
*
* @author Yonel Ceruto <yonelceruto@gmail.com>
*/
#[AsCommand(name: 'debug:form', description: 'Display form type information')]
class DebugCommand extends Command
{
public function __construct(
private FormRegistr | sole\Helper\DescriptorHelper;
use Symfony\Component\Form\Extension\Core\CoreExtension;
use Symfony\Component\Form\FormRegistryInterface;
use Symfony\Component\Form\FormTypeInterface;
/**
* A console command for retrieving infor | {
"filepath": "src/Symfony/Component/Form/Command/DebugCommand.php",
"language": "php",
"file_size": 11349,
"cut_index": 921,
"middle_length": 229
} |
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Tests;
use PHPUnit\Framework\TestCase;
use Symfony\Com... | public function testGetType()
{
$loader = new ConcreteExtension();
$this->assertInstanceOf(FooType::class, $loader->getType('Symfony\Component\Form\Tests\Fixtures\FooType'));
}
}
class ConcreteExtension extends AbstractExtension | c function testHasType()
{
$loader = new ConcreteExtension();
$this->assertTrue($loader->hasType('Symfony\Component\Form\Tests\Fixtures\FooType'));
$this->assertFalse($loader->hasType('foo'));
}
| {
"filepath": "src/Symfony/Component/Form/Tests/AbstractExtensionTest.php",
"language": "php",
"file_size": 1175,
"cut_index": 518,
"middle_length": 229
} |
\Component\Form\FormBuilder;
use Symfony\Component\Form\FormError;
use Symfony\Component\Form\FormFactory;
use Symfony\Component\Form\FormRegistry;
use Symfony\Component\Form\Forms;
use Symfony\Component\Form\RequestHandlerInterface;
use Symfony\Component\Form\ResolvedFormTypeFactory;
use Symfony\Component\Form\Tests\E... | $this->serverParams = new class extends ServerParams {
public ?int $contentLength = null;
public string $postMaxSize = '';
public function getContentLength(): ?int
{
return $this->contentLeng | Case
{
protected RequestHandlerInterface $requestHandler;
protected FormFactory $factory;
protected mixed $request = null;
protected ServerParams $serverParams;
protected function setUp(): void
{
| {
"filepath": "src/Symfony/Component/Form/Tests/AbstractRequestHandlerTestCase.php",
"language": "php",
"file_size": 22132,
"cut_index": 1331,
"middle_length": 229
} |
part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Tests;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framewo... | rovider('getValidNames')]
public function testValidNames($name)
{
$this->assertInstanceOf(ButtonBuilder::class, new ButtonBuilder($name));
}
public function testNameContainingIllegalCharacters()
{
$this->expectException | uilderTest extends TestCase
{
public static function getValidNames()
{
return [
['reset'],
['submit'],
['foo'],
['0'],
[0],
];
}
#[DataP | {
"filepath": "src/Symfony/Component/Form/Tests/ButtonBuilderTest.php",
"language": "php",
"file_size": 1785,
"cut_index": 537,
"middle_length": 229
} |
ge.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Tests;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\C... | public function testSetParentOnSubmittedButton()
{
$this->expectException(AlreadySubmittedException::class);
$button = $this->getButtonBuilder('button')
->getForm()
;
$button->submit('');
$button->s | Symfony\Component\Form\FormFactory;
use Symfony\Component\Form\FormRegistry;
use Symfony\Component\Form\ResolvedFormTypeFactory;
/**
* @author Bernhard Schussek <bschussek@gmail.com>
*/
class ButtonTest extends TestCase
{
| {
"filepath": "src/Symfony/Component/Form/Tests/ButtonTest.php",
"language": "php",
"file_size": 2141,
"cut_index": 563,
"middle_length": 229
} |
file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Tests;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Form... | ic fn ($value) => $value.' has reversely been transformed'
);
$this->assertEquals('foo has been transformed', $transformer->transform('foo'));
$this->assertEquals('bar has reversely been transformed', $transformer->reverseTransform | => $value.' has been transformed',
stat | {
"filepath": "src/Symfony/Component/Form/Tests/CallbackTransformerTest.php",
"language": "php",
"file_size": 855,
"cut_index": 529,
"middle_length": 52
} |
part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Tests;
use PHPUnit\Framework\Attributes\Group;
use Symfony\Component\Form... | = $this->factory->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType')
->add('firstName', 'Symfony\Component\Form\Extension\Core\Type\TextType')
->add('lastName', 'Symfony\Component\Form\Extension\Core\Type\T | form multiple times, as happens in a collection form.
*/
#[Group('benchmark')]
public function testArrayBasedForm()
{
$this->setMaxRunningTime(1);
for ($i = 0; $i < 40; ++$i) {
$form | {
"filepath": "src/Symfony/Component/Form/Tests/CompoundFormPerformanceTest.php",
"language": "php",
"file_size": 1762,
"cut_index": 537,
"middle_length": 229
} |
Symfony\Component\PropertyAccess\PropertyAccess;
class CompoundFormTest extends TestCase
{
private FormFactory $factory;
private FormInterface $form;
protected function setUp(): void
{
$this->factory = new FormFactory(new FormRegistry([], new ResolvedFormTypeFactory()));
$this->form =... | on testInvalidIfChildIsInvalid()
{
$this->form->add($this->getBuilder('firstName')->getForm());
$this->form->add($this->getBuilder('lastName')->getForm());
$this->form->submit([
'firstName' => 'Bernhard',
| Builder('lastName')->getForm());
$this->form->submit([
'firstName' => 'Bernhard',
'lastName' => 'Schussek',
]);
$this->assertTrue($this->form->isValid());
}
public functi | {
"filepath": "src/Symfony/Component/Form/Tests/CompoundFormTest.php",
"language": "php",
"file_size": 35437,
"cut_index": 2151,
"middle_length": 229
} |
part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Extension\Core\DataTransformer;
use Symfony\Component\Form\DataTransforme... | [];
foreach ($this->keys as $key) {
$result[$key] = $value;
}
return $result;
}
public function reverseTransform(mixed $array): mixed
{
if (!\is_array($array)) {
throw new Transformati |
*/
class ValueToDuplicatesTransformer implements DataTransformerInterface
{
public function __construct(
private array $keys,
) {
}
public function transform(mixed $value): array
{
$result = | {
"filepath": "src/Symfony/Component/Form/Extension/Core/DataTransformer/ValueToDuplicatesTransformer.php",
"language": "php",
"file_size": 1870,
"cut_index": 537,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Form\Tests;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Form\EnumFormTypeGuesser;
use Symfony\Component\Form\Extension\Core\Type\EnumType as FormEnumType;
use Symfony\Component\Form\Guess\Guess;
use S... | ssType(?TypeGuess $expectedTypeGuess, string $class, string $property)
{
$typeGuesser = new EnumFormTypeGuesser();
$typeGuess = $typeGuesser->guessType($class, $property);
self::assertEquals($expectedTypeGuess, $typeGuess);
| s\Fixtures\EnumFormTypeGuesserCase;
use Symfony\Component\Form\Tests\Fixtures\EnumFormTypeGuesserCaseEnum;
class EnumFormTypeGuesserTest extends TestCase
{
#[DataProvider('provideGuessTypeCases')]
public function testGue | {
"filepath": "src/Symfony/Component/Form/Tests/EnumFormTypeGuesserTest.php",
"language": "php",
"file_size": 5727,
"cut_index": 716,
"middle_length": 229
} |
part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Extension\Core\DataMapper;
use Symfony\Component\Form\DataMapperInterface... | plements DataMapperInterface
{
public function mapDataToForms(mixed $choices, \Traversable $checkboxes): void
{
if (!\is_array($choices ??= [])) {
throw new UnexpectedTypeException($choices, 'array');
}
foreach | ding string values for the choices. Each checkbox form whose "value"
* option corresponds to any of the selected values is marked as selected.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*/
class CheckboxListMapper im | {
"filepath": "src/Symfony/Component/Form/Extension/Core/DataMapper/CheckboxListMapper.php",
"language": "php",
"file_size": 1699,
"cut_index": 537,
"middle_length": 229
} |
part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Extension\Core\DataMapper;
use Symfony\Component\Form\DataMapperInterface... | rInterface
{
public function mapDataToForms(mixed $choice, \Traversable $radios): void
{
if (!\is_string($choice)) {
throw new UnexpectedTypeException($choice, 'string');
}
foreach ($radios as $radio) {
| g string values for the choices. The radio form whose "value"
* option corresponds to the selected value is marked as selected.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*/
class RadioListMapper implements DataMappe | {
"filepath": "src/Symfony/Component/Form/Extension/Core/DataMapper/RadioListMapper.php",
"language": "php",
"file_size": 1698,
"cut_index": 537,
"middle_length": 229
} |
part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Extension\HtmlSanitizer\Type;
use Psr\Container\ContainerInterface;
use S... | blic function __construct(
private ContainerInterface $sanitizers,
private string $defaultSanitizer = 'default',
) {
}
public static function getExtendedTypes(): iterable
{
return [TextType::class];
}
publi | Symfony\Component\Form\FormEvents;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
* @author Titouan Galopin <galopintitouan@gmail.com>
*/
class TextTypeHtmlSanitizerExtension extends AbstractTypeExtension
{
pu | {
"filepath": "src/Symfony/Component/Form/Extension/HtmlSanitizer/Type/TextTypeHtmlSanitizerExtension.php",
"language": "php",
"file_size": 2006,
"cut_index": 537,
"middle_length": 229
} |
part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Exception;
/**
* Indicates a value transformation error.
*
* @author B... |
$this->setInvalidMessage($invalidMessage, $invalidMessageParameters);
}
/**
* Sets the message that will be shown to the user.
*
* @param string|null $invalidMessage The message or message key
* @param array | public function __construct(string $message = '', int $code = 0, ?\Throwable $previous = null, ?string $invalidMessage = null, array $invalidMessageParameters = [])
{
parent::__construct($message, $code, $previous);
| {
"filepath": "src/Symfony/Component/Form/Exception/TransformationFailedException.php",
"language": "php",
"file_size": 1557,
"cut_index": 537,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Form\Extension\Core\DataTransformer;
use Symfony\Component\Form\Exception\TransformationFailedException;
/**
* Transforms between a normalized time and a localized time string/array.
*
* @author Bernhard Schussek <bschussek@gmail.com>
* @author Florian... | fields
* @param bool $pad Whether to use padding
*/
public function __construct(
?string $inputTimezone = null,
?string $outputTimezone = null,
?array $fields = null,
private bool $pad = fal | vate \DateTimeInterface $referenceDate;
/**
* @param string|null $inputTimezone The input timezone
* @param string|null $outputTimezone The output timezone
* @param string[]|null $fields The date | {
"filepath": "src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToArrayTransformer.php",
"language": "php",
"file_size": 5906,
"cut_index": 716,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Form\Extension\Core\DataTransformer;
use Symfony\Component\Form\Exception\InvalidArgumentException;
use Symfony\Component\Form\Exception\TransformationFailedException;
use Symfony\Component\Form\Exception\UnexpectedTypeException;
/**
* Transforms between ... | net/browse/CLDR-14032
*/
private const NO_BREAK_SPACE = "\u{00A0}";
private const NARROW_NO_BREAK_SPACE = "\u{202F}"; // Used by ICU 72+ before AM/PM
private const THIN_SPACE = "\u{2009}";
private int $dateFormat;
private int $tim | former<string>
*/
class DateTimeToLocalizedStringTransformer extends BaseDateTimeTransformer
{
/**
* Unicode whitespace characters used by ICU in formatted date strings.
*
* @see https://unicode-org.atlassian. | {
"filepath": "src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformer.php",
"language": "php",
"file_size": 9034,
"cut_index": 716,
"middle_length": 229
} |
ge.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Extension\Core\DataTransformer;
use Symfony\Component\Form\Exception\TransformationFailedException;... | ted a \DateTimeInterface.');
}
if ($this->inputTimezone !== $this->outputTimezone) {
$dateTime = \DateTimeImmutable::createFromInterface($dateTime);
$dateTime = $dateTime->setTimezone(new \DateTimeZone($this->output | tion transform(mixed $dateTime): ?string
{
if (null === $dateTime) {
return '';
}
if (!$dateTime instanceof \DateTimeInterface) {
throw new TransformationFailedException('Expec | {
"filepath": "src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToRfc3339Transformer.php",
"language": "php",
"file_size": 2291,
"cut_index": 563,
"middle_length": 229
} |
ge.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Extension\Core\DataTransformer;
use Symfony\Component\Form\DataTransformerInterface;
use Symfony\Co... | ate bool $multiple = false,
) {
}
public function transform(mixed $dateTimeZone): mixed
{
if (null === $dateTimeZone) {
return null;
}
if ($this->multiple) {
if (!\is_array($dateTimeZone)) { | m>
*
* @implements DataTransformerInterface<\DateTimeZone|array<\DateTimeZone>, string|array<string>>
*/
class DateTimeZoneToStringTransformer implements DataTransformerInterface
{
public function __construct(
priv | {
"filepath": "src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeZoneToStringTransformer.php",
"language": "php",
"file_size": 2205,
"cut_index": 563,
"middle_length": 229
} |
ge.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Extension\Core\DataTransformer;
use Symfony\Component\Form\DataTransformerInterface;
use Symfony\Co... | ate bool $multiple = false,
) {
}
public function transform(mixed $intlTimeZone): mixed
{
if (null === $intlTimeZone) {
return null;
}
if ($this->multiple) {
if (!\is_array($intlTimeZone)) { | m>
*
* @implements DataTransformerInterface<\IntlTimeZone|array<\IntlTimeZone>, string|array<string>>
*/
class IntlTimeZoneToStringTransformer implements DataTransformerInterface
{
public function __construct(
priv | {
"filepath": "src/Symfony/Component/Form/Extension/Core/DataTransformer/IntlTimeZoneToStringTransformer.php",
"language": "php",
"file_size": 2278,
"cut_index": 563,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Form\Extension\Core\DataTransformer;
use Symfony\Component\Form\DataTransformerInterface;
use Symfony\Component\Form\Exception\TransformationFailedException;
/**
* Transforms between a number type and a localized number with grouping
* (each thousand) an... | ool $grouping = false,
?int $roundingMode = \NumberFormatter::ROUND_HALFUP,
private ?string $locale = null,
) {
$this->grouping = $grouping ?? false;
$this->roundingMode = $roundingMode ?? \NumberFormatter::ROUND_HALFUP; | g>
*/
class NumberToLocalizedStringTransformer implements DataTransformerInterface
{
protected bool $grouping;
protected int $roundingMode;
public function __construct(
private ?int $scale = null,
?b | {
"filepath": "src/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php",
"language": "php",
"file_size": 7062,
"cut_index": 716,
"middle_length": 229
} |
This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Extension\Core\DataTransformer;
use Symfony\Component\Form\D... | turn null;
}
if (!\is_string($value) || !is_numeric($value)) {
throw new TransformationFailedException('Expected a numeric string.');
}
return (float) $value;
}
public function reverseTransform(mixed $ | mer implements DataTransformerInterface
{
public function __construct(
private ?int $scale = null,
) {
}
public function transform(mixed $value): ?float
{
if (null === $value) {
re | {
"filepath": "src/Symfony/Component/Form/Extension/Core/DataTransformer/StringToFloatTransformer.php",
"language": "php",
"file_size": 1395,
"cut_index": 524,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Util;
use Symfony\Component\HttpFoundation\File\UploadedFile;
/**
* @author Bernhard Schussek <bschussek@gmail.com>
*/
class FormUtil
{
/**
... | ol
{
// Should not do a check for [] === $data!!!
// This method is used in occurrences where arrays are
// not considered to be empty, ever.
return null === $data || '' === $data;
}
/**
* Merges query stri | ltiple times throughout the processing of
* a form and needs to be consistent. PHP keyword `empty` cannot
* be used as it also considers 0 and "0" to be empty.
*/
public static function isEmpty(mixed $data): bo | {
"filepath": "src/Symfony/Component/Form/Util/FormUtil.php",
"language": "php",
"file_size": 3589,
"cut_index": 614,
"middle_length": 229
} |
ge.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Util;
use Symfony\Component\OptionsResolver\Exception\AccessException;
use Symfony\Component\Option... | ::setNormalizer($option, $normalizer);
} catch (UndefinedOptionsException) {
$this->undefined[$option] = true;
}
return $this;
}
/**
* @return $this
*/
public function setAllowedValues(string $opt | lverWrapper extends OptionsResolver
{
private array $undefined = [];
/**
* @return $this
*/
public function setNormalizer(string $option, \Closure $normalizer): static
{
try {
parent | {
"filepath": "src/Symfony/Component/Form/Util/OptionsResolverWrapper.php",
"language": "php",
"file_size": 2628,
"cut_index": 563,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Util;
/**
* A hash map which keeps track of deletions and additions.
*
* Like in associative arrays, elements can be mapped to integer or string ke... | d by the iterator,
* changed elements are not. Otherwise the loop could be infinite if each loop
* changes the current element:
*
* $map = new OrderedHashMap();
* $map[1] = 1;
* $map[2] = 2;
* $map[3] = 3;
*
* foreach ($map as | tion during iteration. That means that
* you can insert and remove elements from within a foreach loop and the
* iterator will reflect those changes accordingly.
*
* While elements that are added during the loop are recognize | {
"filepath": "src/Symfony/Component/Form/Util/OrderedHashMap.php",
"language": "php",
"file_size": 4276,
"cut_index": 614,
"middle_length": 229
} |
ge.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Util;
use Symfony\Component\HttpFoundation\RequestStack;
/**
* @author Bernhard Schussek <bschuss... | ntLength && $contentLength > $maxContentLength;
}
/**
* Returns maximum post size in bytes.
*/
public function getPostMaxSize(): int|float|null
{
$iniMax = strtolower($this->getNormalizedIniPostMaxSize());
if ('' | been exceeded in the request.
*/
public function hasPostMaxSizeBeenExceeded(): bool
{
$contentLength = $this->getContentLength();
$maxContentLength = $this->getPostMaxSize();
return $maxConte | {
"filepath": "src/Symfony/Component/Form/Util/ServerParams.php",
"language": "php",
"file_size": 2294,
"cut_index": 563,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Extension\Core\DataTransformer;
use Symfony\Component\Form\DataTransformerInterface;
use Symfony\Component\Form\Exception\TransformationFailedExceptio... | ll];
}
if (!\is_string($value)) {
throw new TransformationFailedException(\sprintf('Value is expected to be a string but was "%s".', get_debug_type($value)));
}
if (0 === preg_match('/^(?P<year>\d{4})-W(?P<week | ull, week: int|null}>
*/
class WeekToArrayTransformer implements DataTransformerInterface
{
public function transform(mixed $value): array
{
if (null === $value) {
return ['year' => null, 'week' => nu | {
"filepath": "src/Symfony/Component/Form/Extension/Core/DataTransformer/WeekToArrayTransformer.php",
"language": "php",
"file_size": 3135,
"cut_index": 614,
"middle_length": 229
} |
he Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Extension\HtmlSanitizer;
use Psr\Container\ContainerInterface;
use Symfony\Componen... | rivate ContainerInterface $sanitizers,
private string $defaultSanitizer = 'default',
) {
}
protected function loadTypeExtensions(): array
{
return [
new Type\TextTypeHtmlSanitizerExtension($this->sanitizers, $th | tension
{
public function __construct(
p | {
"filepath": "src/Symfony/Component/Form/Extension/HtmlSanitizer/HtmlSanitizerExtension.php",
"language": "php",
"file_size": 897,
"cut_index": 547,
"middle_length": 52
} |
This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Extension\Core\DataTransformer;
use Symfony\Component\Form\D... | ansform(mixed $value): ?\DateTime
{
if (null === $value) {
return null;
}
if (!$value instanceof \DateTimeImmutable) {
throw new TransformationFailedException('Expected a \DateTimeImmutable.');
} | Udaltsov <udaltsov.valentin@gmail.com>
*
* @implements DataTransformerInterface<\DateTimeImmutable, \DateTime>
*/
final class DateTimeImmutableToDateTimeTransformer implements DataTransformerInterface
{
public function tr | {
"filepath": "src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeImmutableToDateTimeTransformer.php",
"language": "php",
"file_size": 1421,
"cut_index": 524,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Extension\Core\DataTransformer;
use Symfony\Component\Form\Exception\TransformationFailedException;
/**
* Transforms between a date string and a Dat... | e {@link $generateFormat} because formats for parsing
* support additional characters in PHP that are not supported for
* generating strings.
*/
private string $parseFormat;
/**
* Transforms a \DateTime instance to a string.
| ToStringTransformer extends BaseDateTimeTransformer
{
/**
* Format used for generating strings.
*/
private string $generateFormat;
/**
* Format used for parsing strings.
*
* Different than th | {
"filepath": "src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToStringTransformer.php",
"language": "php",
"file_size": 4201,
"cut_index": 614,
"middle_length": 229
} |
part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Extension\Core\DataTransformer;
use Symfony\Component\Form\Exception\Tran... | Time) {
return null;
}
if (!$dateTime instanceof \DateTimeInterface) {
throw new TransformationFailedException('Expected a \DateTimeInterface.');
}
return $dateTime->getTimestamp();
}
publi | rfer.org>
*
* @extends BaseDateTimeTransformer<int|numeric-string>
*/
class DateTimeToTimestampTransformer extends BaseDateTimeTransformer
{
public function transform(mixed $dateTime): ?int
{
if (null === $date | {
"filepath": "src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToTimestampTransformer.php",
"language": "php",
"file_size": 1780,
"cut_index": 537,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Form\Extension\Core\DataTransformer;
use Symfony\Component\Form\DataTransformerInterface;
use Symfony\Component\Form\Exception\TransformationFailedException;
use Symfony\Component\Form\Exception\UnexpectedTypeException;
/**
* Transforms between a normaliz... | $types = [
self::FRACTIONAL,
self::INTEGER,
];
private string $type;
private int $scale;
/**
* @see self::$types for a list of supported types
*
* @param int $roundingMode A value from \NumberFormatter, su | sformerInterface<int|float, string>
*/
class PercentToLocalizedStringTransformer implements DataTransformerInterface
{
public const FRACTIONAL = 'fractional';
public const INTEGER = 'integer';
protected static array | {
"filepath": "src/Symfony/Component/Form/Extension/Core/DataTransformer/PercentToLocalizedStringTransformer.php",
"language": "php",
"file_size": 7219,
"cut_index": 716,
"middle_length": 229
} |
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Util;
/**
* Iterator that traverses an array of... | tor implements \RecursiveIterator
{
public function getChildren(): static
{
return new static($this->current());
}
public function hasChildren(): bool
{
return (bool) $this->current()->getConfig()->getInheritData();
| in order to
* enter any child form that inherits its parent's data and iterate the children
* of that form as well.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*/
class InheritDataAwareIterator extends \IteratorItera | {
"filepath": "src/Symfony/Component/Form/Util/InheritDataAwareIterator.php",
"language": "php",
"file_size": 1002,
"cut_index": 512,
"middle_length": 229
} |
part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Util;
/**
* @author Issei Murasawa <issei.m7@gmail.com>
* @author Bernh... | }
return trim($string);
}
/**
* Converts both CRLF and CR to LF.
*/
public static function normalizeNewlines(string $string): string
{
return str_replace(["\r\n", "\r"], "\n", $string);
}
/**
* Con | he trimmed data.
*/
public static function trim(string $string): string
{
if (null !== $result = @preg_replace('/^[\pZ\p{Cc}\p{Cf}]+|[\pZ\p{Cc}\p{Cf}]+$/u', '', $string)) {
return $result;
| {
"filepath": "src/Symfony/Component/Form/Util/StringUtil.php",
"language": "php",
"file_size": 1528,
"cut_index": 537,
"middle_length": 229
} |
ge.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Extension\Core\DataMapper;
use Symfony\Component\Form\DataAccessorInterface;
use Symfony\Component\... | com>
*/
class DataMapper implements DataMapperInterface
{
private DataAccessorInterface $dataAccessor;
public function __construct(?DataAccessorInterface $dataAccessor = null)
{
$this->dataAccessor = $dataAccessor ?? new ChainAccessor | nsion\Core\DataAccessor\ChainAccessor;
use Symfony\Component\Form\Extension\Core\DataAccessor\PropertyPathAccessor;
/**
* Maps arrays/objects to/from forms using data accessors.
*
* @author Bernhard Schussek <bschussek@gmail. | {
"filepath": "src/Symfony/Component/Form/Extension/Core/DataMapper/DataMapper.php",
"language": "php",
"file_size": 2775,
"cut_index": 563,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Extension\Core\DataTransformer;
use Symfony\Component\Form\Exception\TransformationFailedException;
/**
* @author Franz Wilding <franz.wilding@me.co... | null, private bool $withSeconds = false)
{
parent::__construct($inputTimezone, $outputTimezone);
}
/**
* According to the HTML standard, the input string of a datetime-local
* input is an RFC3339 date followed by 'T', followe | tends BaseDateTimeTransformer
{
public const HTML5_FORMAT = 'Y-m-d\\TH:i:s';
public const HTML5_FORMAT_NO_SECONDS = 'Y-m-d\\TH:i';
public function __construct(?string $inputTimezone = null, ?string $outputTimezone = | {
"filepath": "src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToHtml5LocalDateTimeTransformer.php",
"language": "php",
"file_size": 3583,
"cut_index": 614,
"middle_length": 229
} |
ge.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Extension\Core\DataTransformer;
use Symfony\Component\Form\Exception\TransformationFailedException;... | de = \NumberFormatter::ROUND_HALFUP,
?int $divisor = 1,
?string $locale = null,
private readonly string $input = 'float',
) {
parent::__construct($scale ?? 2, $grouping ?? true, $roundingMode, $locale);
$this->d | */
class MoneyToLocalizedStringTransformer extends NumberToLocalizedStringTransformer
{
private int $divisor;
public function __construct(
?int $scale = 2,
?bool $grouping = true,
?int $roundingMo | {
"filepath": "src/Symfony/Component/Form/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformer.php",
"language": "php",
"file_size": 2063,
"cut_index": 563,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Util;
/**
* Iterator for {@link OrderedHashMap} objects.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @internal
*
* @template-covari... | ram list<string> $orderedKeys The keys of the map in the order in which
* they should be iterated
* @param array<int, int> $managedCursors An array from which to reference the
* | = null;
/** @var TValue|null */
private mixed $current = null;
/**
* @param TValue[] $elements The elements of the map, indexed by their
* keys
* @pa | {
"filepath": "src/Symfony/Component/Form/Util/OrderedHashMapIterator.php",
"language": "php",
"file_size": 3274,
"cut_index": 614,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Extension\DependencyInjection;
use Psr\Container\ContainerInterface;
use Symfony\Component\Form\Exception\InvalidArgumentException;
use Symfony\Compon... | m array<string, iterable<FormTypeExtensionInterface>> $typeExtensionServices
*/
public function __construct(
private ContainerInterface $typeContainer,
private array $typeExtensionServices,
private iterable $guesserServices | e Symfony\Component\Form\FormTypeInterface;
class DependencyInjectionExtension implements FormExtensionInterface
{
private ?FormTypeGuesserChain $guesser = null;
private bool $guesserLoaded = false;
/**
* @para | {
"filepath": "src/Symfony/Component/Form/Extension/DependencyInjection/DependencyInjectionExtension.php",
"language": "php",
"file_size": 3104,
"cut_index": 614,
"middle_length": 229
} |
part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Extension\Core\DataTransformer;
use Symfony\Component\Form\DataTransforme... | ll === $value) {
return null;
}
if (!$value instanceof Ulid) {
throw new TransformationFailedException('Expected a Ulid.');
}
return (string) $value;
}
public function reverseTransform(mixe | Dyakonov <wapinet@mail.ru>
*
* @implements DataTransformerInterface<Ulid, string>
*/
class UlidToStringTransformer implements DataTransformerInterface
{
public function transform(mixed $value): ?string
{
if (nu | {
"filepath": "src/Symfony/Component/Form/Extension/Core/DataTransformer/UlidToStringTransformer.php",
"language": "php",
"file_size": 1521,
"cut_index": 537,
"middle_length": 229
} |
part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Extension\Core\DataTransformer;
use Symfony\Component\Form\Exception\Tran... | aram int|null $roundingMode One of the ROUND_ constants in this class
* @param string|null $locale locale used for transforming
*/
public function __construct(?bool $grouping = false, ?int $roundingMode = \NumberFormatter::ROUND_DOWN | com>
*/
class IntegerToLocalizedStringTransformer extends NumberToLocalizedStringTransformer
{
/**
* Constructs a transformer.
*
* @param bool $grouping Whether thousands should be grouped
* @p | {
"filepath": "src/Symfony/Component/Form/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformer.php",
"language": "php",
"file_size": 1769,
"cut_index": 537,
"middle_length": 229
} |
ge.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Tests\Extension\DataCollector\Type;
use PHPUnit\Framework\TestCase;
use Symfony\Component\EventDisp... | omponent\Form\ResolvedFormTypeFactory;
class DataCollectorTypeExtensionTest extends TestCase
{
private DataCollectorTypeExtension $extension;
protected function setUp(): void
{
$this->extension = new DataCollectorTypeExtension(new For | xtension\DataCollector\Type\DataCollectorTypeExtension;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\Form\FormFactory;
use Symfony\Component\Form\FormRegistry;
use Symfony\C | {
"filepath": "src/Symfony/Component/Form/Tests/Extension/DataCollector/Type/DataCollectorTypeExtensionTest.php",
"language": "php",
"file_size": 2378,
"cut_index": 563,
"middle_length": 229
} |
ge.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Tests\Extension\HttpFoundation;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\... | ase;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\HttpFoundation\Request;
/**
* @author Bernhard Schussek <bschussek@gmail.com>
*/
class HttpFoundationRequestHandlerTest extends AbstractRequestHandlerTestCase
{
publi | ler;
use Symfony\Component\Form\Extension\HttpFoundation\Type\FormTypeHttpFoundationExtension;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\Forms;
use Symfony\Component\Form\Tests\AbstractRequestHandlerTestC | {
"filepath": "src/Symfony/Component/Form/Tests/Extension/HttpFoundation/HttpFoundationRequestHandlerTest.php",
"language": "php",
"file_size": 2974,
"cut_index": 563,
"middle_length": 229
} |
php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Tests\Extension\Validator\Type;
use Symfony\Compon... | actory->create(ChoiceType::class, null, $options);
}
public function testInvalidMessage()
{
$form = $this->createForm();
$this->assertSame('The selected choice is invalid.', $form->getConfig()->getOption('invalid_message'));
| eturn $this->f | {
"filepath": "src/Symfony/Component/Form/Tests/Extension/Validator/Type/ChoiceTypeValidatorExtensionTest.php",
"language": "php",
"file_size": 791,
"cut_index": 514,
"middle_length": 14
} |
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Tests\Extension\Validator\Type;
use Symfony\Component... | is->factory->create(CollectionType::class, null, $options);
}
public function testInvalidMessage()
{
$form = $this->createForm();
$this->assertSame('The collection is invalid.', $form->getConfig()->getOption('invalid_message') | return $th | {
"filepath": "src/Symfony/Component/Form/Tests/Extension/Validator/Type/CollectionTypeValidatorExtensionTest.php",
"language": "php",
"file_size": 798,
"cut_index": 517,
"middle_length": 14
} |
?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Tests\Extension\Validator\Type;
use Symfony\Compo... | ctory->create(ColorType::class, null, $options);
}
public function testInvalidMessage()
{
$form = $this->createForm();
$this->assertSame('Please select a valid color.', $form->getConfig()->getOption('invalid_message'));
}
| turn $this->fa | {
"filepath": "src/Symfony/Component/Form/Tests/Extension/Validator/Type/ColorTypeValidatorExtensionTest.php",
"language": "php",
"file_size": 785,
"cut_index": 513,
"middle_length": 14
} |
php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Tests\Extension\Validator\Type;
use Symfony\Compon... | >factory->create(CountryType::class, null, $options);
}
public function testInvalidMessage()
{
$form = $this->createForm();
$this->assertSame('Please select a valid country.', $form->getConfig()->getOption('invalid_message')); | return $this- | {
"filepath": "src/Symfony/Component/Form/Tests/Extension/Validator/Type/CountryTypeValidatorExtensionTest.php",
"language": "php",
"file_size": 793,
"cut_index": 514,
"middle_length": 14
} |
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Tests\Extension\Validator\Type;
use Symfony\Component... | factory->create(CurrencyType::class, null, $options);
}
public function testInvalidMessage()
{
$form = $this->createForm();
$this->assertSame('Please select a valid currency.', $form->getConfig()->getOption('invalid_message')) | return $this-> | {
"filepath": "src/Symfony/Component/Form/Tests/Extension/Validator/Type/CurrencyTypeValidatorExtensionTest.php",
"language": "php",
"file_size": 797,
"cut_index": 517,
"middle_length": 14
} |
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Tests\Extension\Validator\Type;
use Symfony\Component\Form... | s->factory->create(DateIntervalType::class, null, $options);
}
public function testInvalidMessage()
{
$form = $this->createForm();
$this->assertSame('Please choose a valid date interval.', $form->getConfig()->getOption('invali | return $thi | {
"filepath": "src/Symfony/Component/Form/Tests/Extension/Validator/Type/DateIntervalTypeValidatorExtensionTest.php",
"language": "php",
"file_size": 814,
"cut_index": 522,
"middle_length": 14
} |
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Tests\Extension\Validator\Type;
use Symfony\Component... | ull, $options + ['widget' => 'choice']);
}
public function testInvalidMessage()
{
$form = $this->createForm();
$this->assertSame('Please enter a valid date and time.', $form->getConfig()->getOption('invalid_message'));
}
} | return $this->factory->create(DateTimeType::class, n | {
"filepath": "src/Symfony/Component/Form/Tests/Extension/Validator/Type/DateTimeTypeValidatorExtensionTest.php",
"language": "php",
"file_size": 826,
"cut_index": 517,
"middle_length": 52
} |
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Tests\Extension\Validator\Type;
use Symfony\Component... | >create(DateType::class, null, $options + ['widget' => 'choice']);
}
public function testInvalidMessage()
{
$form = $this->createForm();
$this->assertSame('Please enter a valid date.', $form->getConfig()->getOption('invalid_me | this->factory- | {
"filepath": "src/Symfony/Component/Form/Tests/Extension/Validator/Type/DateTypeValidatorExtensionTest.php",
"language": "php",
"file_size": 805,
"cut_index": 517,
"middle_length": 14
} |
php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Tests\Extension\Validator\Type;
use Symfony\Compon... | tory->create(EmailType::class, null, $options);
}
public function testInvalidMessage()
{
$form = $this->createForm();
$this->assertSame('Please enter a valid email address.', $form->getConfig()->getOption('invalid_message'));
| urn $this->fac | {
"filepath": "src/Symfony/Component/Form/Tests/Extension/Validator/Type/EmailTypeValidatorExtensionTest.php",
"language": "php",
"file_size": 792,
"cut_index": 514,
"middle_length": 14
} |
alidatorExtension;
use Symfony\Component\Form\Form;
use Symfony\Component\Form\Forms;
use Symfony\Component\Form\Tests\Extension\Core\Type\CollectionTypeTest;
use Symfony\Component\Form\Tests\Extension\Core\Type\FormTypeTest;
use Symfony\Component\Form\Tests\Extension\Core\Type\TextTypeTest;
use Symfony\Component\Form\... | l;
use Symfony\Component\Validator\Constraints\Valid;
use Symfony\Component\Validator\Mapping\ClassMetadata;
use Symfony\Component\Validator\Mapping\Factory\MetadataFactoryInterface;
use Symfony\Component\Validator\Validation;
class FormTypeValidatorExten | onsException;
use Symfony\Component\Validator\Constraints\GroupSequence;
use Symfony\Component\Validator\Constraints\Length;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Constraints\NotNul | {
"filepath": "src/Symfony/Component/Form/Tests/Extension/Validator/Type/FormTypeValidatorExtensionTest.php",
"language": "php",
"file_size": 13847,
"cut_index": 921,
"middle_length": 229
} |
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Tests\Extension\Validator\Type;
use Symfony\Component\... | ry->create(HiddenType::class, null, $options);
}
public function testInvalidMessage()
{
$form = $this->createForm();
$this->assertSame('The hidden field is invalid.', $form->getConfig()->getOption('invalid_message'));
}
}
| n $this->facto | {
"filepath": "src/Symfony/Component/Form/Tests/Extension/Validator/Type/HiddenTypeValidatorExtensionTest.php",
"language": "php",
"file_size": 788,
"cut_index": 518,
"middle_length": 14
} |
?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Tests\Extension\Validator\Type;
use Symfony\Compo... | ->factory->create(IntegerType::class, null, $options);
}
public function testInvalidMessage()
{
$form = $this->createForm();
$this->assertSame('Please enter an integer.', $form->getConfig()->getOption('invalid_message'));
| return $this | {
"filepath": "src/Symfony/Component/Form/Tests/Extension/Validator/Type/IntegerTypeValidatorExtensionTest.php",
"language": "php",
"file_size": 787,
"cut_index": 513,
"middle_length": 14
} |
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Tests\Extension\Validator\Type;
use Symfony\Component... | factory->create(LanguageType::class, null, $options);
}
public function testInvalidMessage()
{
$form = $this->createForm();
$this->assertSame('Please select a valid language.', $form->getConfig()->getOption('invalid_message')) | return $this-> | {
"filepath": "src/Symfony/Component/Form/Tests/Extension/Validator/Type/LanguageTypeValidatorExtensionTest.php",
"language": "php",
"file_size": 797,
"cut_index": 517,
"middle_length": 14
} |
php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Tests\Extension\Validator\Type;
use Symfony\Compon... | actory->create(LocaleType::class, null, $options);
}
public function testInvalidMessage()
{
$form = $this->createForm();
$this->assertSame('Please select a valid locale.', $form->getConfig()->getOption('invalid_message'));
| eturn $this->f | {
"filepath": "src/Symfony/Component/Form/Tests/Extension/Validator/Type/LocaleTypeValidatorExtensionTest.php",
"language": "php",
"file_size": 789,
"cut_index": 514,
"middle_length": 14
} |
php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Tests\Extension\Validator\Type;
use Symfony\Compon... | tory->create(MoneyType::class, null, $options);
}
public function testInvalidMessage()
{
$form = $this->createForm();
$this->assertSame('Please enter a valid money amount.', $form->getConfig()->getOption('invalid_message'));
| urn $this->fac | {
"filepath": "src/Symfony/Component/Form/Tests/Extension/Validator/Type/MoneyTypeValidatorExtensionTest.php",
"language": "php",
"file_size": 791,
"cut_index": 514,
"middle_length": 14
} |
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Tests\Extension\Validator\Type;
use Symfony\Comp... | >factory->create(NumberType::class, null, $options);
}
public function testInvalidMessage()
{
$form = $this->createForm();
$this->assertSame('Please enter a number.', $form->getConfig()->getOption('invalid_message'));
}
}
| return $this- | {
"filepath": "src/Symfony/Component/Form/Tests/Extension/Validator/Type/NumberTypeValidatorExtensionTest.php",
"language": "php",
"file_size": 782,
"cut_index": 512,
"middle_length": 14
} |
php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Tests\Extension\Validator\Type;
use Symfony\Compon... | s->factory->create(PasswordType::class, null, $options);
}
public function testInvalidMessage()
{
$form = $this->createForm();
$this->assertSame('The password is invalid.', $form->getConfig()->getOption('invalid_message'));
| return $thi | {
"filepath": "src/Symfony/Component/Form/Tests/Extension/Validator/Type/PasswordTypeValidatorExtensionTest.php",
"language": "php",
"file_size": 790,
"cut_index": 514,
"middle_length": 14
} |
is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Tests\Extension\Validator\Type;
use Symfony\Component\Form\Extension\Co... | nding_mode' => \NumberFormatter::ROUND_CEILING]);
}
public function testInvalidMessage()
{
$form = $this->createForm();
$this->assertSame('Please enter a percentage value.', $form->getConfig()->getOption('invalid_message'));
| y->create(PercentType::class, null, $options + ['rou | {
"filepath": "src/Symfony/Component/Form/Tests/Extension/Validator/Type/PercentTypeValidatorExtensionTest.php",
"language": "php",
"file_size": 850,
"cut_index": 535,
"middle_length": 52
} |
?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Tests\Extension\Validator\Type;
use Symfony\Compo... | ctory->create(RadioType::class, null, $options);
}
public function testInvalidMessage()
{
$form = $this->createForm();
$this->assertSame('Please select a valid option.', $form->getConfig()->getOption('invalid_message'));
} | turn $this->fa | {
"filepath": "src/Symfony/Component/Form/Tests/Extension/Validator/Type/RadioTypeValidatorExtensionTest.php",
"language": "php",
"file_size": 786,
"cut_index": 513,
"middle_length": 14
} |
?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Tests\Extension\Validator\Type;
use Symfony\Compo... | ctory->create(RangeType::class, null, $options);
}
public function testInvalidMessage()
{
$form = $this->createForm();
$this->assertSame('Please choose a valid range.', $form->getConfig()->getOption('invalid_message'));
}
| turn $this->fa | {
"filepath": "src/Symfony/Component/Form/Tests/Extension/Validator/Type/RangeTypeValidatorExtensionTest.php",
"language": "php",
"file_size": 785,
"cut_index": 513,
"middle_length": 14
} |
php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Tests\Extension\Validator\Type;
use Symfony\Compon... | s->factory->create(RepeatedType::class, null, $options);
}
public function testInvalidMessage()
{
$form = $this->createForm();
$this->assertSame('The values do not match.', $form->getConfig()->getOption('invalid_message'));
| return $thi | {
"filepath": "src/Symfony/Component/Form/Tests/Extension/Validator/Type/RepeatedTypeValidatorExtensionTest.php",
"language": "php",
"file_size": 790,
"cut_index": 514,
"middle_length": 14
} |
php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Tests\Extension\Validator\Type;
use Symfony\Compon... | actory->create(SearchType::class, null, $options);
}
public function testInvalidMessage()
{
$form = $this->createForm();
$this->assertSame('Please enter a valid search term.', $form->getConfig()->getOption('invalid_message')); | eturn $this->f | {
"filepath": "src/Symfony/Component/Form/Tests/Extension/Validator/Type/SearchTypeValidatorExtensionTest.php",
"language": "php",
"file_size": 793,
"cut_index": 514,
"middle_length": 14
} |
?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Tests\Extension\Validator\Type;
use Symfony\Compo... | y->create(TelType::class, null, $options);
}
public function testInvalidMessage()
{
$form = $this->createForm();
$this->assertSame('Please provide a valid phone number.', $form->getConfig()->getOption('invalid_message'));
| $this->factor | {
"filepath": "src/Symfony/Component/Form/Tests/Extension/Validator/Type/TelTypeValidatorExtensionTest.php",
"language": "php",
"file_size": 787,
"cut_index": 513,
"middle_length": 14
} |
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Tests\Extension\Validator\Type;
use Symfony\Component... | >create(TimeType::class, null, $options + ['widget' => 'choice']);
}
public function testInvalidMessage()
{
$form = $this->createForm();
$this->assertSame('Please enter a valid time.', $form->getConfig()->getOption('invalid_me | this->factory- | {
"filepath": "src/Symfony/Component/Form/Tests/Extension/Validator/Type/TimeTypeValidatorExtensionTest.php",
"language": "php",
"file_size": 805,
"cut_index": 517,
"middle_length": 14
} |
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Tests\Extension\Validator\Type;
use Symfony\Component... | factory->create(TimezoneType::class, null, $options);
}
public function testInvalidMessage()
{
$form = $this->createForm();
$this->assertSame('Please select a valid timezone.', $form->getConfig()->getOption('invalid_message')) | return $this-> | {
"filepath": "src/Symfony/Component/Form/Tests/Extension/Validator/Type/TimezoneTypeValidatorExtensionTest.php",
"language": "php",
"file_size": 797,
"cut_index": 517,
"middle_length": 14
} |
part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Tests\Extension\Validator\Type;
use Symfony\Component\EventDispatcher\Eve... | ed function setUp(): void
{
$this->dispatcher = new EventDispatcher();
parent::setUp();
}
public function testPostMaxSizeTranslation()
{
$extension = new UploadValidatorExtension(new DummyTranslator());
$r | fony\Component\OptionsResolver\OptionsResolver;
use Symfony\Contracts\Translation\LocaleAwareInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
class UploadValidatorExtensionTest extends TypeTestCase
{
protect | {
"filepath": "src/Symfony/Component/Form/Tests/Extension/Validator/Type/UploadValidatorExtensionTest.php",
"language": "php",
"file_size": 1834,
"cut_index": 537,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Form\Tests\Extension\Validator\EventListener;
use PHPUnit\Framework\TestCase;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\Form\Extension\Core\DataMapper\DataMapper;
use Symfony\Component\Form\Extension\Validator\Constraints\... | ConstraintViolation;
use Symfony\Component\Validator\ConstraintViolationInterface;
use Symfony\Component\Validator\ConstraintViolationList;
use Symfony\Component\Validator\ConstraintViolationListInterface;
use Symfony\Component\Validator\Context\ExecutionC | fony\Component\Form\Form;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\FormConfigBuilder;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormFactoryBuilder;
use Symfony\Component\Validator\ | {
"filepath": "src/Symfony/Component/Form/Tests/Extension/Validator/EventListener/ValidationListenerTest.php",
"language": "php",
"file_size": 5604,
"cut_index": 716,
"middle_length": 229
} |
chronized()
{
$violation = $this->getConstraintViolation('children[address].data.street');
$parent = $this->getForm('parent');
$child = $this->getForm('address', 'address', null, [], false, false);
// even though "street" is synchronized, it should not have any errors
// due ... | as one');
$this->assertCount(0, $child->getErrors(), $child->getName().' should not have an error, but has one');
$this->assertCount(0, $grandChild->getErrors(), $grandChild->getName().' should not have an error, but has one');
}
p | er and mark the form unsynchronized
$parent->submit([]);
$this->mapper->mapViolation($violation, $parent);
$this->assertCount(0, $parent->getErrors(), $parent->getName().' should not have an error, but h | {
"filepath": "src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationMapperTest.php",
"language": "php",
"file_size": 155149,
"cut_index": 7068,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Form\Tests\Extension\Validator\ViolationMapper;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Form\Extension\Validator\ViolationMapper\ViolationPath;
/**
* @author Bernhard Schussek <bschussek@gmail.c... | address', true, true],
['street', true, true],
], 'children[address].children[street]'],
['children[address].data', [
['address', true, true],
], 'children[address]'],
['childr |
]],
['children[address].children[street]', [
['address', true, true],
['street', true, true],
]],
['children[address][street]', [
[' | {
"filepath": "src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationPathTest.php",
"language": "php",
"file_size": 7279,
"cut_index": 716,
"middle_length": 229
} |
n Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Tests\Extension\Core;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Form\Extension\Core\CoreExtension;
use Sym... | $formFactoryBuilder->addExtension(new CoreExtension())
->getFormFactory();
$form = $formFactory->createBuilder()
->add('foo', 'Symfony\Component\Form\Extension\Core\Type\DateType', ['widget' => 'choice'])
->getF | = new FormFactoryBuilder();
$formFactory = | {
"filepath": "src/Symfony/Component/Form/Tests/Extension/Core/CoreExtensionTest.php",
"language": "php",
"file_size": 982,
"cut_index": 582,
"middle_length": 52
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Tests\Extension\Csrf\EventListener;
use PHPUnit\Framework\TestCase;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\Form\... | ams;
use Symfony\Component\Security\Csrf\CsrfTokenManager;
class CsrfValidationListenerTest extends TestCase
{
protected EventDispatcher $dispatcher;
protected FormFactoryInterface $factory;
protected CsrfTokenManager $tokenManager;
protec | orIterator;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormFactoryBuilder;
use Symfony\Component\Form\FormFactoryInterface;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\Util\ServerPar | {
"filepath": "src/Symfony/Component/Form/Tests/Extension/Csrf/EventListener/CsrfValidationListenerTest.php",
"language": "php",
"file_size": 3067,
"cut_index": 614,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Tests\Extension\Validator;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Form\Extension\Validator\Constraints\Form as FormConstraint;
use Symf... | nt\Validator\Validation;
class ValidatorExtensionTest extends TestCase
{
public function test2Dot5ValidationApi()
{
$metadata = new ClassMetadata(Form::class);
$metadataFactory = new FakeMetadataFactory();
$metadataFactory | \Mapping\CascadingStrategy;
use Symfony\Component\Validator\Mapping\ClassMetadata;
use Symfony\Component\Validator\Mapping\TraversalStrategy;
use Symfony\Component\Validator\Tests\Fixtures\FakeMetadataFactory;
use Symfony\Compone | {
"filepath": "src/Symfony/Component/Form/Tests/Extension/Validator/ValidatorExtensionTest.php",
"language": "php",
"file_size": 3136,
"cut_index": 614,
"middle_length": 229
} |
m\Extension\Validator\ValidatorExtension;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormFactoryBuilder;
use Symfony\Component\Form\FormFactoryInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Validator\Constraints\Collection;
use Symfony\Component\... | Loader\StaticMethodLoader;
use Symfony\Component\Validator\Validation;
use Symfony\Component\Validator\Validator\ValidatorInterface;
class FormValidatorFunctionalTest extends TestCase
{
private ValidatorInterface $validator;
private FormFactoryInt | Blank;
use Symfony\Component\Validator\Constraints\Valid;
use Symfony\Component\Validator\Mapping\ClassMetadata;
use Symfony\Component\Validator\Mapping\Factory\LazyLoadingMetadataFactory;
use Symfony\Component\Validator\Mapping\ | {
"filepath": "src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/FormValidatorFunctionalTest.php",
"language": "php",
"file_size": 19318,
"cut_index": 1331,
"middle_length": 229
} |
part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Tests\Extension\Validator\Constraints;
use PHPUnit\Framework\Attributes\G... | ensions(?ViolationMapperInterface $violationMapper = null): array
{
return [
new ValidatorExtension(Validation::createValidator(), $violationMapper),
];
}
/**
* findClickedButton() used to have an exponential n | t\FormPerformanceTestCase;
use Symfony\Component\Validator\Validation;
/**
* @author Bernhard Schussek <bschussek@gmail.com>
*/
class FormValidatorPerformanceTest extends FormPerformanceTestCase
{
protected function getExt | {
"filepath": "src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/FormValidatorPerformanceTest.php",
"language": "php",
"file_size": 1593,
"cut_index": 537,
"middle_length": 229
} |
php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Tests\Extension\Validator\Type;
use Symfony\Compon... | , null, $options + ['widget' => 'choice']);
}
public function testInvalidMessage()
{
$form = $this->createForm();
$this->assertSame('Please enter a valid birthdate.', $form->getConfig()->getOption('invalid_message'));
}
}
| return $this->factory->create(BirthdayType::class | {
"filepath": "src/Symfony/Component/Form/Tests/Extension/Validator/Type/BirthdayTypeValidatorExtensionTest.php",
"language": "php",
"file_size": 822,
"cut_index": 514,
"middle_length": 52
} |
buted with this source code.
*/
namespace Symfony\Component\Form\Tests;
use PHPUnit\Framework\TestCase;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\Form\ButtonBuilder;
use Symfony\Component\Form\Exception\InvalidArgumentException;
use Symfony\Component\Form\Extension\Core\Type\Submit... | mFactory $factory;
private FormBuilder $builder;
protected function setUp(): void
{
$this->factory = new FormFactory(new FormRegistry([], new ResolvedFormTypeFactory()));
$this->builder = new FormBuilder('name', null, new Event | onent\Form\FormFactoryBuilder;
use Symfony\Component\Form\FormRegistry;
use Symfony\Component\Form\ResolvedFormTypeFactory;
use Symfony\Component\Form\SubmitButtonBuilder;
class FormBuilderTest extends TestCase
{
private For | {
"filepath": "src/Symfony/Component/Form/Tests/FormBuilderTest.php",
"language": "php",
"file_size": 6401,
"cut_index": 716,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Tests;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfo... | ['a#', 'Symfony\Component\Form\Exception\InvalidArgumentException'],
['a$', 'Symfony\Component\Form\Exception\InvalidArgumentException'],
['a%', 'Symfony\Component\Form\Exception\InvalidArgumentException'],
['a ', 'Symf | blic static function getHtml4Ids()
{
return [
['z0'],
['A0'],
['A9'],
['Z0'],
['#', 'Symfony\Component\Form\Exception\InvalidArgumentException'],
| {
"filepath": "src/Symfony/Component/Form/Tests/FormConfigTest.php",
"language": "php",
"file_size": 4669,
"cut_index": 614,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Form\Tests;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormFactory;
use Symfony\Component\Form\FormRegistry;
use Symfony\Co... | sek@gmail.com>
*/
class FormFactoryTest extends TestCase
{
private ConfigurableFormTypeGuesser $guesser1;
private ConfigurableFormTypeGuesser $guesser2;
private FormRegistry $registry;
private FormFactory $factory;
protected function | t\Form\Guess\ValueGuess;
use Symfony\Component\Form\PreloadedExtension;
use Symfony\Component\Form\ResolvedFormTypeFactory;
use Symfony\Component\Form\Tests\Fixtures\ConfigurableFormType;
/**
* @author Bernhard Schussek <bschus | {
"filepath": "src/Symfony/Component/Form/Tests/FormFactoryTest.php",
"language": "php",
"file_size": 8588,
"cut_index": 716,
"middle_length": 229
} |
This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Tests;
use PHPUnit\Framework\TestCase;
use Symfony\Component... | $this->assertEquals('Is active', $renderer->humanize('isActive'));
}
public function testRenderARenderedField()
{
$this->expectException(BadMethodCallException::class);
$this->expectExceptionMessage('Field "foo" has already b | FormRendererTest extends TestCase
{
public function testHumanize()
{
$renderer = new FormRenderer(new DummyFormRendererEngine());
$this->assertEquals('Is active', $renderer->humanize('is_active'));
| {
"filepath": "src/Symfony/Component/Form/Tests/FormRendererTest.php",
"language": "php",
"file_size": 1354,
"cut_index": 524,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Form\Tests;
use Symfony\Component\Form\Exception\UnexpectedTypeException;
use Symfony\Component\Form\NativeRequestHandler;
/**
* @author Bernhard Schussek <bschussek@gmail.com>
*/
class NativeRequestHandlerTest extends AbstractRequestHandlerTestCase
{
... | protected function tearDown(): void
{
$_GET = [];
$_POST = [];
$_FILES = [];
$_SERVER = self::$serverBackup;
}
public function testRequestShouldBeNull()
{
$this->expectException(UnexpectedTypeExce | parent::setUp();
$_GET = [];
$_POST = [];
$_FILES = [];
$_SERVER = [
// PHPUnit needs this entry
'SCRIPT_NAME' => self::$serverBackup['SCRIPT_NAME'],
];
}
| {
"filepath": "src/Symfony/Component/Form/Tests/NativeRequestHandlerTest.php",
"language": "php",
"file_size": 8126,
"cut_index": 716,
"middle_length": 229
} |
unt = $count;
}
public function count(): int
{
return $this->count;
}
}
class SimpleFormTest_Traversable implements \IteratorAggregate
{
private \ArrayIterator $iterator;
public function __construct($count)
{
$this->iterator = new \ArrayIterator($count > 0 ? array_fill(0, ... | gBuilder($name, null, new EventDispatcher());
$form = new Form($config);
$this->assertEquals($propertyPath, $form->getPropertyPath());
}
public static function provideFormNames(): iterable
{
yield [null, null];
| protected function setUp(): void
{
$this->form = $this->createForm();
}
#[DataProvider('provideFormNames')]
public function testGetPropertyPath($name, $propertyPath)
{
$config = new FormConfi | {
"filepath": "src/Symfony/Component/Form/Tests/SimpleFormTest.php",
"language": "php",
"file_size": 35575,
"cut_index": 2151,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Tests\Flow;
use PHPUnit\Framework\TestCase;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\Form\Exception\InvalidArgumen... | s\PropertyPath;
class FormFlowBuilderTest extends TestCase
{
private FormFactoryInterface $factory;
private InMemoryDataStorage $dataStorage;
private PropertyPathStepAccessor $stepAccessor;
protected function setUp(): void
{
$ | omponent\Form\Flow\StepAccessor\PropertyPathStepAccessor;
use Symfony\Component\Form\FormFactoryInterface;
use Symfony\Component\Form\Forms;
use Symfony\Component\PropertyAccess\PropertyAccess;
use Symfony\Component\PropertyAcces | {
"filepath": "src/Symfony/Component/Form/Tests/Flow/FormFlowBuilderTest.php",
"language": "php",
"file_size": 3358,
"cut_index": 614,
"middle_length": 229
} |
adataFactory(new AttributeLoader()))
->getValidator();
$this->factory = Forms::createFormFactoryBuilder()
->addExtensions([new ValidatorExtension($validator)])
->getFormFactory();
}
public function testFlowConfig()
{
$flow = $this->factory->create(UserSi... | e($config->hasStep('account'));
}
public function testFlowCursor()
{
$flow = $this->factory->create(UserSignUpType::class, new UserSignUp());
$cursor = $flow->getCursor();
self::assertSame('personal', $cursor->getCurre | $data], $config->getInitialOptions());
self::assertCount(3, $config->getSteps());
self::assertTrue($config->hasStep('personal'));
self::assertTrue($config->hasStep('professional'));
self::assertTru | {
"filepath": "src/Symfony/Component/Form/Tests/Flow/FormFlowTest.php",
"language": "php",
"file_size": 36804,
"cut_index": 2151,
"middle_length": 229
} |
This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Tests\Extension\DataCollector;
use PHPUnit\Framework\TestCas... | tion setUp(): void
{
$this->extension = new DataCollectorExtension(new FormDataCollector(new FormDataExtractor()));
}
public function testLoadTypeExtensions()
{
$typeExtensions = $this->extension->getTypeExtensions('Symfony | lector\FormDataExtractor;
use Symfony\Component\Form\Extension\DataCollector\Type\DataCollectorTypeExtension;
class DataCollectorExtensionTest extends TestCase
{
private DataCollectorExtension $extension;
protected func | {
"filepath": "src/Symfony/Component/Form/Tests/Extension/DataCollector/DataCollectorExtensionTest.php",
"language": "php",
"file_size": 1259,
"cut_index": 524,
"middle_length": 229
} |
nt\Form\CallbackTransformer;
use Symfony\Component\Form\Exception\TransformationFailedException;
use Symfony\Component\Form\Extension\Core\DataMapper\DataMapper;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\DataCollector\FormDataExtractor;
use Symfony\Component\Form\Fo... | aintViolation;
use Symfony\Component\VarDumper\Test\VarDumperTestTrait;
/**
* @author Bernhard Schussek <bschussek@gmail.com>
*/
class FormDataExtractorTest extends TestCase
{
use VarDumperTestTrait;
private FormDataExtractor $dataExtractor;
| m\ResolvedFormType;
use Symfony\Component\Form\ResolvedFormTypeFactory;
use Symfony\Component\Form\Tests\Fixtures\FixedDataTransformer;
use Symfony\Component\Validator\Constraints\WordCount;
use Symfony\Component\Validator\Constr | {
"filepath": "src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataExtractorTest.php",
"language": "php",
"file_size": 13272,
"cut_index": 921,
"middle_length": 229
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.