8000 [Form][CheckboxType] Remove _false_is_empty flag · symfony/symfony@6fac6d4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6fac6d4

Browse files
committed
[Form][CheckboxType] Remove _false_is_empty flag
1 parent eda7aad commit 6fac6d4

File tree

2 files changed

+1
-4
lines changed

2 files changed

+1
-4
lines changed

src/Symfony/Component/Form/Extension/Core/Type/CheckboxType.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ public function buildForm(FormBuilderInterface $builder, array $options)
3333
// doing so also calls setDataLocked(true).
3434
$builder->setData(isset($options['data']) ? $options['data'] : false);
3535
$builder->addViewTransformer(new BooleanToStringTransformer($options['value'], $options['false_values']));
36-
$builder->setAttribute('_false_is_empty', true); // @internal - A boolean flag to treat false as empty, see Form::isEmpty() - Do not rely on it, it will be removed in Symfony 5.1.
3736
}
3837

3938
/**

src/Symfony/Component/Form/Form.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -742,9 +742,7 @@ public function isEmpty()
742742
// arrays, countables
743743
((\is_array($this->modelData) || $this->modelData instanceof \Countable) && 0 === \count($this->modelData)) ||
744744
// traversables that are not countable
745-
($this->modelData instanceof \Traversable && 0 === iterator_count($this->modelData)) ||
746-
// @internal - Do not rely on it, it will be removed in Symfony 5.1.
747-
(false === $this->modelData && $this->config->getAttribute('_false_is_empty'));
745+
($this->modelData instanceof \Traversable && 0 === iterator_count($this->modelData));
748746
}
749747

750748
/**

0 commit comments

Comments
 (0)
0