doc for rector rule [ci-skip]

This commit is contained in:
Julien Fastré 2023-06-06 11:14:14 +02:00
parent 05822e7e4a
commit aa6479fbf9
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB

View File

@ -32,7 +32,59 @@ class ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector extends Abstra
{
return new RuleDefinition(
'Add a getFormDefault data method on exports, filters and aggregators, filled with default data',
[]
[
<<<PHP
use Chill\MainBundle\Export\FilterInterface;
use Chill\MainBundle\Form\Type\PickRollingDateType;
use Chill\MainBundle\Service\RollingDate\RollingDate;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
class MyClass implements FilterInterface
{
public function buildForm(FormBuilderInterface $builder)
{
$builder->add('foo', PickRollingDateType::class, [
'label' => 'Test thing',
'data' => new RollingDate(RollingDate::T_TODAY)
]);
$builder->add('baz', TextType::class, [
'label' => 'OrNiCar',
'data' => 'Castor'
]);
}
}
PHP,
<<<PHP
use Chill\MainBundle\Export\FilterInterface;
use Chill\MainBundle\Form\Type\PickRollingDateType;
use Chill\MainBundle\Service\RollingDate\RollingDate;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
class MyClass implements FilterInterface
{
public function buildForm(FormBuilderInterface $builder)
{
$builder->add('foo', PickRollingDateType::class, [
'label' => 'Test thing',
'data' => new RollingDate(RollingDate::T_TODAY)
]);
$builder->add('baz', TextType::class, [
'label' => 'OrNiCar',
'data' => 'Castor'
]);
}
public function getFormDefaultData(): array
{
return ['foo' => new RollingDate(RollingDate::T_TODAY), 'baz' => 'Castor'];
}
}
PHP
]
);
}