Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates for SF6 #4

Merged
merged 1 commit into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Form/Type/DoctrinePolymorphicCollectionType.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function __construct(FormFactory $formFactory = null, EntityManagerInterf
$this->em = $em;
}

public function configureOptions(OptionsResolver $resolver)
public function configureOptions(OptionsResolver $resolver): void
{
parent::configureOptions($resolver);

Expand All @@ -34,7 +34,7 @@ public function configureOptions(OptionsResolver $resolver)
$resolver->setRequired('abstract_class');
}

public function buildForm(FormBuilderInterface $builder, array $options)
public function buildForm(FormBuilderInterface $builder, array $options): void
{
if (empty($options['abstract_class'])) {
throw new RuntimeException('abstract_class must be set');
Expand Down
16 changes: 8 additions & 8 deletions src/Form/Type/Node/AbstractNodeType.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ abstract class AbstractNodeType extends AbstractType
*
* {@inheritdoc}
*/
final public function configureOptions(OptionsResolver $resolver)
final public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'prototype_button_label' => null,
Expand All @@ -37,7 +37,7 @@ final public function configureOptions(OptionsResolver $resolver)
$this->configureChildOptions($resolver);
}

protected function configureChildOptions(OptionsResolver $resolver)
protected function configureChildOptions(OptionsResolver $resolver): void
{
// nothing to do on default, override method if needed
}
Expand All @@ -49,7 +49,7 @@ protected function configureChildOptions(OptionsResolver $resolver)
*
* {@inheritdoc}
*/
final public function buildForm(FormBuilderInterface $builder, array $options)
final public function buildForm(FormBuilderInterface $builder, array $options): void
{
if (!empty($options['data_class'])) {
throw new InvalidConfigurationException('AbstractNodeType requires no data_class to be defined in child types');
Expand All @@ -68,7 +68,7 @@ final public function buildForm(FormBuilderInterface $builder, array $options)
}
}

abstract protected function buildChildForm(FormBuilderInterface $builder, array $options);
abstract protected function buildChildForm(FormBuilderInterface $builder, array $options): void;

/**
* Declare as final to force to define some defaults.
Expand All @@ -77,12 +77,12 @@ abstract protected function buildChildForm(FormBuilderInterface $builder, array
*
* {@inheritdoc}
*/
final public function buildView(FormView $view, FormInterface $form, array $options)
final public function buildView(FormView $view, FormInterface $form, array $options): void
{
$this->buildChildView($view, $form, $options);
}

protected function buildChildView(FormView $view, FormInterface $form, array $options)
protected function buildChildView(FormView $view, FormInterface $form, array $options): void
{
// nothing to do on default, override method if needed
}
Expand All @@ -94,7 +94,7 @@ protected function buildChildView(FormView $view, FormInterface $form, array $op
*
* {@inheritdoc}
*/
final public function finishView(FormView $view, FormInterface $form, array $options)
final public function finishView(FormView $view, FormInterface $form, array $options): void
{
$this->finishChildView($view, $form, $options);
$view->vars['attr']['data-index'] = $view->vars['name'];
Expand All @@ -103,7 +103,7 @@ final public function finishView(FormView $view, FormInterface $form, array $opt
$view->vars['prototype_button_attr'] = $options['prototype_button_attr'];
}

protected function finishChildView(FormView $view, FormInterface $form, array $options)
protected function finishChildView(FormView $view, FormInterface $form, array $options): void
{
// nothing to do on default, override method if needed
}
Expand Down
6 changes: 3 additions & 3 deletions src/Form/Type/PolymorphicCollectionType.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function getParent(): string
return CollectionType::class;
}

public function configureOptions(OptionsResolver $resolver)
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'types_map' => [],
Expand All @@ -51,7 +51,7 @@ public function getBlockPrefix(): string
return 'polymorphic_collection';
}

public function buildForm(FormBuilderInterface $builder, array $options)
public function buildForm(FormBuilderInterface $builder, array $options): void
{
if (empty($options['types_map'])) {
throw new RuntimeException('types_map must be set');
Expand All @@ -60,7 +60,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
$this->configureResizeEventSubscriber($builder, $options);
}

public function buildView(FormView $view, FormInterface $form, array $options)
public function buildView(FormView $view, FormInterface $form, array $options): void
{
$view->vars['prototypes'] = [];

Expand Down
4 changes: 2 additions & 2 deletions tests/Example1/Form/EntityForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@

class EntityForm extends AbstractType
{
public function configureOptions(OptionsResolver $resolver)
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Entity::class,
'form_factory' => null,
]);
}

public function buildForm(FormBuilderInterface $builder, array $options)
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder->add('name');

Expand Down
2 changes: 1 addition & 1 deletion tests/Example1/Form/Type/CategoryPropertyType.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

class CategoryPropertyType extends AbstractNodeType
{
public function buildChildForm(FormBuilderInterface $builder, array $options)
public function buildChildForm(FormBuilderInterface $builder, array $options): void
{
$builder->add('categoryName');
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Example1/Form/Type/SizePropertyType.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

class SizePropertyType extends AbstractNodeType
{
public function buildChildForm(FormBuilderInterface $builder, array $options)
public function buildChildForm(FormBuilderInterface $builder, array $options): void
{
$builder->add('length');
$builder->add('width');
Expand Down
2 changes: 1 addition & 1 deletion tests/Example1/Form/Type/WeightPropertyType.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

class WeightPropertyType extends AbstractNodeType
{
public function buildChildForm(FormBuilderInterface $builder, array $options)
public function buildChildForm(FormBuilderInterface $builder, array $options): void
{
$builder->add('weight');
}
Expand Down