prefix
stringlengths
512
512
suffix
stringlengths
256
256
middle
stringlengths
14
229
meta
dict
yInjection\Argument\IteratorArgument; use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\DependencyInjectio...
mExtensionNotLoaded() { $container = $this->createContainerBuilder(); $container->compile(); $this->assertFalse($container->hasDefinition('form.extension')); } public function testDoNothingIfDebugCommandNotLoaded()
ent\Form\Extension\Csrf\Type\FormTypeCsrfExtension; use Symfony\Component\Form\FormRegistry; /** * @author Bernhard Schussek <bschussek@gmail.com> */ class FormPassTest extends TestCase { public function testDoNothingIfFor
{ "filepath": "src/Symfony/Component/Form/Tests/DependencyInjection/FormPassTest.php", "language": "php", "file_size": 15144, "cut_index": 921, "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\Guess; use Symfony\Component\Form\Exception\InvalidArgumentException; /** * Base class for guesse...
o be correct. */ public const VERY_HIGH_CONFIDENCE = 3; /** * Marks an instance with a value that is very likely to be correct. */ public const HIGH_CONFIDENCE = 2; /** * Marks an instance with a value that is likely t
re likely to be * correct than an instance with confidence LOW_CONFIDENCE. * * @author Bernhard Schussek <bschussek@gmail.com> */ abstract class Guess { /** * Marks an instance with a value that is extremely likely t
{ "filepath": "src/Symfony/Component/Form/Guess/Guess.php", "language": "php", "file_size": 2913, "cut_index": 563, "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\Guess; /** * Contains a guessed class name and a list of op...
is correct */ public function __construct( private string $type, private array $options, int $confidence, ) { parent::__construct($confidence); } /** * Returns the guessed field type.
field type * @param array $options The options for creating instances of the * guessed class * @param int $confidence The confidence that the guessed class name *
{ "filepath": "src/Symfony/Component/Form/Guess/TypeGuess.php", "language": "php", "file_size": 1276, "cut_index": 524, "middle_length": 229 }
s 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\Guess; /** * Contains a guessed value. * * @author Bernhard Schussek ...
e string|int|bool|null $value, int $confidence, ) { parent::__construct($confidence); } /** * Returns the guessed value. */ public function getValue(): string|int|bool|null { return $this->value; }
privat
{ "filepath": "src/Symfony/Component/Form/Guess/ValueGuess.php", "language": "php", "file_size": 809, "cut_index": 536, "middle_length": 14 }
p /* * 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\Event; use Symfony\Component\Form\Exception\BadMetho...
*/ final class PostSetDataEvent extends FormEvent { public function setData(mixed $data): never { throw new BadMethodCallException('Form data cannot be changed during "form.post_set_data", you should use "form.pre_set_data" instead.');
d data (adding or * removing fields dynamically).
{ "filepath": "src/Symfony/Component/Form/Event/PostSetDataEvent.php", "language": "php", "file_size": 828, "cut_index": 516, "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\Event; use Symfony\Component\Form\Exception\BadMet...
PostSubmitEvent extends FormEvent { public function setData(mixed $data): never { throw new BadMethodCallException('Form data cannot be changed during "form.post_submit", you should use "form.pre_submit" or "form.submit" instead.'); } }
o fetch data after denormalization. */ final class
{ "filepath": "src/Symfony/Component/Form/Event/PostSubmitEvent.php", "language": "php", "file_size": 823, "cut_index": 514, "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\Test; use PHPUnit\Framework\TestCase; use Symfony\Component\Form\FormExte...
protected function setUp(): void { $this->factory = Forms::createFormFactoryBuilder() ->addExtensions($this->getExtensions()) ->addTypeExtensions($this->getTypeExtensions()) ->addTypes($this->getTypes())
sserInterface; use Symfony\Component\Form\FormTypeInterface; /** * @author Bernhard Schussek <bschussek@gmail.com> */ abstract class FormIntegrationTestCase extends TestCase { protected FormFactoryInterface $factory;
{ "filepath": "src/Symfony/Component/Form/Test/FormIntegrationTestCase.php", "language": "php", "file_size": 1652, "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\Test; /** * Base class for performance tests. * * Copied ...
s(): void { parent::assertPostConditions(); $time = microtime(true) - $this->startTime; if (0 != $this->maxRunningTime && $time > $this->maxRunningTime) { $this->fail(\sprintf('expected running time: <= %s but was:
private float $startTime; protected int $maxRunningTime = 0; protected function setUp(): void { parent::setUp(); $this->startTime = microtime(true); } protected function assertPostCondition
{ "filepath": "src/Symfony/Component/Form/Test/FormPerformanceTestCase.php", "language": "php", "file_size": 1490, "cut_index": 524, "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\Test; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use...
(): void { parent::setUp(); if (!isset($this->dispatcher)) { $this->dispatcher = $this->createMock(EventDispatcherInterface::class); } $this->builder = new FormBuilder('', null, $this->dispatcher, $this->fac
ponent\Form\Test\Traits\ValidatorExtensionTrait; abstract class TypeTestCase extends FormIntegrationTestCase { protected FormBuilder $builder; protected EventDispatcherInterface $dispatcher; protected function setUp
{ "filepath": "src/Symfony/Component/Form/Test/TypeTestCase.php", "language": "php", "file_size": 1985, "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\Test\Traits; use Symfony\Component\Form\Extension\Validator\ValidatorExte...
ationMapperInterface|null $violationMapper */ protected function getValidatorExtension(/* ?ViolationMapperInterface $violationMapper = null */): ValidatorExtension { $violationMapper = \func_num_args() ? func_get_arg(0) : null;
nList; use Symfony\Component\Validator\Mapping\ClassMetadata; use Symfony\Component\Validator\Validator\ValidatorInterface; trait ValidatorExtensionTrait { protected ValidatorInterface $validator; /** * @param Viol
{ "filepath": "src/Symfony/Component/Form/Test/Traits/ValidatorExtensionTrait.php", "language": "php", "file_size": 1939, "cut_index": 537, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Form\DependencyInjection; use Symfony\Component\DependencyInjection\Argument\ArgumentInterface; use Symfony\Component\DependencyInjection\Argument\IteratorArgument; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Compon...
esser" as arguments of the "form.extension" service. * * @author Bernhard Schussek <bschussek@gmail.com> */ class FormPass implements CompilerPassInterface { use PriorityTaggedServiceTrait; public function process(ContainerBuilder $container):
r; use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; use Symfony\Component\DependencyInjection\Reference; /** * Adds all services with the tags "form.type", "form.type_extension" and * "form.type_gu
{ "filepath": "src/Symfony/Component/Form/DependencyInjection/FormPass.php", "language": "php", "file_size": 5907, "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\ChoiceList; use PHPUnit\Framework\TestCase; use Symfony\Component\Form\ChoiceList\LazyChoiceList; use Symfony\Component\Form\Tests\Fixtures\Arra...
choice, $choices); }); $this->assertSame(['RESULT'], $list->getChoices()); $this->assertSame(['RESULT'], $list->getChoices()); $this->assertSame(2, $calls); } public function testGetValuesLoadsLoadedListOnFirstCall
{ $choices = ['RESULT']; $calls = 0; $list = new LazyChoiceList(new ArrayChoiceLoader($choices), static function ($choice) use ($choices, &$calls) { ++$calls; return array_search($
{ "filepath": "src/Symfony/Component/Form/Tests/ChoiceList/LazyChoiceListTest.php", "language": "php", "file_size": 4236, "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\Tests\ChoiceList\Loader; use PHPUnit\Framework\TestCase; use Symfony\Component\Form\ChoiceList\Choi...
oice_two']; private static LazyChoiceList $lazyChoiceList; public static function setUpBeforeClass(): void { self::$loader = new CallbackChoiceLoader(static fn () => self::$choices); self::$value = static fn ($choice) => $choic
class CallbackChoiceLoaderTest extends TestCase { private static CallbackChoiceLoader $loader; private static \Closure $value; private static array $choices; private static array $choiceValues = ['choice_one', 'ch
{ "filepath": "src/Symfony/Component/Form/Tests/ChoiceList/Loader/CallbackChoiceLoaderTest.php", "language": "php", "file_size": 2826, "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\ChoiceList\Loader; use PHPUnit\Framework\TestCase; use Symfony\Component\Form\ChoiceList\Choi...
private static array $choiceValues = ['choice_one', 'choice_two']; private static LazyChoiceList $lazyChoiceList; public static function setUpBeforeClass(): void { self::$loader = new IntlCallbackChoiceLoader(static fn () => self:
* @author Yonel Ceruto <yonelceruto@gmail.com> */ class IntlCallbackChoiceLoaderTest extends TestCase { private static IntlCallbackChoiceLoader $loader; private static \Closure $value; private static array $choices;
{ "filepath": "src/Symfony/Component/Form/Tests/ChoiceList/Loader/IntlCallbackChoiceLoaderTest.php", "language": "php", "file_size": 2759, "cut_index": 563, "middle_length": 229 }
se Symfony\Component\Form\Tests\ChoiceList\ChoiceListAssertionTrait; use Symfony\Component\Form\Tests\Fixtures\ArrayChoiceLoader; use Symfony\Component\Translation\TranslatableMessage; use Symfony\Contracts\Translation\TranslatableInterface; use Symfony\Contracts\Translation\TranslatorInterface; class DefaultChoiceLis...
) { case 'a': return 'a'; case 'b': return 'b'; case 'c': return '1'; case 'd': return '2'; } } public function getLabel($object) { return $object->label; } public functi
te ArrayChoiceList $list; private DefaultChoiceListFactory $factory; public function getValue($object) { return $object->value; } public function getScalarValue($choice) { switch ($choice
{ "filepath": "src/Symfony/Component/Form/Tests/ChoiceList/Factory/DefaultChoiceListFactoryTest.php", "language": "php", "file_size": 31281, "cut_index": 1331, "middle_length": 229 }
rm\ChoiceList\Factory\DefaultChoiceListFactory; use Symfony\Component\Form\ChoiceList\Factory\PropertyAccessDecorator; use Symfony\Component\Form\ChoiceList\View\ChoiceGroupView; use Symfony\Component\Form\ChoiceList\View\ChoiceView; use Symfony\Component\Form\Tests\Fixtures\ArrayChoiceLoader; use Symfony\Component\Pro...
' => 'value']; $this->assertSame(['value' => $object], $this->factory->createListFromChoices([$object], 'property')->getChoices()); } public function testCreateFromChoicesPropertyPathInstance() { $object = (object) ['property'
otected function setUp(): void { $this->factory = new PropertyAccessDecorator(new DefaultChoiceListFactory()); } public function testCreateFromChoicesPropertyPath() { $object = (object) ['property
{ "filepath": "src/Symfony/Component/Form/Tests/ChoiceList/Factory/PropertyAccessDecoratorTest.php", "language": "php", "file_size": 10068, "cut_index": 921, "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\Fixtures; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\...
ents::PRE_SET_DATA, function (FormEvent $event) { $form = $event->getForm(); $type = 0 === $form->getName() % 2 ? 'Symfony\Component\Form\Extension\Core\Type\TextType' : 'Symfony\Component\Form\Extens
void { $builder->addEventListener(FormEv
{ "filepath": "src/Symfony/Component/Form/Tests/Fixtures/AlternatingRowType.php", "language": "php", "file_size": 979, "cut_index": 582, "middle_length": 52 }
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\Fixtures; use Symfony\Component\Form\AbstractType; use Symf...
->add('firstName') ->add('lastName') ; } public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'data_class' => 'Symfony\Component\Form\Tests\Fixtures\Aut
lder, array $options): void { $builder
{ "filepath": "src/Symfony/Component/Form/Tests/Fixtures/AuthorType.php", "language": "php", "file_size": 863, "cut_index": 529, "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\Fixtures; use Symfony\Component\Form\AbstractTyp...
builder, array $options): void { $builder->addEventListener(FormEvents::PRE_SET_DATA, static function (FormEvent $event): void { $event->getForm() ->add('0', TextareaType::class) ->add('foo', TextType
ony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormEvent; use Symfony\Component\Form\FormEvents; class CollectionWithPreSetDataType extends AbstractType { public function buildForm(FormBuilderInterface $
{ "filepath": "src/Symfony/Component/Form/Tests/Fixtures/CollectionWithPreSetDataType.php", "language": "php", "file_size": 1138, "cut_index": 518, "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\Fixtures; use Symfony\Component\Form\AbstractType; use...
ntListener(FormEvents::PRE_SET_DATA, static function (FormEvent $event): void { $event->getForm()->add('foo', TextType::class); }); $builder->addEventListener(FormEvents::POST_SET_DATA, static function (FormEvent $event): void
\FormEvent; use Symfony\Component\Form\FormEvents; class CollectionWithRecursiveSetDataType extends AbstractType { public function buildForm(FormBuilderInterface $builder, array $options): void { $builder->addEve
{ "filepath": "src/Symfony/Component/Form/Tests/Fixtures/CollectionWithRecursiveSetDataType.php", "language": "php", "file_size": 1417, "cut_index": 524, "middle_length": 229 }
\Locale::setDefault('en'); parent::setUp(); } protected function tearDown(): void { \Locale::setDefault($this->defaultLocale); } public function testSubmitDateTime() { $form = $this->factory->create(static::TESTED_TYPE, null, [ 'model_timezone' => 'UTC'...
'minute' => '4', ], ]); $dateTime = new \DateTime('2010-06-02 03:04:00 UTC'); $this->assertEquals($dateTime, $form->getData()); } public function testSubmitDatePoint() { $form = $this->factor
]); $form->submit([ 'date' => [ 'day' => '2', 'month' => '6', 'year' => '2010', ], 'time' => [ 'hour' => '3',
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTimeTypeTest.php", "language": "php", "file_size": 28623, "cut_index": 1331, "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\Core\Type; use PHPUnit\Framework\Attributes\DataProvider; use Symfony\Component\For...
null, [ 'html5' => $html5, 'trim' => true, ]); $form->submit($submittedValue); $this->assertInstanceOf(FormErrorIterator::class, $form->getErrors()); $this->assertCount(0, $form->getErrors());
ED_TYPE = ColorType::class; #[DataProvider('validationShouldPassProvider')] public function testValidationShouldPass(bool $html5, ?string $submittedValue) { $form = $this->factory->create(static::TESTED_TYPE,
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/Type/ColorTypeTest.php", "language": "php", "file_size": 2637, "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\Tests\Extension\Core\DataTransformer; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Symfony\Component\Form\Except...
$transformer = new WeekToArrayTransformer(); $this->assertSame(['year' => null, 'week' => null], $transformer->transform(null)); } #[DataProvider('transformationFailuresProvider')] public function testTransformationFailures($input,
stTransform() { $transformer = new WeekToArrayTransformer(); $this->assertSame(['year' => 2019, 'week' => 1], $transformer->transform('2019-W01')); } public function testTransformEmpty() {
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/WeekToArrayTransformerTest.php", "language": "php", "file_size": 4161, "cut_index": 614, "middle_length": 229 }
ntDispatcher\EventDispatcher; use Symfony\Component\Form\Extension\Core\DataAccessor\PropertyPathAccessor; use Symfony\Component\Form\Extension\Core\DataMapper\DataMapper; use Symfony\Component\Form\Extension\Core\Type\DateType; use Symfony\Component\Form\Extension\Core\Type\FormType; use Symfony\Component\Form\Extensi...
$dispatcher; protected function setUp(): void { $this->mapper = new DataMapper(); $this->dispatcher = new EventDispatcher(); } public function testMapDataToFormsPassesObjectRefIfByReference() { $car = new \stdC
ypehintedPropertiesCar; use Symfony\Component\PropertyAccess\PropertyAccess; use Symfony\Component\PropertyAccess\PropertyPath; class DataMapperTest extends TestCase { private DataMapper $mapper; private EventDispatcher
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/DataMapper/DataMapperTest.php", "language": "php", "file_size": 15110, "cut_index": 921, "middle_length": 229 }
gmail.com> */ class OrderedHashMapTest extends TestCase { public function testGet() { $map = new OrderedHashMap(); $map['first'] = 1; $this->assertSame(1, $map['first']); } public function testGetNonExistingFails() { $this->expectException(\OutOfBoundsException::cl...
p['foo'] = 2; $map[] = 3; $this->assertSame(['0' => 1, 'foo' => 2, '1' => 3], iterator_to_array($map)); } public function testInsertLooselyEqualKeys() { $map = new OrderedHashMap(); $map['1 as a string'] = '1 a
$map['second'] = 2; $this->assertSame(['first' => 1, 'second' => 2], iterator_to_array($map)); } public function testInsertNullKeys() { $map = new OrderedHashMap(); $map[] = 1; $ma
{ "filepath": "src/Symfony/Component/Form/Tests/Util/OrderedHashMapTest.php", "language": "php", "file_size": 15878, "cut_index": 921, "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\Util; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Symfony\Component\Form\Util\StringUtil; class StringUt...
vider('spaceProvider')] public function testTrimUtf8Separators($hex) { // Convert hexadecimal representation into binary // H: hex string, high nibble first (UCS-2BE) // *: repeat until end of string $binary = pack('
r in PCRE versions of <PHP 7.3 ]; } #[DataProvider('trimProvider')] public function testTrim($data, $expectedData) { $this->assertSame($expectedData, StringUtil::trim($data)); } #[DataPro
{ "filepath": "src/Symfony/Component/Form/Tests/Util/StringUtilTest.php", "language": "php", "file_size": 3685, "cut_index": 614, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Form\Tests\Console\Descriptor; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Output\BufferedOutput; use Symfony\Component\Console\Style\SymfonySty...
e Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Security\Csrf\CsrfTokenManager; abstract class AbstractDescriptorTestCase extends TestCase { private string|false $colSize; protected function setUp(): void {
nsion\Csrf\Type\FormTypeCsrfExtension; use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\ResolvedFormType; use Symfony\Component\Form\ResolvedFormTypeInterface; use Symfony\Component\OptionsResolver\Options; us
{ "filepath": "src/Symfony/Component/Form/Tests/Console/Descriptor/AbstractDescriptorTestCase.php", "language": "php", "file_size": 7979, "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\Tests\ChoiceList\Loader; use PHPUnit\Framework\TestCase; use Symfony\Component\Form\ChoiceList\Arra...
$loader = new FilterChoiceLoaderDecorator(new ArrayChoiceLoader(range(1, 4)), $filter); $this->assertEqualsArrayChoiceList(new ArrayChoiceList([1 => 2, 3 => 4]), $loader->loadChoiceList()); } public function testLoadChoiceListWithGr
xtures\ArrayChoiceLoader; class FilterChoiceLoaderDecoratorTest extends TestCase { use ChoiceListAssertionTrait; public function testLoadChoiceList() { $filter = static fn ($choice) => 0 === $choice % 2;
{ "filepath": "src/Symfony/Component/Form/Tests/ChoiceList/Loader/FilterChoiceLoaderDecoratorTest.php", "language": "php", "file_size": 2927, "cut_index": 563, "middle_length": 229 }
use Symfony\Component\Form\ChoiceList\View\ChoiceListView; use Symfony\Component\Form\Extension\Core\Type\FormType; use Symfony\Component\Form\Tests\ChoiceList\ChoiceListAssertionTrait; use Symfony\Component\Form\Tests\Fixtures\ArrayChoiceLoader; /** * @author Bernhard Schussek <bschussek@gmail.com> */ class Cachin...
Choices([]); $this->assertSame($list1, $list2); self::assertEqualsArrayChoiceList(new ArrayChoiceList([]), $list1); self::assertEqualsArrayChoiceList(new ArrayChoiceList([]), $list2); } public function testCreateFromChoice
ew CachingFactoryDecorator(new DefaultChoiceListFactory()); } public function testCreateFromChoicesEmpty() { $list1 = $this->factory->createListFromChoices([]); $list2 = $this->factory->createListFrom
{ "filepath": "src/Symfony/Component/Form/Tests/ChoiceList/Factory/CachingFactoryDecoratorTest.php", "language": "php", "file_size": 24965, "cut_index": 1331, "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\Fixtures; class Author { public $firstName; pr...
return $this->lastName; } private function getPrivateGetter() { return 'foobar'; } public function setAustralian($australian) { $this->australian = $australian; } public function isAustralian() {
{ $this->firstName = $firstName; $this->lastName = $lastName; } public function setLastName($lastName) { $this->lastName = $lastName; } public function getLastName() {
{ "filepath": "src/Symfony/Component/Form/Tests/Fixtures/Author.php", "language": "php", "file_size": 1421, "cut_index": 524, "middle_length": 229 }
ony.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\Fixtures; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Opti...
nded' => true]); $resolver->setNormalizer('choices', fn () => [ 'attr1' => 'Attribute 1', 'attr2' => 'Attribute 2', ]); } public function getParent(): ?string { return ChoiceType::class; } }
r): void { $resolver->setDefaults(['expa
{ "filepath": "src/Symfony/Component/Form/Tests/Fixtures/ChoiceSubType.php", "language": "php", "file_size": 916, "cut_index": 606, "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\Fixtures; /** * This class is a hand written simplified version of...
$this->array); } public function offsetGet($offset): mixed { return $this->array[$offset]; } public function offsetSet($offset, $value): void { if (null === $offset) { $this->array[] = $value; }
{ private array $array; public function __construct(?array $array = null) { $this->array = $array ?: []; } public function offsetExists($offset): bool { return \array_key_exists($offset,
{ "filepath": "src/Symfony/Component/Form/Tests/Fixtures/CustomArrayObject.php", "language": "php", "file_size": 1562, "cut_index": 537, "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\Core\DataTransformer; use PHPUnit\Framework\TestCase; use Symfony\Component\Form\Exception\TransformationFailedException; use Symfony\...
'b' => 'Foo', 'c' => 'Foo', ]; $this->assertSame($output, $this->transformer->transform('Foo')); } public function testTransformEmpty() { $output = [ 'a' => null, 'b' => null,
protected function setUp(): void { $this->transformer = new ValueToDuplicatesTransformer(['a', 'b', 'c']); } public function testTransform() { $output = [ 'a' => 'Foo',
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ValueToDuplicatesTransformerTest.php", "language": "php", "file_size": 3234, "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\Tests\Extension\HtmlSanitizer\Type; use Symfony\Component\DependencyInjection\ServiceLocator; use S...
erInterface; class TextTypeHtmlSanitizerExtensionTest extends TypeTestCase { protected function setUp(): void { $this->dispatcher = new EventDispatcher(); parent::setUp(); } protected function getExtensions(?ViolationMapp
xtension\HtmlSanitizer\HtmlSanitizerExtension; use Symfony\Component\Form\Extension\Validator\ViolationMapper\ViolationMapperInterface; use Symfony\Component\Form\Test\TypeTestCase; use Symfony\Component\HtmlSanitizer\HtmlSanitiz
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/HtmlSanitizer/Type/TextTypeHtmlSanitizerExtensionTest.php", "language": "php", "file_size": 2478, "cut_index": 563, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Form\Tests\ChoiceList; use Symfony\Component\Form\ChoiceList\ArrayChoiceList; use Symfony\Component\Form\ChoiceList\ChoiceListInterface; /** * @author Bernhard Schussek <bschussek@gmail.com> */ class ArrayChoiceListTest extends AbstractChoiceListTestCase...
unction getValues() { return ['0', '1', '2', '3', '4', '5', '6', '7', '8']; } public function testCreateChoiceListWithValueCallback() { $callback = static fn ($choice) => ':'.$choice; $choiceList = new ArrayChoiceL
): ChoiceListInterface { return new ArrayChoiceList($this->getChoices()); } protected function getChoices() { return [0, 1, 1.5, '1', 'a', false, true, $this->object, null]; } protected f
{ "filepath": "src/Symfony/Component/Form/Tests/ChoiceList/ArrayChoiceListTest.php", "language": "php", "file_size": 6990, "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\ChoiceList; use Symfony\Component\Form\ChoiceList\Arra...
lues()); $this->assertEquals($expected->getOriginalKeys(), $actual->getOriginalKeys()); } private function assertEqualsLazyChoiceList(LazyChoiceList $expected, $actual) { $this->assertInstanceOf(LazyChoiceList::class, $actual);
$this->assertInstanceOf(ArrayChoiceList::class, $actual); $this->assertEquals($expected->getChoices(), $actual->getChoices()); $this->assertEquals($expected->getStructuredValues(), $actual->getStructuredVa
{ "filepath": "src/Symfony/Component/Form/Tests/ChoiceList/ChoiceListAssertionTrait.php", "language": "php", "file_size": 1257, "cut_index": 524, "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\ChoiceList\Factory\Cache; use PHPUnit\Framework\TestCase; use Symfo...
iceListAssertionTrait; public function testSameFormTypeUseCachedLoader() { $choices = ['f' => 'foo', 'b' => 'bar', 'z' => 'baz']; $choiceList = new ArrayChoiceList($choices); $type = new FormType(); $decorated = ne
omponent\Form\Extension\Core\Type\FormType; use Symfony\Component\Form\Tests\ChoiceList\ChoiceListAssertionTrait; use Symfony\Component\Form\Tests\Fixtures\ArrayChoiceLoader; class ChoiceLoaderTest extends TestCase { use Cho
{ "filepath": "src/Symfony/Component/Form/Tests/ChoiceList/Factory/Cache/ChoiceLoaderTest.php", "language": "php", "file_size": 1694, "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\Core\Type; use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Compo...
d the full // implementation IntlTestHelper::requireFullIntl($this); parent::setUp(); $this->defaultLocale = \Locale::getDefault(); } protected function tearDown(): void { if (isset($this->defaultLocal
c const TESTED_TYPE = PercentType::class; private string $defaultLocale; protected function setUp(): void { $this->dispatcher = new EventDispatcher(); // we test against different locales, so we nee
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/Type/PercentTypeTest.php", "language": "php", "file_size": 2728, "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\Tests\Extension\DependencyInjection; use PHPUnit\Framework\TestCase; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component...
tTypeExtension(); $typeExtension3 = new OtherTypeExtension(); $typeExtension4 = new MultipleTypesTypeExtension(); $extensions = [ 'test' => new \ArrayIterator([$typeExtension1, $typeExtension2, $typeExtension4]),
omponent\Form\FormTypeGuesserChain; class DependencyInjectionExtensionTest extends TestCase { public function testGetTypeExtensions() { $typeExtension1 = new TestTypeExtension(); $typeExtension2 = new Tes
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/DependencyInjection/DependencyInjectionExtensionTest.php", "language": "php", "file_size": 3322, "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\Tests\ChoiceList\Loader; use PHPUnit\Framework\TestCase; use Symfony\Comp...
$this->loader->loadChoiceList()->getChoices()); } public function testOnDemandChoiceListAfterLoadingValuesForChoices() { $this->loader->loadValuesForChoices(['A']); $this->assertSame(['A' => 'A'], $this->loader->loadChoiceList
protected function setUp(): void { $this->loader = new LazyChoiceLoader(new ArrayChoiceLoader(['A', 'B', 'C'])); } public function testInitialEmptyChoiceListLoading() { $this->assertSame([],
{ "filepath": "src/Symfony/Component/Form/Tests/ChoiceList/Loader/LazyChoiceLoaderTest.php", "language": "php", "file_size": 1525, "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\Util; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Symf...
(1024, $serverParams->getContentLength()); unset($_SERVER['CONTENT_LENGTH']); } public function testGetContentLengthFromRequest() { $request = Request::create('http://foo', 'GET', [], [], [], ['CONTENT_LENGTH' => 1024]);
ction testGetContentLengthFromSuperglobals() { $serverParams = new ServerParams(); $this->assertNull($serverParams->getContentLength()); $_SERVER['CONTENT_LENGTH'] = 1024; $this->assertEquals
{ "filepath": "src/Symfony/Component/Form/Tests/Util/ServerParamsTest.php", "language": "php", "file_size": 2323, "cut_index": 563, "middle_length": 229 }
enameFilterIterator; use Symfony\Component\Finder\Iterator\LazyIterator; use Symfony\Component\Finder\Iterator\SizeRangeFilterIterator; use Symfony\Component\Finder\Iterator\SortableIterator; /** * Finder allows to build rules to find files and directories. * * It is a thin wrapper around several specialized iterat...
; public const IGNORE_DOT_FILES = 2; public const IGNORE_VCS_IGNORED_FILES = 4; private int $mode = 0; private array $names = []; private array $notNames = []; private array $exclude = []; private array $filters = []; priva
(__DIR__); * * @author Fabien Potencier <fabien@symfony.com> * * @implements \IteratorAggregate<non-empty-string, SplFileInfo> */ class Finder implements \IteratorAggregate, \Countable { public const IGNORE_VCS_FILES = 1
{ "filepath": "src/Symfony/Component/Finder/Finder.php", "language": "php", "file_size": 24685, "cut_index": 1331, "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\Finder\Tests\Iterator; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; us...
tures() { yield ['foo', false, 'string']; yield [' foo ', false, '" " is not a valid delimiter']; yield ['\\foo\\', false, '"\\" is not a valid delimiter']; yield ['afooa', false, '"a" is not a valid delimiter'];
ex($string, $isRegex, $message) { $testIterator = new TestMultiplePcreFilterIterator(); $this->assertEquals($isRegex, $testIterator->isRegex($string), $message); } public static function getIsRegexFix
{ "filepath": "src/Symfony/Component/Finder/Tests/Iterator/MultiplePcreFilterIteratorTest.php", "language": "php", "file_size": 2380, "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\Finder; /** * Glob matches globbing patterns against text. * * if match_glob("foo.*", "foo.bar") echo "matched\n"; * * // prints foo.bar and f...
Richard Clamp <richardc@unixbeard.net> Perl version * @copyright 2004-2005 Fabien Potencier <fabien@symfony.com> * @copyright 2002 Richard Clamp <richardc@unixbeard.net> */ class Glob { /** * Returns a regexp which is the equivalent of the
glob(3) style matching that can be used to match * against text, rather than fetching names from a filesystem. * * Based on the Perl Text::Glob module. * * @author Fabien Potencier <fabien@symfony.com> PHP port * @author
{ "filepath": "src/Symfony/Component/Finder/Glob.php", "language": "php", "file_size": 3865, "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\Finder\Iterator; /** * CustomFilterIterator filters files by applying anonymo...
$filters An array of PHP callbacks * * @throws \InvalidArgumentException */ public function __construct(\Iterator $iterator, array $filters) { foreach ($filters as $filter) { if (!\is_callable($f
string, \SplFileInfo> */ class CustomFilterIterator extends \FilterIterator { private array $filters = []; /** * @param \Iterator<string, \SplFileInfo> $iterator The Iterator to filter * @param callable[]
{ "filepath": "src/Symfony/Component/Finder/Iterator/CustomFilterIterator.php", "language": "php", "file_size": 1527, "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\Finder\Iterator; use Symfony\Component\Finder\Comparator\DateComp...
$comparators */ public function __construct(\Iterator $iterator, array $comparators) { $this->comparators = $comparators; parent::__construct($iterator); } /** * Filters the iterator values. */
Iterator<string, \SplFileInfo> */ class DateRangeFilterIterator extends \FilterIterator { private array $comparators = []; /** * @param \Iterator<string, \SplFileInfo> $iterator * @param DateComparator[]
{ "filepath": "src/Symfony/Component/Finder/Iterator/DateRangeFilterIterator.php", "language": "php", "file_size": 1401, "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\Finder\Iterator; use Symfony\Component\Finder\SplFileInfo; /** * ExcludeDirectoryFilterIterator filters out directories. * * @author Fabien Potencier <...
te ?string $excludedPattern = null; /** @var list<callable(SplFileInfo):bool> */ private array $pruneFilters = []; /** * @param \Iterator<string, SplFileInfo> $iterator The Iterator to filter * @param list<string|callable
or implements \RecursiveIterator { /** @var \Iterator<string, SplFileInfo> */ private \Iterator $iterator; private bool $isRecursive; /** @var array<string, true> */ private array $excludedDirs = []; priva
{ "filepath": "src/Symfony/Component/Finder/Iterator/ExcludeDirectoryFilterIterator.php", "language": "php", "file_size": 3382, "cut_index": 614, "middle_length": 229 }
hp /* * 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\Finder\Iterator; use Symfony\Component\Finder\Glob; /**...
lename()); } /** * Converts glob to regexp. * * PCRE patterns are left unchanged. * Glob strings are transformed with Glob::toRegex(). * * @param string $str Pattern: glob or regexp */ protected function toRe
FileInfo> */ class FilenameFilterIterator extends MultiplePcreFilterIterator { /** * Filters the iterator values. */ public function accept(): bool { return $this->isAccepted($this->current()->getFi
{ "filepath": "src/Symfony/Component/Finder/Iterator/FilenameFilterIterator.php", "language": "php", "file_size": 1105, "cut_index": 515, "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\Finder\Iterator; use Symfony\Component\Finder\SplFileInfo; /** ...
this->current()->getRelativePathname(); if ('\\' === \DIRECTORY_SEPARATOR) { $filename = str_replace('\\', '/', $filename); } return $this->isAccepted($filename); } /** * Converts strings to regexp.
MultiplePcreFilterIterator<string, SplFileInfo> */ class PathFilterIterator extends MultiplePcreFilterIterator { /** * Filters the iterator values. */ public function accept(): bool { $filename = $
{ "filepath": "src/Symfony/Component/Finder/Iterator/PathFilterIterator.php", "language": "php", "file_size": 1423, "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\Finder\Iterator; use Symfony\Component\Finder\Exception\AccessDeniedException; use Symfony\Component\Finder\SplFileInfo; /** * Extends the \RecursiveDire...
terations private string $rootPath; private string $subPath; private string $directorySeparator = '/'; /** * @throws \RuntimeException */ public function __construct(string $path, int $flags, bool $ignoreUnreadableDirs = fals
xtends \RecursiveDirectoryIterator { private bool $ignoreUnreadableDirs; private bool $ignoreFirstRewind = true; // these 3 properties take part of the performance optimization to avoid redoing the same work in all i
{ "filepath": "src/Symfony/Component/Finder/Iterator/RecursiveDirectoryIterator.php", "language": "php", "file_size": 4136, "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\Finder\Iterator; use Symfony\Component\Finder\Gitignore; /** * @extends \FilterIterator<string, \SplFileInfo> */ final class VcsIgnoredFilterIterator ex...
$this->baseDir = $this->normalizePath($baseDir); foreach ([$this->baseDir, ...$this->parentDirectoriesUpwards($this->baseDir)] as $directory) { if (@is_dir("{$directory}/.git")) { $this->baseDir = $directory;
var array<string, bool> */ private array $ignoredPathsCache = []; /** * @param \Iterator<string, \SplFileInfo> $iterator */ public function __construct(\Iterator $iterator, string $baseDir) {
{ "filepath": "src/Symfony/Component/Finder/Iterator/VcsIgnoredFilterIterator.php", "language": "php", "file_size": 4718, "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\Finder\Tests; use PHPUnit\Framework\Attributes\RunInSeparateProcess; use Symfo...
$finder = $this->buildFinder(); $this->assertSame( $finder, $finder ->ignoreVCS(true) ->ignoreDotFiles(true) ->ignoreVCSIgnored(true) ); $openBaseDir = \dirn
$this->markTestIncomplete('Test case needs to be refactored so that PHPUnit can run it'); if (\ini_get('open_basedir')) { $this->markTestSkipped('Cannot test when open_basedir is set'); }
{ "filepath": "src/Symfony/Component/Finder/Tests/FinderOpenBasedirTest.php", "language": "php", "file_size": 1907, "cut_index": 537, "middle_length": 229 }
ore::toRegex(implode("\r\n", $gitignoreLines))); $this->assertSame($regex, Gitignore::toRegex(implode("\r", $gitignoreLines))); foreach ($matchingCases as $matchingCase) { $this->assertMatchesRegularExpression( $regex, $matchingCase, \sprintf(...
se, \sprintf("Failed asserting path:\n%s\nNOT matching gitignore patterns:\n%s", preg_replace('~^~m', ' ', $nonMatchingCase), preg_replace('~^~m', ' ', $patterns) ) )
', $patterns) ) ); } foreach ($nonMatchingCases as $nonMatchingCase) { $this->assertDoesNotMatchRegularExpression( $regex, $nonMatchingCa
{ "filepath": "src/Symfony/Component/Finder/Tests/GitignoreTest.php", "language": "php", "file_size": 26613, "cut_index": 1331, "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\Finder\Tests\Iterator; use PHPUnit\Framework\Attributes\DataProvider; use Symfony\Component\Finder\Compa...
er, $size); $this->assertIterator($expected, $iterator); } public static function getAcceptData() { $since20YearsAgo = [ '.git', 'test.py', 'foo', 'foo/bar.tmp', 'tes
public function testAccept($size, $expected) { $files = self::$files; $files[] = static::toAbsolute('doesnotexist'); $inner = new Iterator($files); $iterator = new DateRangeFilterIterator($inn
{ "filepath": "src/Symfony/Component/Finder/Tests/Iterator/DateRangeFilterIteratorTest.php", "language": "php", "file_size": 2507, "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\Finder\Tests\Iterator; use PHPUnit\Framework\Attributes\DataProvider; use Symfony\Component\Finder\Itera...
atorIterator::SELF_FIRST); $iterator = new ExcludeDirectoryFilterIterator($inner, $directories); $this->assertIterator($expected, $iterator); } public static function getAcceptData() { $foo = [ '.bar',
r('getAcceptData')] public function testAccept($directories, $expected) { $inner = new \RecursiveIteratorIterator(new RecursiveDirectoryIterator($this->toAbsolute(), \FilesystemIterator::SKIP_DOTS), \RecursiveIter
{ "filepath": "src/Symfony/Component/Finder/Tests/Iterator/ExcludeDirectoryFilterIteratorTest.php", "language": "php", "file_size": 2907, "cut_index": 563, "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\Finder\Tests\Iterator; use PHPUnit\Framework\Attributes\DataProvider; use Symf...
cceptData() { $onlyFiles = [ 'test.py', 'foo/bar.tmp', 'test.php', '.bar', '.foo/.bar', '.foo/bar', 'foo bar', 'qux/baz_100_1.py', 'zebu
, $expected) { $inner = new InnerTypeIterator(self::$files); $iterator = new FileTypeFilterIterator($inner, $mode); $this->assertIterator($expected, $iterator); } public static function getA
{ "filepath": "src/Symfony/Component/Finder/Tests/Iterator/FileTypeFilterIteratorTest.php", "language": "php", "file_size": 1983, "cut_index": 537, "middle_length": 229 }
hp /* * 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\Finder\Tests\Iterator; class Iterator implements \Iterat...
ublic function valid(): bool { return false !== $this->current(); } public function next(): void { next($this->values); } public function current(): mixed { return current($this->values); } pub
} $this->rewind(); } public function attach(\SplFileInfo $fileinfo): void { $this->values[] = $fileinfo; } public function rewind(): void { reset($this->values); } p
{ "filepath": "src/Symfony/Component/Finder/Tests/Iterator/Iterator.php", "language": "php", "file_size": 1075, "cut_index": 515, "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\Finder\Tests\Iterator; use PHPUnit\Framework\TestCase; abstract class IteratorTestCase extends TestCase { protected function assertIterator($expected,...
('/', \DIRECTORY_SEPARATOR, $path), $expected); sort($values); sort($expected); $this->assertEquals($expected, array_values($values)); } protected function assertOrderedIterator($expected, \Traversable $iterator) {
$values = array_map(static fn (\SplFileInfo $fileinfo) => str_replace('/', \DIRECTORY_SEPARATOR, $fileinfo->getPathname()), iterator_to_array($iterator, false)); $expected = array_map(static fn ($path) => str_replace
{ "filepath": "src/Symfony/Component/Finder/Tests/Iterator/IteratorTestCase.php", "language": "php", "file_size": 3425, "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\Finder; /** * Gitignore matches against text. * * @author Michael Voříšek <vorismi3@fel.cvut.cz> * @...
ingNegatedPatterns(string $gitignoreFileContent): string { return self::buildRegex($gitignoreFileContent, true); } private static function buildRegex(string $gitignoreFileContent, bool $inverted): string { $gitignoreFileCon
m/docs/gitignore#_pattern_format */ public static function toRegex(string $gitignoreFileContent): string { return self::buildRegex($gitignoreFileContent, false); } public static function toRegexMatch
{ "filepath": "src/Symfony/Component/Finder/Gitignore.php", "language": "php", "file_size": 3019, "cut_index": 563, "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\Finder; /** * Extends \SplFileInfo to support relative paths. * * @author F...
parent::__construct($file); } /** * Returns the relative path. * * This path does not contain the file name. */ public function getRelativePath(): string { return $this->relativePath; } /** * Retur
ve path * @param string $relativePathname The relative path name */ public function __construct( string $file, private string $relativePath, private string $relativePathname, ) {
{ "filepath": "src/Symfony/Component/Finder/SplFileInfo.php", "language": "php", "file_size": 1886, "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\Finder\Iterator; /** * DepthRangeFilterIterator limits the direc...
$minDepth The min depth * @param int $maxDepth The max depth */ public function __construct(\RecursiveIteratorIterator $iterator, int $minDepth = 0, int
lterIterator extends \FilterIterator { private int $minDepth = 0; /** * @param \RecursiveIteratorIterator<\RecursiveIterator<TKey, TValue>> $iterator The Iterator to filter * @param int
{ "filepath": "src/Symfony/Component/Finder/Iterator/DepthRangeFilterIterator.php", "language": "php", "file_size": 1378, "cut_index": 524, "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\Finder\Iterator; use Symfony\Component\Finder\SplFileInfo; /** ...
{ if (!$this->matchRegexps && !$this->noMatchRegexps) { return true; } $fileinfo = $this->current(); if ($fileinfo->isDir() || !$fileinfo->isReadable()) { return false; } $conte
w.pl> * * @extends MultiplePcreFilterIterator<string, SplFileInfo> */ class FilecontentFilterIterator extends MultiplePcreFilterIterator { /** * Filters the iterator values. */ public function accept(): bool
{ "filepath": "src/Symfony/Component/Finder/Iterator/FilecontentFilterIterator.php", "language": "php", "file_size": 1418, "cut_index": 524, "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\Finder\Iterator; use Symfony\Component\Finder\Comparator\NumberCo...
rs */ public function __construct(\Iterator $iterator, array $comparators) { $this->comparators = $comparators; parent::__construct($iterator); } /** * Filters the iterator values. */ public function acc
lFileInfo> */ class SizeRangeFilterIterator extends \FilterIterator { private array $comparators = []; /** * @param \Iterator<string, \SplFileInfo> $iterator * @param NumberComparator[] $comparato
{ "filepath": "src/Symfony/Component/Finder/Iterator/SizeRangeFilterIterator.php", "language": "php", "file_size": 1360, "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\Finder\Iterator; /** * SortableIterator applies a sort on a given Iterator. * * @author Fabien Potencier <fabien@symfony.com> * * @implements \Iterato...
; public const SORT_BY_NAME_NATURAL_CASE_INSENSITIVE = 8; public const SORT_BY_EXTENSION = 9; public const SORT_BY_SIZE = 10; /** @var \Traversable<string, \SplFileInfo> */ private \Traversable $iterator; private \Closure|int $sort
= 2; public const SORT_BY_ACCESSED_TIME = 3; public const SORT_BY_CHANGED_TIME = 4; public const SORT_BY_MODIFIED_TIME = 5; public const SORT_BY_NAME_NATURAL = 6; public const SORT_BY_NAME_CASE_INSENSITIVE = 7
{ "filepath": "src/Symfony/Component/Finder/Iterator/SortableIterator.php", "language": "php", "file_size": 4894, "cut_index": 614, "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\Finder\Tests\Iterator; use PHPUnit\Framework\Attributes\Dat...
= new Iterator(['test.php', 'test.py', 'foo.php']); $iterator = new CustomFilterIterator($inner, $filters); $this->assertIterator($expected, $iterator); } public static function getAcceptData() { return [
s->expectException(\InvalidArgumentException::class); new CustomFilterIterator(new Iterator(), ['foo']); } #[DataProvider('getAcceptData')] public function testAccept($filters, $expected) { $inner
{ "filepath": "src/Symfony/Component/Finder/Tests/Iterator/CustomFilterIteratorTest.php", "language": "php", "file_size": 1221, "cut_index": 518, "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\Finder\Tests\Iterator; use PHPUnit\Framework\Attributes\DataProvider; use Symfony\Component\Finder\Itera...
$iterator = new FilecontentFilterIterator($inner, ['directory'], []); $this->assertIterator([], $iterator); } public function testUnreadableFile() { $inner = new MockFileListIterator(['file r-']); $iterator = ne
$iterator = new FilecontentFilterIterator($inner, [], []); $this->assertIterator(['test.txt'], $iterator); } public function testDirectory() { $inner = new MockFileListIterator(['directory']);
{ "filepath": "src/Symfony/Component/Finder/Tests/Iterator/FilecontentFilterIteratorTest.php", "language": "php", "file_size": 2566, "cut_index": 563, "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\Finder\Tests\Iterator; use PHPUnit\Framework\TestCase; use ...
'bar'])); $this->assertCount(2, iterator_to_array($iterator)); } public function testInnerDestructedAtTheEnd() { $count = 0; $iterator = new LazyIterator(static function () use (&$count) { ++$count;
stFailed('lazyIterator should not be called'); }); $this->expectNotToPerformAssertions(); } public function testDelegate() { $iterator = new LazyIterator(static fn () => new Iterator(['foo',
{ "filepath": "src/Symfony/Component/Finder/Tests/Iterator/LazyIteratorTest.php", "language": "php", "file_size": 1235, "cut_index": 518, "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\ErrorHandler\Error; class ClassNotFoundError extends \Error { ...
previous->getFile(), 'line' => $previous->getLine(), 'trace' => $previous->getTrace(), ] as $property => $value) { $refl = new \ReflectionProperty(\Error::class, $property); $refl->setValue($this, $va
'file' => $
{ "filepath": "src/Symfony/Component/ErrorHandler/Error/ClassNotFoundError.php", "language": "php", "file_size": 816, "cut_index": 522, "middle_length": 14 }
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\ErrorHandler\Error; class FatalError extends \Error { /** * @param array $error An array as ret...
nset($frame['args'], $frame['this'], $frame); } } } elseif (null !== $traceOffset) { if (\function_exists('xdebug_get_function_stack') && \in_array(\ini_get('xdebug.mode'), ['develop', false], true) && $trace
ceArgs = true, ?array $trace = null, ) { parent::__construct($message, $code); if (null !== $trace) { if (!$traceArgs) { foreach ($trace as &$frame) { u
{ "filepath": "src/Symfony/Component/ErrorHandler/Error/FatalError.php", "language": "php", "file_size": 2792, "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\ErrorHandler\Error; class UndefinedFunctionError exte...
'line' => $previous->getLine(), 'trace' => $previous->getTrace(), ] as $property => $value) { $refl = new \ReflectionProperty(\Error::class, $property); $refl->setValue($this, $value); } } }
h ([ 'file' => $previous->getFile(),
{ "filepath": "src/Symfony/Component/ErrorHandler/Error/UndefinedFunctionError.php", "language": "php", "file_size": 820, "cut_index": 512, "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\ErrorHandler\Error; class UndefinedMethodError extends \Error {...
$previous->getFile(), 'line' => $previous->getLine(), 'trace' => $previous->getTrace(), ] as $property => $value) { $refl = new \ReflectionProperty(\Error::class, $property); $refl->setValue($this, $
'file' =>
{ "filepath": "src/Symfony/Component/ErrorHandler/Error/UndefinedMethodError.php", "language": "php", "file_size": 818, "cut_index": 522, "middle_length": 14 }
html> <html lang="en"> <head> <meta charset="<?= $this->charset; ?>" /> <meta name="robots" content="noindex,nofollow,noarchive" /> <title>An Error Occurred: <?= $statusText; ?></title> <link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 128 128%22><text ...
server returned a "<?= $statusCode; ?> <?= $statusText; ?>".</h2> <p> Something is broken. Please let us know what you were doing when this error occurred. We will fix it as soon as possible. Sorry for any inconvenience caused. </p
> <h2>The
{ "filepath": "src/Symfony/Component/ErrorHandler/Resources/views/error.html.php", "language": "php", "file_size": 819, "cut_index": 522, "middle_length": 14 }
class="exception-metadata"> <div class="container"> <h2 class="exception-hierarchy"> <?php foreach (array_reverse($exception->getAllPrevious(), true) as $index => $previousException) { ?> <a href="#trace-box-<?= $index + 2; ?>"><?= $this->abbrClass($previousExcep...
/div> <div class="exception-message-wrapper"> <div class="container"> <h1 class="break-long-words exception-message<?= mb_strlen($exceptionMessage) > 180 ? ' long' : ''; ?>"><?= $this->formatFileFromText(nl2br($exceptionMessage)); ?
-1"><?= $this->abbrClass($exception->getClass()); ?></a> </h2> <h2 class="exception-http"> HTTP <?= $statusCode; ?> <small><?= $statusText; ?></small> </h2> </div> <
{ "filepath": "src/Symfony/Component/ErrorHandler/Resources/views/exception.html.php", "language": "php", "file_size": 4529, "cut_index": 614, "middle_length": 229 }
ionMessage, $statusCode, $statusText); ?> --> <!DOCTYPE html> <html lang="en"> <head> <meta charset="<?= $this->charset; ?>" /> <meta name="robots" content="noindex,nofollow" /> <meta name="viewport" content="width=device-width,initial-scale=1" /> <title><?= $_message; ?></title> ...
(prefers-color-scheme: dark)').matches ? 'theme-dark' : 'theme-light') ); </script> <?php if (class_exists(\Composer\InstalledVersions::class) && \Composer\InstalledVersions::isInstalled('symfony/http-kernel')) { ?>
tyle><?= $this->include('assets/css/exception_full.css'); ?></style> </head> <body> <script> document.body.classList.add( localStorage.getItem('symfony/profiler/theme') || (matchMedia('
{ "filepath": "src/Symfony/Component/ErrorHandler/Resources/views/exception_full.html.php", "language": "php", "file_size": 2049, "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\Finder\Tests\Iterator; use PHPUnit\Framework\Attributes\DataProvider; use Symfony\Component\Finder\Iterator\PathFilterIterator; class PathFilterIteratorTe...
leListIterator(); // PATH: A/B/C/abc.dat $inner[] = new MockSplFileInfo([ 'name' => 'abc.dat', 'relativePathname' => 'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'C'.\DIRECTORY_SEPARATOR.'abc.dat', ])
$iterator = new PathFilterIterator($inner, $matchPatterns, $noMatchPatterns); $this->assertIterator($resultArray, $iterator); } public static function getTestFilterData() { $inner = new MockFi
{ "filepath": "src/Symfony/Component/Finder/Tests/Iterator/PathFilterIteratorTest.php", "language": "php", "file_size": 3052, "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\Finder\Tests\Iterator; use PHPUnit\Framework\Attributes\Group; use Symfony\Component\Finder\Iterator\Rec...
env('INTEGRATION_FTP_URL')) { self::markTestSkipped('INTEGRATION_FTP_URL env var is not defined.'); } $i = new RecursiveDirectoryIterator(getenv('INTEGRATION_FTP_URL').\DIRECTORY_SEPARATOR, \RecursiveDirectoryIterator::SKIP_DOT
|| !\ini_get('allow_url_fopen')) { $this->markTestSkipped('Unsupported stream "ftp".'); } } #[Group('network')] #[Group('integration')] public function testRewindOnFtp() { if (!get
{ "filepath": "src/Symfony/Component/Finder/Tests/Iterator/RecursiveDirectoryIteratorTest.php", "language": "php", "file_size": 2726, "cut_index": 563, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Finder\Tests\Iterator; use PHPUnit\Framework\Attributes\DataProvider; use Symfony\Component\Finder\Iterator\SortableIterator; class SortableIteratorTest extends RealIteratorTestCase { public function testConstructor() { try { ne...
nction testAccept($mode, $expected) { if (!\is_callable($mode)) { switch ($mode) { case SortableIterator::SORT_BY_ACCESSED_TIME: touch(self::toAbsolute('.git')); sleep(1);
$this->assertInstanceOf(\InvalidArgumentException::class, $e, '__construct() throws an \InvalidArgumentException exception if the mode is not valid'); } } #[DataProvider('getAcceptData')] public fu
{ "filepath": "src/Symfony/Component/Finder/Tests/Iterator/SortableIteratorTest.php", "language": "php", "file_size": 8180, "cut_index": 716, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Finder\Tests\Iterator; trait VfsIteratorTestTrait { private static int $vfsNextSchemeIndex = 0; /** @var array<string, \Closure(string, 'list_dir_open'|'list_dir_rewind'|'is_dir'): (list<string>|bool)> */ public static array $vfsProviders; ...
t<string>|bool)> */ public static array $vfsProviders = []; /** @var resource */ public $context; private string $scheme; private string $dirPath; /** @var list<string> */
$this->vfsScheme = 'symfony-finder-vfs-test-'.++self::$vfsNextSchemeIndex; $vfsWrapperClass = \get_class(new class { /** @var array<string, \Closure(string, 'list_dir_open'|'list_dir_rewind'|'is_dir'): (lis
{ "filepath": "src/Symfony/Component/Finder/Tests/Iterator/VfsIteratorTestTrait.php", "language": "php", "file_size": 5312, "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\Finder\Tests\Comparator; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; ...
tring $target, string $testedValue) { $c = new Comparator($target, $operator); $this->assertSame($target, $c->getTarget()); $this->assertSame($operator, $c->getOperator()); $this->assertTrue($c->test($testedValue));
ption::class); $this->expectExceptionMessage('Invalid operator "foo".'); new Comparator('some target', 'foo'); } #[DataProvider('provideMatches')] public function testTestSucceeds(string $operator, s
{ "filepath": "src/Symfony/Component/Finder/Tests/Comparator/ComparatorTest.php", "language": "php", "file_size": 2084, "cut_index": 563, "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\Finder\Comparator; /** * DateCompare compiles date comparisons. ...
InvalidArgumentException(\sprintf('Don\'t understand "%s" as a date test.', $test)); } try { $date = new \DateTimeImmutable($matches[2]); $target = $date->format('U'); } catch (\Exception) { thro
xception If the test is not understood */ public function __construct(string $test) { if (!preg_match('#^\s*(==|!=|[<>]=?|after|since|before|until)?\s*(.+?)\s*$#i', $test, $matches)) { throw new \
{ "filepath": "src/Symfony/Component/Finder/Comparator/DateComparator.php", "language": "php", "file_size": 1408, "cut_index": 524, "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\Finder\Comparator; /** * NumberComparator compiles a simple comparison to an anonymous * subroutine, w...
umber::Compare module. * * @author Fabien Potencier <fabien@symfony.com> PHP port * @author Richard Clamp <richardc@unixbeard.net> Perl version * @copyright 2004-2005 Fabien Potencier <fabien@symfony.com> * @copyright 2002 Richard Clamp <richard
tes (k, ki), * megabytes (m, mi), or gigabytes (g, gi). Those suffixed * with an i use the appropriate 2**n version in accordance with the * IEC standard: http://physics.nist.gov/cuu/Units/binary.html * * Based on the Perl N
{ "filepath": "src/Symfony/Component/Finder/Comparator/NumberComparator.php", "language": "php", "file_size": 2566, "cut_index": 563, "middle_length": 229 }
hp /* * 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\ErrorHandler; /** * Registers all the debug tools. * ...
// CLI - display errors only if they're not already logged to STDERR ini_set('display_errors', 1); } @ini_set('zend.assertions', 1); ini_set('assert.active', 1); ini_set('assert.exception', 1); Debu
; if (!\in_array(\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true)) { ini_set('display_errors', 0); } elseif (!filter_var(\ini_get('log_errors'), \FILTER_VALIDATE_BOOL) || \ini_get('error_log')) {
{ "filepath": "src/Symfony/Component/ErrorHandler/Debug.php", "language": "php", "file_size": 1119, "cut_index": 515, "middle_length": 229 }
se Symfony\Component\ErrorHandler\ErrorRenderer\CliErrorRenderer; use Symfony\Component\ErrorHandler\ErrorRenderer\HtmlErrorRenderer; use Symfony\Component\ErrorHandler\Exception\SilencedErrorContext; /** * A generic ErrorHandler for the PHP engine. * * Provides five bit fields that control how errors are handled: ...
ogging. * Uncaught exceptions are logged as E_ERROR. * E_DEPRECATED and E_USER_DEPRECATED levels never throw. * E_RECOVERABLE_ERROR and E_USER_ERROR levels always throw. * Non catchable errors that can be detected at shutdown time are logged when the s
errors logged with their stack trace * - screamedErrors: never @-silenced errors * * Each error level can be logged by a dedicated PSR-3 logger object. * Screaming only applies to logging. * Throwing takes precedence over l
{ "filepath": "src/Symfony/Component/ErrorHandler/ErrorHandler.php", "language": "php", "file_size": 27099, "cut_index": 1331, "middle_length": 229 }
e; use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; use Symfony\Component\VarDumper\Caster\Caster; use Symfony\Component\VarDumper\Cloner\Data; use Symfony\Component\VarDumper\Cloner\Stub; use Symfony\Component\VarDumper\Cloner\VarCloner; /** * FlattenException wraps a PHP Error or Exception to be a...
array $headers; private string $file; private int $line; private ?string $asString = null; private Data $dataRepresentation; public static function create(\Exception $exception, ?int $statusCode = null, array $headers = []): static
e; private string|int $code; private ?self $previous = null; private array $trace; private string $traceAsString; private string $class; private int $statusCode; private string $statusText; private
{ "filepath": "src/Symfony/Component/ErrorHandler/Exception/FlattenException.php", "language": "php", "file_size": 12109, "cut_index": 921, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\ErrorHandler\ErrorEnhancer; use Composer\Autoload\ClassLoader; use Symfony\Component\ErrorHandler\DebugClassLoader; use Symfony\Component\ErrorHandler\Error\ClassNotFoundError; use Symfony\Component\ErrorHandler\Error\FatalError; /** * @author Fabien Pote...
'"]([^\'"]+)[\'"] not found$/', $message, $matches)) { return null; } $typeName = strtolower($matches[1]); $fullyQualifiedClassName = $matches[2]; if (false !== $namespaceSeparatorIndex = strrpos($fullyQualified
ersions of PHP produce a fatal error when extending a not found class. $message = !$error instanceof FatalError ? $error->getMessage() : $error->getError()['message']; if (!preg_match('/^(Class|Interface|Trait) [\
{ "filepath": "src/Symfony/Component/ErrorHandler/ErrorEnhancer/ClassNotFoundErrorEnhancer.php", "language": "php", "file_size": 7070, "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\ErrorHandler\ErrorEnhancer; use Symfony\Component\ErrorHandler\Error\FatalError; use Symfony\Component\ErrorHandler\Error\UndefinedFunctionError; /** * @...
otFoundSuffix); if ($notFoundSuffixLen > $messageLen) { return null; } if (0 !== substr_compare($message, $notFoundSuffix, -$notFoundSuffixLen)) { return null; } $prefix = 'Call to undefined
if ($error instanceof FatalError) { return null; } $message = $error->getMessage(); $messageLen = \strlen($message); $notFoundSuffix = '()'; $notFoundSuffixLen = \strlen($n
{ "filepath": "src/Symfony/Component/ErrorHandler/ErrorEnhancer/UndefinedFunctionErrorEnhancer.php", "language": "php", "file_size": 3066, "cut_index": 614, "middle_length": 229 }
amp' => 'int', 'diff' => 'DateInterval', ], 'DateTimeImmutable' => [ '__wakeup' => 'void', '__set_state' => 'DateTimeImmutable', 'createFromFormat' => 'DateTimeImmutable|false', 'getLastErrors' => 'array|false', 'format' => 'string'...
teTimeImmutable', 'setISODate' => 'DateTimeImmutable', 'setTimestamp' => 'DateTimeImmutable', 'createFromMutable' => 'static', ], 'DateTimeZone' => [ 'getName' => 'string', 'getOff
imeImmutable|false', 'add' => 'DateTimeImmutable', 'sub' => 'DateTimeImmutable', 'setTimezone' => 'DateTimeImmutable', 'setTime' => 'DateTimeImmutable', 'setDate' => 'Da
{ "filepath": "src/Symfony/Component/ErrorHandler/Internal/TentativeTypes.php", "language": "php", "file_size": 59135, "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\Finder\Iterator; /** * MultiplePcreFilterIterator filters files using patterns (regexps, globs or strings). * * @author Fabien Potencier <fabien@symfony...
atterns that need to match * @param string[] $noMatchPatterns An array of patterns that need to not match */ public function __construct(\Iterator $iterator, array $matchPatterns, array $noMatchPatterns) { foreach (
ected array $matchRegexps = []; protected array $noMatchRegexps = []; /** * @param \Iterator<TKey, TValue> $iterator The Iterator to filter * @param string[] $matchPatterns An array of p
{ "filepath": "src/Symfony/Component/Finder/Iterator/MultiplePcreFilterIterator.php", "language": "php", "file_size": 3146, "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\Finder\Tests; use PHPUnit\Framework\TestCase; use Symfony\Component\Finder\Finder; use Symfony\Component\Finder\Glob; class GlobTest extends TestCase { ...
$finder = new Finder(); $finder->ignoreDotFiles(false); $regex = Glob::toRegex('/**/*.neon'); foreach ($finder->in(__DIR__) as $k => $v) { $k = str_replace(\DIRECTORY_SEPARATOR, '/', $k); if (preg_match(
$this->assertEquals('^\.[^/]*$', Glob::toRegex('.*', true, true, '')); $this->assertEquals('/^\.[^/]*$/', Glob::toRegex('.*', true, true, '/')); } public function testGlobToRegexDoubleStarStrictDots() {
{ "filepath": "src/Symfony/Component/Finder/Tests/GlobTest.php", "language": "php", "file_size": 4031, "cut_index": 614, "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\Finder\Tests\Iterator; use PHPUnit\Framework\Attributes\Dat...
$this->assertIterator($expected, $iterator); } public static function getAcceptData() { return [ [['test.*'], [], ['test.php', 'test.py']], [[], ['test.*'], ['foo.php']], [['*.php'], ['test.*
estAccept($matchPatterns, $noMatchPatterns, $expected) { $inner = new InnerNameIterator(['test.php', 'test.py', 'foo.php']); $iterator = new FilenameFilterIterator($inner, $matchPatterns, $noMatchPatterns);
{ "filepath": "src/Symfony/Component/Finder/Tests/Iterator/FilenameFilterIteratorTest.php", "language": "php", "file_size": 1211, "cut_index": 518, "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\Finder\Tests\Iterator; use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\Finder\Tests\FinderTest; abstract class RealIteratorTestCase ext...
oo/', 'foo/bar.tmp', 'test.php', 'toto/', 'toto/.git/', 'foo bar', 'qux_0_1.php', 'qux_2_0.php', 'qux_10_2.php', 'qux_12_0.php', 'qux_10
get_temp_dir()).\DIRECTORY_SEPARATOR.'symfony_finder'; self::$files = [ '.git/', '.foo/', '.foo/.bar', '.foo/bar', '.bar', 'test.py', 'f
{ "filepath": "src/Symfony/Component/Finder/Tests/Iterator/RealIteratorTestCase.php", "language": "php", "file_size": 4135, "cut_index": 614, "middle_length": 229 }
or\VcsIgnoredFilterIterator; class VcsIgnoredFilterIteratorTest extends IteratorTestCase { private string $tmpDir; protected function setUp(): void { $this->tmpDir = realpath(sys_get_temp_dir()).\DIRECTORY_SEPARATOR.'symfony_finder_vcs_ignored'; mkdir($this->tmpDir); } protected f...
) { if (str_ends_with($path, '/')) { mkdir($path); } else { touch($path); } } foreach ($gitIgnoreFiles as $path => $content) { file_put_contents("{$this->tmpDi
public function testAccept(array $gitIgnoreFiles, array $otherFileNames, array $expectedResult, string $baseDir = '') { $otherFileNames = $this->toAbsolute($otherFileNames); foreach ($otherFileNames as $path
{ "filepath": "src/Symfony/Component/Finder/Tests/Iterator/VcsIgnoredFilterIteratorTest.php", "language": "php", "file_size": 10071, "cut_index": 921, "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\Finder\Tests\Comparator; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Symfony\Component\Finder\Comparator\NumberCompa...
tion if the test expression is not valid.'); } catch (\Exception $e) { $this->assertInstanceOf(\InvalidArgumentException::class, $e, '__construct() throws an \InvalidArgumentException if the test expression is not valid.');
as $s) { new NumberComparator($s); } foreach ($failures as $f) { try { new NumberComparator($f); $this->fail('__construct() throws an \InvalidArgumentExcep
{ "filepath": "src/Symfony/Component/Finder/Tests/Comparator/NumberComparatorTest.php", "language": "php", "file_size": 3406, "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\ErrorHandler; use Psr\Log\AbstractLogger; /** * A buffering logger that stacks logs for later. * * @...
array { throw new \BadMethodCallException('Cannot serialize '.__CLASS__); } public function __unserialize(array $data): void { throw new \BadMethodCallException('Cannot unserialize '.__CLASS__); } public function _
{ $this->logs[] = [$level, $message, $context]; } public function cleanLogs(): array { $logs = $this->logs; $this->logs = []; return $logs; } public function __serialize():
{ "filepath": "src/Symfony/Component/ErrorHandler/BufferingLogger.php", "language": "php", "file_size": 2032, "cut_index": 563, "middle_length": 229 }
bject" types * - "deprecations": "1" to trigger a deprecation notice when a child class misses a * return type while the parent declares an "@return" annotation * * Note that patching doesn't care about any coding style so you'd better to run * php-cs-fixer after, with rules "phpdoc_trim_consec...
esource', 'boolean' => 'bool', 'true' => 'true', 'false' => 'false', 'integer' => 'int', 'array' => 'array', 'bool' => 'bool', 'callable' => 'callable', 'float' => 'float', 'int' => 'i
Nicolas Grekas <p@tchwork.com> * @author Guilhem Niot <guilhem.niot@gmail.com> */ class DebugClassLoader { private const SPECIAL_RETURN_TYPES = [ 'void' => 'void', 'null' => 'null', 'resource' => 'r
{ "filepath": "src/Symfony/Component/ErrorHandler/DebugClassLoader.php", "language": "php", "file_size": 58123, "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\ErrorHandler\Exception; /** * Data Object that represents a Sile...
{ return $this->severity; } public function getFile(): string { return $this->file; } public function getLine(): int { return $this->line; } public function getTrace(): array { return
private int $severity, private string $file, private int $line, private array $trace = [], int $count = 1, ) { $this->count = $count; } public function getSeverity(): int
{ "filepath": "src/Symfony/Component/ErrorHandler/Exception/SilencedErrorContext.php", "language": "php", "file_size": 1303, "cut_index": 524, "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\Finder\Iterator; /** * FileTypeFilterIterator only keeps files, ...
Y_FILES or self::ONLY_DIRECTORIES) */ public function __construct( \Iterator $iterator, private int $mode, ) { parent::__construct($iterator); } /** * Filters the iterator values. */ public functi
blic const ONLY_FILES = 1; public const ONLY_DIRECTORIES = 2; /** * @param \Iterator<string, \SplFileInfo> $iterator The Iterator to filter * @param int $mode The mode (self::ONL
{ "filepath": "src/Symfony/Component/Finder/Iterator/FileTypeFilterIterator.php", "language": "php", "file_size": 1364, "cut_index": 524, "middle_length": 229 }
'qux_1002_0.php', 'qux_10_2.php', 'qux_12_0.php', 'qux_2_0.php', 'zebulon.php', 'Zephire.php', ]), $finder->in(self::$tmpDir)->getIterator()); $finder = $this->buildFinder(); $finder->files(); $finder->directories(); ...
'Zephire.php', ]), $finder->in(self::$tmpDir)->getIterator()); } public function testRemoveTrailingSlash() { $finder = $this->buildFinder(); $expected = $this->toAbsolute([ 'foo/bar.tmp',
'qux/baz_1_2.py', 'qux_0_1.php', 'qux_1000_1.php', 'qux_1002_0.php', 'qux_10_2.php', 'qux_12_0.php', 'qux_2_0.php', 'zebulon.php',
{ "filepath": "src/Symfony/Component/Finder/Tests/FinderTest.php", "language": "php", "file_size": 62117, "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\Finder\Tests\Iterator; use PHPUnit\Framework\Attributes\DataProvider; use Symf...
$expected, $iterator); } public static function getAcceptData() { $lessThan1KGreaterThan05K = [ '.foo', '.git', 'foo', 'qux', 'test.php', 'toto', 'toto
vider('getAcceptData')] public function testAccept($size, $expected) { $inner = new InnerSizeIterator(self::$files); $iterator = new SizeRangeFilterIterator($inner, $size); $this->assertIterator(
{ "filepath": "src/Symfony/Component/Finder/Tests/Iterator/SizeRangeFilterIteratorTest.php", "language": "php", "file_size": 1633, "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\Finder\Comparator; /** * @author Fabien Potencier <fabien@symfon...
target value. */ public function getTarget(): string { return $this->target; } /** * Gets the comparison operator. */ public function getOperator(): string { return $this->operator; } /**
perator, ['>', '<', '>=', '<=', '==', '!='], true)) { throw new \InvalidArgumentException(\sprintf('Invalid operator "%s".', $operator)); } $this->operator = $operator; } /** * Gets the
{ "filepath": "src/Symfony/Component/Finder/Comparator/Comparator.php", "language": "php", "file_size": 1420, "cut_index": 524, "middle_length": 229 }