Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 836a72a

Browse files
minor #36128 [Form][CheckboxType] Remove _false_is_empty flag (fancyweb)
This PR was merged into the 5.1-dev branch. Discussion ---------- [Form][CheckboxType] Remove _false_is_empty flag | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Cleanup of #35938. Commits ------- 6fac6d4 [Form][CheckboxType] Remove _false_is_empty flag
2 parents cda20aa + 6fac6d4 commit 836a72a

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
@@ -740,9 +740,7 @@ public function isEmpty()
740740
// arrays, countables
741741
((\is_array($this->modelData) || $this->modelData instanceof \Countable) && 0 === \count($this->modelData)) ||
742742
// traversables that are not countable
743-
($this->modelData instanceof \Traversable && 0 === iterator_count($this->modelData)) ||
744-
// @internal - Do not rely on it, it will be removed in Symfony 5.1.
745-
(false === $this->modelData && $this->config->getAttribute('_false_is_empty'));
743+
($this->modelData instanceof \Traversable && 0 === iterator_count($this->modelData));
746744
}
747745

748746
/**

0 commit comments

Comments
 (0)