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 https://github.com/symfony/symfony/pull/35938.

Commits
-------

6fac6d4086 [Form][CheckboxType] Remove _false_is_empty flag
This commit is contained in:
Nicolas Grekas 2020-03-19 21:44:30 +01:00
commit 836a72acba
2 changed files with 1 additions and 4 deletions

View File

@ -33,7 +33,6 @@ class CheckboxType extends AbstractType
// doing so also calls setDataLocked(true).
$builder->setData(isset($options['data']) ? $options['data'] : false);
$builder->addViewTransformer(new BooleanToStringTransformer($options['value'], $options['false_values']));
$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.
}
/**

View File

@ -740,9 +740,7 @@ class Form implements \IteratorAggregate, FormInterface, ClearableErrorsInterfac
// arrays, countables
((\is_array($this->modelData) || $this->modelData instanceof \Countable) && 0 === \count($this->modelData)) ||
// traversables that are not countable
($this->modelData instanceof \Traversable && 0 === iterator_count($this->modelData)) ||
// @internal - Do not rely on it, it will be removed in Symfony 5.1.
(false === $this->modelData && $this->config->getAttribute('_false_is_empty'));
($this->modelData instanceof \Traversable && 0 === iterator_count($this->modelData));
}
/**