8000 [Form] Remove deprecated a callable empty_data in ChoiceType by peter-gribanov · Pull Request #25925 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Form] Remove deprecated a callable empty_data in ChoiceType #25925

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

Closed
Changes from 1 commit
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
Prev Previous commit
Next Next commit
allow use array as handler
  • Loading branch information
peter-gribanov committed Jan 25, 2018
commit f8cc14441167428609f52f46976c6eb4f27e2e2c
8 changes: 4 additions & 4 deletions src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ public function buildForm(FormBuilderInterface $builder, array $options)
$emptyData = $form->getConfig()->getEmptyData();

if (false === FormUtil::isEmpty($emptyData) && array() !== $emptyData) {
if ($emptyData instanceof \Closure) {
$data = call_user_func($emptyData, $form, $data);
} elseif (is_callable($emptyData)) {
@trigger_error('Usage of callable empty_data not instance of Closure is deprecated since version 4.1 and will be removed in 5.0.', E_USER_DEPRECATED);
if (is_callable($emptyData)) {
if (is_string($emptyData)) {
@trigger_error('Passing callable strings is deprecated is deprecated since version 4.1 and will be removed in 5.0.', E_USER_DEPRECATED);
}
$data = call_user_func($emptyData, $form, $data);
} else {
$data = $emptyData;
Expand Down
0